fix part of tests

This commit is contained in:
antoniofilipovic 2022-08-16 17:21:08 +02:00
parent 6706d0701f
commit 3c84ad16cb
2 changed files with 29 additions and 4 deletions

View File

@ -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();
}

View File

@ -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