diff --git a/tests/unit/formatters.hpp b/tests/unit/formatters.hpp index a2c9df807..0b4d25908 100644 --- a/tests/unit/formatters.hpp +++ b/tests/unit/formatters.hpp @@ -136,6 +136,8 @@ inline std::string ToString(const memgraph::query::TypedValue &value, const TAcc case memgraph::query::TypedValue::Type::Duration: os << ToString(value.ValueDuration()); break; + case memgraph::query::TypedValue::Type::Graph: + throw std::logic_error{"Not implemented"}; } return os.str(); } diff --git a/tests/unit/query_procedures_mgp_graph.cpp b/tests/unit/query_procedures_mgp_graph.cpp index 9b00ec4f8..63f16eae5 100644 --- a/tests/unit/query_procedures_mgp_graph.cpp +++ b/tests/unit/query_procedures_mgp_graph.cpp @@ -30,6 +30,7 @@ #include "storage_test_utils.hpp" #include "test_utils.hpp" #include "utils/memory.hpp" +#include "utils/variant_helpers.hpp" #define EXPECT_SUCCESS(...) EXPECT_EQ(__VA_ARGS__, mgp_error::MGP_ERROR_NO_ERROR) @@ -90,11 +91,33 @@ size_t CountMaybeIterables(TMaybeIterable &&maybe_iterable) { return std::distance(iterable.begin(), iterable.end()); } +; + void CheckEdgeCountBetween(const MgpVertexPtr &from, const MgpVertexPtr &to, const size_t number_of_edges_between) { - EXPECT_EQ(CountMaybeIterables(from->impl.InEdges(memgraph::storage::View::NEW)), 0); - EXPECT_EQ(CountMaybeIterables(from->impl.OutEdges(memgraph::storage::View::NEW)), number_of_edges_between); - EXPECT_EQ(CountMaybeIterables(to->impl.InEdges(memgraph::storage::View::NEW)), number_of_edges_between); - EXPECT_EQ(CountMaybeIterables(to->impl.OutEdges(memgraph::storage::View::NEW)), 0); + EXPECT_EQ(CountMaybeIterables(std::visit( + memgraph::utils::Overloaded{ + [vertex](auto impl) { return impl->InEdges(memgraph::storage::View::NEW); }, + }, + from->impl)), + 0); + EXPECT_EQ(CountMaybeIterables(std::visit( + memgraph::utils::Overloaded{ + [vertex](auto impl) { return impl->OutEdges(memgraph::storage::View::NEW); }, + }, + from->impl)), + number_of_edges_between); + EXPECT_EQ(CountMaybeIterables(std::visit( + memgraph::utils::Overloaded{ + [vertex](auto impl) { return impl->InEdges(memgraph::storage::View::NEW); }, + }, + to->impl)), + number_of_edges_between); + EXPECT_EQ(CountMaybeIterables(std::visit( + memgraph::utils::Overloaded{ + [vertex](auto impl) { return impl->OutEdges(memgraph::storage::View::NEW); }, + }, + to->impl)), + 0); } } // namespace