Skip to content

Commit

Permalink
Add assertions for better coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinTF committed Feb 26, 2025
1 parent 437ec8b commit 3fc85cd
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions test/TransitivePathTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,11 @@ class TransitivePathTest
: ad_utility::makeExecutionTree<ValuesForTesting>(
qec, std::move(std::get<std::vector<IdTable>>(sideTable)),
sideVars, false, std::vector<ColumnIndex>{sideTableCol});
return isLeft ? T->bindLeftSide(operation, sideTableCol)
: T->bindRightSide(operation, sideTableCol);
auto boundPath = isLeft ? T->bindLeftSide(operation, sideTableCol)
: T->bindRightSide(operation, sideTableCol);

EXPECT_TRUE(boundPath->isBoundOrId());
return boundPath;
}

// ___________________________________________________________________________
Expand Down Expand Up @@ -137,6 +140,8 @@ TEST_P(TransitivePathTest, idToId) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, std::numeric_limits<size_t>::max());

EXPECT_TRUE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand All @@ -153,6 +158,8 @@ TEST_P(TransitivePathTest, idToVar) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, std::numeric_limits<size_t>::max());

EXPECT_TRUE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand All @@ -173,6 +180,8 @@ TEST_P(TransitivePathTest, varToId) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, std::numeric_limits<size_t>::max());

EXPECT_TRUE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand All @@ -189,6 +198,8 @@ TEST_P(TransitivePathTest, idToVarMinLengthZero) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 0, std::numeric_limits<size_t>::max());

EXPECT_TRUE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand All @@ -210,6 +221,8 @@ TEST_P(TransitivePathTest, varToIdMinLengthZero) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 0, std::numeric_limits<size_t>::max());

EXPECT_TRUE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -238,6 +251,8 @@ TEST_P(TransitivePathTest, varTovar) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, std::numeric_limits<size_t>::max());

EXPECT_FALSE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -278,6 +293,8 @@ TEST_P(TransitivePathTest, unlimitedMaxLength) {
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, std::numeric_limits<size_t>::max());

EXPECT_FALSE(T->isBoundOrId());

auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -571,6 +588,8 @@ TEST_P(TransitivePathTest, maxLength2FromVariable) {
auto T =
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, 2);

EXPECT_FALSE(T->isBoundOrId());
auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -599,6 +618,8 @@ TEST_P(TransitivePathTest, maxLength2FromId) {
auto T =
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, 2);

EXPECT_TRUE(T->isBoundOrId());
auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -626,6 +647,8 @@ TEST_P(TransitivePathTest, maxLength2ToId) {
auto T =
makePathUnbound(std::move(sub), {Variable{"?start"}, Variable{"?target"}},
left, right, 1, 2);

EXPECT_TRUE(T->isBoundOrId());
auto resultTable = T->computeResultOnlyForTesting(requestLaziness());
assertResultMatchesIdTable(resultTable, expected);
}
Expand Down Expand Up @@ -689,6 +712,8 @@ TEST_P(TransitivePathTest, clone) {
makePathUnbound(sub.clone(), {Variable{"?start"}, Variable{"?target"}},
left, right, 0, std::numeric_limits<size_t>::max());

EXPECT_FALSE(transitivePath->isBoundOrId());

auto clone = transitivePath->clone();
ASSERT_TRUE(clone);
EXPECT_THAT(*transitivePath, IsDeepCopy(*clone));
Expand Down

0 comments on commit 3fc85cd

Please sign in to comment.