From b99fdc0efb9d5791897e55d6526cce0d3d02d9f0 Mon Sep 17 00:00:00 2001 From: Julian Mundhahs Date: Mon, 10 Feb 2025 11:17:12 +0100 Subject: [PATCH] update tests --- test/DeltaTriplesCountTest.cpp | 5 ++--- test/DeltaTriplesTestHelpers.h | 2 +- test/ExecuteUpdateTest.cpp | 24 +++++++++++++----------- test/ServerTest.cpp | 3 ++- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/test/DeltaTriplesCountTest.cpp b/test/DeltaTriplesCountTest.cpp index 1a72f356de..b04c0b4745 100644 --- a/test/DeltaTriplesCountTest.cpp +++ b/test/DeltaTriplesCountTest.cpp @@ -21,7 +21,6 @@ TEST(DeltaTriplesCountTest, toJson) { TEST(DeltaTriplesCountTest, subtractOperator) { constexpr DeltaTriplesCount count1{10, 5}; constexpr DeltaTriplesCount count2{3, 2}; - constexpr DeltaTriplesCount expected{7, 3}; - const DeltaTriplesCount actual = count1 - count2; - EXPECT_THAT(actual, testing::Eq(expected)); + EXPECT_THAT(count1 - count2, testing::Eq(DeltaTriplesCount{7, 3})); + EXPECT_THAT(count2 - count1, testing::Eq(DeltaTriplesCount{-7, -3})); } diff --git a/test/DeltaTriplesTestHelpers.h b/test/DeltaTriplesTestHelpers.h index 17d8e994ce..8bbd39ac6b 100644 --- a/test/DeltaTriplesTestHelpers.h +++ b/test/DeltaTriplesTestHelpers.h @@ -41,7 +41,7 @@ inline auto NumTriplesInAllPermutations = // `getCounts()` of a `DeltaTriples` and `numTriples()` for all // `LocatedTriplesPerBlock` of the `DeltaTriples`. inline auto NumTriples = - [](size_t inserted, size_t deleted, + [](int64_t inserted, int64_t deleted, size_t inAllPermutations) -> testing::Matcher { return testing::AllOf( AD_PROPERTY(DeltaTriples, numInserted, testing::Eq(inserted)), diff --git a/test/ExecuteUpdateTest.cpp b/test/ExecuteUpdateTest.cpp index b376660785..5907e9c833 100644 --- a/test/ExecuteUpdateTest.cpp +++ b/test/ExecuteUpdateTest.cpp @@ -52,7 +52,9 @@ TEST(ExecuteUpdate, executeUpdate) { auto expectExecuteUpdate = [&index, &expectExecuteUpdateHelper]( const std::string& update, - const testing::Matcher& deltaTriplesMatcher) { + const testing::Matcher& deltaTriplesMatcher, + source_location sourceLocation = source_location::current()) { + auto l = generateLocationTrace(sourceLocation); DeltaTriples deltaTriples{index}; expectExecuteUpdateHelper(update, deltaTriples); EXPECT_THAT(deltaTriples, deltaTriplesMatcher); @@ -127,7 +129,9 @@ TEST(ExecuteUpdate, computeGraphUpdateQuads) { [&executeComputeGraphUpdateQuads]( const std::string& update, const Matcher>&>& toInsertMatcher, - const Matcher>&>& toDeleteMatcher) { + const Matcher>&>& toDeleteMatcher, + source_location sourceLocation = source_location::current()) { + auto l = generateLocationTrace(sourceLocation); EXPECT_THAT(executeComputeGraphUpdateQuads(update), Pair(AD_FIELD(ExecuteUpdate::IdTriplesAndLocalVocab, idTriples_, toInsertMatcher), @@ -137,7 +141,9 @@ TEST(ExecuteUpdate, computeGraphUpdateQuads) { auto expectComputeGraphUpdateQuadsFails = [&executeComputeGraphUpdateQuads]( const std::string& update, - const Matcher& messageMatcher) { + const Matcher& messageMatcher, + source_location sourceLocation = source_location::current()) { + auto l = generateLocationTrace(sourceLocation); AD_EXPECT_THROW_WITH_MESSAGE(executeComputeGraphUpdateQuads(update), messageMatcher); }; @@ -151,22 +157,18 @@ TEST(ExecuteUpdate, computeGraphUpdateQuads) { ElementsAreArray({IdTriple(Id(""), Id("