Skip to content

Commit

Permalink
Fix inequality assertions for real numbers failing on Valgrind (1/2)
Browse files Browse the repository at this point in the history
EXPECT_DOUBLE_EQ
  • Loading branch information
SRombauts committed Aug 29, 2023
1 parent e4ca307 commit d4d57b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions tests/Column_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void test_column_basis(bool utf16)
EXPECT_STREQ("first", ptxt);
EXPECT_EQ("first", msg);
EXPECT_EQ(-123, integer);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);
EXPECT_EQ(0, memcmp("bl\0b", pblob, size));
#if !defined(_MSC_VER) || _MSC_VER >= 1900
EXPECT_EQ((size_t)size, sblob.size());
Expand Down Expand Up @@ -129,7 +129,7 @@ static void test_column_basis(bool utf16)
EXPECT_EQ("first", msg1);
EXPECT_EQ("first", msg2);
EXPECT_EQ(-123, integer);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);
EXPECT_EQ(0, memcmp("bl\0b", pblob, 4));
EXPECT_EQ(0, memcmp("bl\0b", &sblob[0], 4));
}
Expand Down Expand Up @@ -195,7 +195,7 @@ static void test_column_basis(bool utf16)
const SQLite::Column integer = query.getColumn(2);
EXPECT_EQ(-123, integer.getInt());
const SQLite::Column dbl = query.getColumn(3);
EXPECT_EQ(0.123, dbl.getDouble());
EXPECT_DOUBLE_EQ(0.123, dbl.getDouble());
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/Statement_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ TEST(Statement, executeStep)
EXPECT_EQ("first", msg);
EXPECT_EQ(123, integer);
EXPECT_EQ(123, integer2);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);

// Step one more time to discover there is nothing more
query.executeStep();
Expand Down Expand Up @@ -227,7 +227,7 @@ TEST(Statement, tryExecuteStep)
EXPECT_EQ("first", msg);
EXPECT_EQ(123, integer);
EXPECT_EQ(123, integer2);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);

// Step one more time to discover there is nothing more
EXPECT_EQ(query.tryExecuteStep(), SQLITE_DONE);
Expand Down Expand Up @@ -595,7 +595,7 @@ TEST(Statement, bindByNameString)
EXPECT_EQ(1, query.getColumn(0).getInt64());
EXPECT_STREQ("first", query.getColumn(1).getText());
EXPECT_EQ(123, query.getColumn(2).getInt());
EXPECT_EQ(0.123, query.getColumn(3).getDouble());
EXPECT_DOUBLE_EQ(0.123, query.getColumn(3).getDouble());
EXPECT_EQ(-123, query.getColumn(4).getInt());

// reset() with clearbindings() and new bindings
Expand Down Expand Up @@ -899,7 +899,7 @@ TEST(Statement, getColumnByName)
const double real = query.getColumn("double");
EXPECT_EQ("first", msg);
EXPECT_EQ(123, integer);
EXPECT_EQ(0.123, real);
EXPECT_DOUBLE_EQ(0.123, real);
}

TEST(Statement, getName)
Expand Down Expand Up @@ -1000,14 +1000,14 @@ TEST(Statement, getColumns)
EXPECT_EQ(1, testStruct.id);
EXPECT_EQ("first", testStruct.msg);
EXPECT_EQ(123, testStruct.integer);
EXPECT_EQ(0.123, testStruct.real);
EXPECT_DOUBLE_EQ(0.123, testStruct.real);

// Get only the first 2 columns
auto testStruct2 = query.getColumns<GetRowTestStruct, 2>();
EXPECT_EQ(1, testStruct2.id);
EXPECT_EQ("first", testStruct2.msg);
EXPECT_EQ(-1, testStruct2.integer);
EXPECT_EQ(0.0, testStruct2.real);
EXPECT_DOUBLE_EQ(0.0, testStruct2.real);
}
#endif

Expand Down

0 comments on commit d4d57b7

Please sign in to comment.