Skip to content

Commit

Permalink
Update DataTable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
morzhovets committed May 14, 2024
1 parent fa02a01 commit 5b3df48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/sources/SimpleDataSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace sample_data1
table.AddUniqueHashIndex(strCol, intCol);

table.AddRow(strCol = "b", intCol = 1, dblCol = 0.5);
table.AddRow(intCol = 2, dblCol = 0.5); // strCol = ""
table.AddRow(intCol = 2, dblCol = 2.5); // strCol = ""

table.TryAddRow(intCol = 2); // not added because of unique index

Expand All @@ -51,7 +51,7 @@ namespace sample_data1
for (auto row : table)
std::cout << row[intCol] << " " << row[dblCol] << " " << row[strCol] << std::endl;
// 1 1.5 b
// 2 0.5 a
// 2 2.5 a

{
// select by condition
Expand Down
5 changes: 5 additions & 0 deletions test/sources/SimpleDataTester.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ class SimpleDataTester

assert((*table.FindByUniqueHash(keyIndex, table.NewRow(strCol = "1", intCol = 0)))[intCol] == 0);
assert(ctable.FindByUniqueHash(keyIndex, table.NewRow(intCol = 0, strCol = "1"))->Get(intCol) == 0);
if constexpr (!dynamic)
{
assert((*table.FindByUniqueHash(keyIndex,
table.NewRow(Struct{ .intStruct = 0, .strStruct = "1" })))[intCol] == 0);
}

assert(table.FindByUniqueHash(keyIndex, intCol == 0, strCol == "1")->Get(strCol) == "1");
assert((*ctable.FindByUniqueHash(keyIndex, strCol == "1", intCol == 0))[strCol] == "1");
Expand Down

0 comments on commit 5b3df48

Please sign in to comment.