From 6d544e4fc0e92490b657c1523ae5a71022f04bb4 Mon Sep 17 00:00:00 2001 From: Kostas Kyrimis Date: Wed, 23 Nov 2022 14:51:38 +0200 Subject: [PATCH] Address GH comments --- src/expr/interpret/eval.hpp | 3 +- src/functions/CMakeLists.txt | 1 - src/functions/awesome_memgraph_functions.hpp | 103 +- src/query/v2/accessors.cpp | 12 +- src/query/v2/accessors.hpp | 45 +- src/query/v2/bindings/eval.hpp | 3 +- src/query/v2/shard_request_manager.hpp | 18 +- .../awesome_memgraph_functions.py | 2 +- tests/unit/query_v2_expression_evaluator.cpp | 112 +- tests/unit/storage_v3_edge.cpp | 4046 ----------------- 10 files changed, 76 insertions(+), 4269 deletions(-) diff --git a/src/expr/interpret/eval.hpp b/src/expr/interpret/eval.hpp index 8b8b5a7c7..4ad17437b 100644 --- a/src/expr/interpret/eval.hpp +++ b/src/expr/interpret/eval.hpp @@ -416,8 +416,7 @@ class ExpressionEvaluator : public ExpressionVisitor { typename TReturnType = std::enable_if_t, bool>> TReturnType HasLabelImpl(const VertexAccessor &vertex, const LabelIx &label_ix, QueryEngineTag /*tag*/) { auto label = typename VertexAccessor::Label{LabelId::FromUint(label_ix.ix)}; - auto has_label = vertex.HasLabel(label); - return has_label; + return vertex.HasLabel(label); } TypedValue Visit(LabelsTest &labels_test) override { diff --git a/src/functions/CMakeLists.txt b/src/functions/CMakeLists.txt index 09720c862..3a3d430cd 100644 --- a/src/functions/CMakeLists.txt +++ b/src/functions/CMakeLists.txt @@ -1,2 +1 @@ add_library(mg-functions INTERFACE) -target_include_directories(mg-functions INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/functions/awesome_memgraph_functions.hpp b/src/functions/awesome_memgraph_functions.hpp index 0a2b873c2..33cc954f5 100644 --- a/src/functions/awesome_memgraph_functions.hpp +++ b/src/functions/awesome_memgraph_functions.hpp @@ -409,21 +409,13 @@ void FType(const char *name, const TypedValueT *args, int64_t nargs, int64_t pos // TODO: Implement degrees, haversin, radians // TODO: Implement spatial functions -template +template TypedValueT EndNode(const TypedValueT *args, int64_t nargs, const FunctionContextT &ctx) { FType>("endNode", args, nargs); - if (args[0].IsNull()) return TypedValueT(ctx.memory); - if constexpr (std::is_same_v) { - const auto to = args[0].ValueEdge().To(); - auto pk = to.primary_key; - auto maybe_vertex_accessor = ctx.db_accessor->FindVertex(pk, ctx.view); - if (!maybe_vertex_accessor) { - throw functions::FunctionRuntimeException("Trying to get properties from a deleted object."); - } - return TypedValueT(*maybe_vertex_accessor, ctx.memory); - } else { - return TypedValueT(args[0].ValueEdge().To(), ctx.memory); + if (args[0].IsNull()) { + return TypedValueT(ctx.memory); } + return TypedValueT(args[0].ValueEdge().To(), ctx.memory); } template @@ -450,6 +442,7 @@ TypedValueT Properties(const TypedValueT *args, int64_t nargs, const FunctionCon auto *dba = ctx.db_accessor; auto get_properties = [&](const auto &record_accessor) { typename TypedValueT::TMap properties(ctx.memory); + Conv conv; if constexpr (std::is_same_v) { auto maybe_props = record_accessor.Properties(ctx.view); if (maybe_props.HasError()) { @@ -466,11 +459,9 @@ TypedValueT Properties(const TypedValueT *args, int64_t nargs, const FunctionCon } } for (const auto &property : *maybe_props) { - Conv conv; properties.emplace(dba->PropertyToName(property.first), conv(property.second)); } } else { - Conv conv; for (const auto &property : record_accessor.Properties()) { properties.emplace(utils::pmr::string(dba->PropertyToName(property.first), ctx.memory), conv(property.second, dba)); @@ -510,21 +501,13 @@ TypedValueT Size(const TypedValueT *args, int64_t nargs, const FunctionContextT return TypedValueT(static_cast(value.ValuePath().edges().size()), ctx.memory); } -template +template TypedValueT StartNode(const TypedValueT *args, int64_t nargs, const FunctionContextT &ctx) { FType>("startNode", args, nargs); - if (args[0].IsNull()) return TypedValueT(ctx.memory); - if constexpr (std::is_same_v) { - const auto to = args[0].ValueEdge().From(); - auto pk = to.primary_key; - auto maybe_vertex_accessor = ctx.db_accessor->FindVertex(pk, ctx.view); - if (!maybe_vertex_accessor) { - throw functions::FunctionRuntimeException("Trying to get properties from a deleted object."); - } - return TypedValueT(*maybe_vertex_accessor, ctx.memory); - } else { - return TypedValueT(args[0].ValueEdge().From(), ctx.memory); + if (args[0].IsNull()) { + return TypedValueT(ctx.memory); } + return TypedValueT(args[0].ValueEdge().From(), ctx.memory); } // This is needed because clang-tidy fails to identify the use of this function in the if-constexpr branch @@ -702,49 +685,6 @@ TypedValueT ValueType(const TypedValueT *args, int64_t nargs, const FunctionCont } } -// TODO: How is Keys different from Properties function? -template -TypedValueT Keys(const TypedValueT *args, int64_t nargs, const FunctionContextT &ctx) { - FType>("keys", args, nargs); - auto *dba = ctx.db_accessor; - auto get_keys = [&](const auto &record_accessor) { - typename TypedValueT::TVector keys(ctx.memory); - if constexpr (std::same_as) { - auto maybe_props = record_accessor.Properties(ctx.view); - if (maybe_props.HasError()) { - switch (maybe_props.GetError()) { - case storage::v3::Error::DELETED_OBJECT: - throw functions::FunctionRuntimeException("Trying to get keys from a deleted object."); - case storage::v3::Error::NONEXISTENT_OBJECT: - throw functions::FunctionRuntimeException("Trying to get keys from an object that doesn't exist."); - case storage::v3::Error::SERIALIZATION_ERROR: - case storage::v3::Error::VERTEX_HAS_EDGES: - case storage::v3::Error::PROPERTIES_DISABLED: - case storage::v3::Error::VERTEX_ALREADY_INSERTED: - throw functions::FunctionRuntimeException("Unexpected error when getting keys."); - } - } - for (const auto &property : *maybe_props) { - keys.emplace_back(dba->PropertyToName(property.first)); - } - } else { - for (const auto &property : record_accessor.Properties()) { - keys.emplace_back(dba->PropertyToName(property.first)); - } - } - return TypedValueT(std::move(keys)); - }; - - const auto &value = args[0]; - if (value.IsNull()) { - return TypedValueT(ctx.memory); - } - if (value.IsVertex()) { - return get_keys(value.ValueVertex()); - } - return get_keys(value.ValueEdge()); -} - template TypedValueT Labels(const TypedValueT *args, int64_t nargs, const FunctionContextT &ctx) { FType>("labels", args, nargs); @@ -1026,12 +966,9 @@ template TypedValueT Id(const TypedValueT *args, int64_t nargs, const FunctionContextT &ctx) { FType>("id", args, nargs); const auto &arg = args[0]; - if (arg.IsNull()) { + if (arg.IsNull() || arg.IsVertex()) { return TypedValueT(ctx.memory); } - if (arg.IsVertex()) { - return TypedValueT(static_cast(arg.ValueVertex().CypherId()), ctx.memory); - } return TypedValueT(static_cast(arg.ValueEdge().CypherId()), ctx.memory); } @@ -1382,22 +1319,24 @@ NameToFunction(const std::string &function_name) { if (function_name == "DEGREE") return functions::impl::Degree; if (function_name == "INDEGREE") return functions::impl::InDegree; if (function_name == "OUTDEGREE") return functions::impl::OutDegree; - if (function_name == "ENDNODE") return functions::impl::EndNode; if (function_name == "HEAD") return functions::impl::Head; if (function_name == kId) return functions::impl::Id; if (function_name == "LAST") return functions::impl::Last; if (function_name == "PROPERTIES") return functions::impl::Properties; if (function_name == "SIZE") return functions::impl::Size; - if (function_name == "STARTNODE") return functions::impl::StartNode; if (function_name == "TIMESTAMP") return functions::impl::Timestamp; if (function_name == "TOBOOLEAN") return functions::impl::ToBoolean; if (function_name == "TOFLOAT") return functions::impl::ToFloat; if (function_name == "TOINTEGER") return functions::impl::ToInteger; if (function_name == "TYPE") return functions::impl::Type; if (function_name == "VALUETYPE") return functions::impl::ValueType; + // Only on QE + if constexpr (std::is_same_v) { + if (function_name == "STARTNODE") return functions::impl::StartNode; + if (function_name == "ENDNODE") return functions::impl::EndNode; + } // List functions - if (function_name == "KEYS") return functions::impl::Keys; if (function_name == "LABELS") return functions::impl::Labels; if (function_name == "NODES") return functions::impl::Nodes; if (function_name == "RANGE") return functions::impl::Range; @@ -1449,9 +1388,12 @@ NameToFunction(const std::string &function_name) { // Memgraph specific functions if (function_name == "ASSERT") return functions::impl::Assert; - if (function_name == "COUNTER") return functions::impl::Counter; if (function_name == "TOBYTESTRING") return functions::impl::ToByteString; if (function_name == "FROMBYTESTRING") return functions::impl::FromByteString; + // Only on QE + if constexpr (std::is_same_v) { + if (function_name == "COUNTER") return functions::impl::Counter; + } // Functions for temporal types if (function_name == "DATE") return functions::impl::Date; @@ -1459,6 +1401,13 @@ NameToFunction(const std::string &function_name) { if (function_name == "LOCALDATETIME") return functions::impl::LocalDateTime; if (function_name == "DURATION") return functions::impl::Duration; + // Only on QE + if constexpr (std::is_same_v) { + if (function_name == "COUNTER") return functions::impl::Counter; + if (function_name == "STARTNODE") return functions::impl::StartNode; + if (function_name == "ENDNODE") return functions::impl::EndNode; + } + return nullptr; } diff --git a/src/query/v2/accessors.cpp b/src/query/v2/accessors.cpp index 63915327f..6d8abeb41 100644 --- a/src/query/v2/accessors.cpp +++ b/src/query/v2/accessors.cpp @@ -23,10 +23,11 @@ EdgeTypeId EdgeAccessor::EdgeType() const { return edge.type.id; } const std::vector> &EdgeAccessor::Properties() const { return edge.properties; } Value EdgeAccessor::GetProperty(const std::string &prop_name) const { - if (!manager_->HasProperty(prop_name)) { + auto maybe_prop = manager_->MaybeNameToProperty(prop_name); + if (!maybe_prop) { return {}; } - auto prop_id = manager_->NameToProperty(prop_name); + const auto prop_id = *maybe_prop; auto it = std::find_if(edge.properties.begin(), edge.properties.end(), [&](auto &pr) { return prop_id == pr.first; }); return it->second; } @@ -35,6 +36,8 @@ const Edge &EdgeAccessor::GetEdge() const { return edge; } bool EdgeAccessor::IsCycle() const { return edge.src == edge.dst; }; +size_t EdgeAccessor::CypherId() const { return edge.id.gid; } + VertexAccessor EdgeAccessor::To() const { return VertexAccessor(Vertex{edge.dst}, std::vector>{}, manager_); } @@ -88,10 +91,11 @@ Value VertexAccessor::GetProperty(PropertyId prop_id) const { // NOLINTNEXTLINE(readability-convert-member-functions-to-static) Value VertexAccessor::GetProperty(const std::string &prop_name) const { - if (!manager_->HasProperty(prop_name)) { + auto maybe_prop = manager_->MaybeNameToProperty(prop_name); + if (!maybe_prop) { return {}; } - return GetProperty(manager_->NameToProperty(prop_name)); + return GetProperty(*maybe_prop); } msgs::Vertex VertexAccessor::GetVertex() const { return vertex; } diff --git a/src/query/v2/accessors.hpp b/src/query/v2/accessors.hpp index 73cc24ba2..ba3937bb8 100644 --- a/src/query/v2/accessors.hpp +++ b/src/query/v2/accessors.hpp @@ -53,12 +53,7 @@ class EdgeAccessor final { [[nodiscard]] bool IsCycle() const; - // Dummy function - // NOLINTNEXTLINE(readability-convert-member-functions-to-static) - [[nodiscard]] size_t CypherId() const { return 10; } - - // bool HasSrcAccessor const { return src == nullptr; } - // bool HasDstAccessor const { return dst == nullptr; } + [[nodiscard]] size_t CypherId() const; [[nodiscard]] VertexAccessor To() const; [[nodiscard]] VertexAccessor From() const; @@ -98,44 +93,6 @@ class VertexAccessor final { [[nodiscard]] msgs::Vertex GetVertex() const; - // Dummy function - // NOLINTNEXTLINE(readability-convert-member-functions-to-static) - [[nodiscard]] size_t CypherId() const { return 10; } - - // auto InEdges(storage::View view, const std::vector &edge_types) const - // -> storage::Result { - // auto maybe_edges = impl_.InEdges(view, edge_types); - // if (maybe_edges.HasError()) return maybe_edges.GetError(); - // return iter::imap(MakeEdgeAccessor, std::move(*maybe_edges)); - // } - // - // auto InEdges(storage::View view) const { return InEdges(view, {}); } - // - // auto InEdges(storage::View view, const std::vector &edge_types, const VertexAccessor &dest) - // const - // -> storage::Result { - // auto maybe_edges = impl_.InEdges(view, edge_types, &dest.impl_); - // if (maybe_edges.HasError()) return maybe_edges.GetError(); - // return iter::imap(MakeEdgeAccessor, std::move(*maybe_edges)); - // } - // - // auto OutEdges(storage::View view, const std::vector &edge_types) const - // -> storage::Result { - // auto maybe_edges = impl_.OutEdges(view, edge_types); - // if (maybe_edges.HasError()) return maybe_edges.GetError(); - // return iter::imap(MakeEdgeAccessor, std::move(*maybe_edges)); - // } - // - // auto OutEdges(storage::View view) const { return OutEdges(view, {}); } - // - // auto OutEdges(storage::View view, const std::vector &edge_types, - // const VertexAccessor &dest) const - // -> storage::Result { - // auto maybe_edges = impl_.OutEdges(view, edge_types, &dest.impl_); - // if (maybe_edges.HasError()) return maybe_edges.GetError(); - // return iter::imap(MakeEdgeAccessor, std::move(*maybe_edges)); - // } - // NOLINTNEXTLINE(readability-convert-member-functions-to-static) [[nodiscard]] size_t InDegree() const { return 0; } diff --git a/src/query/v2/bindings/eval.hpp b/src/query/v2/bindings/eval.hpp index 52455bdb2..380eb879a 100644 --- a/src/query/v2/bindings/eval.hpp +++ b/src/query/v2/bindings/eval.hpp @@ -25,11 +25,10 @@ namespace memgraph::msgs { class ShardRequestManagerInterface; -} // namespace memgraph::msgs +} // namespace memgraph::msgs namespace memgraph::query::v2 { -inline const auto lam = [](const auto &val) { return ValueToTypedValue(val); }; namespace detail { class Callable { public: diff --git a/src/query/v2/shard_request_manager.hpp b/src/query/v2/shard_request_manager.hpp index 003cafaf8..ef2d3dc43 100644 --- a/src/query/v2/shard_request_manager.hpp +++ b/src/query/v2/shard_request_manager.hpp @@ -129,9 +129,9 @@ class ShardRequestManagerInterface { virtual const std::string &PropertyToName(memgraph::storage::v3::PropertyId prop) const = 0; virtual const std::string &LabelToName(memgraph::storage::v3::LabelId label) const = 0; virtual const std::string &EdgeTypeToName(memgraph::storage::v3::EdgeTypeId type) const = 0; - virtual bool HasProperty(const std::string &name) const = 0; - virtual bool HasEdgeType(const std::string &name) const = 0; - virtual bool HasLabel(const std::string &name) const = 0; + virtual std::optional MaybeNameToProperty(const std::string &name) const = 0; + virtual std::optional MaybeNameToEdge(const std::string &name) const = 0; + virtual std::optional MaybeNameToLabel(const std::string &name) const = 0; virtual bool IsPrimaryLabel(LabelId label) const = 0; virtual bool IsPrimaryKey(LabelId primary_label, PropertyId property) const = 0; }; @@ -356,11 +356,17 @@ class ShardRequestManager : public ShardRequestManagerInterface { return result_rows; } - bool HasProperty(const std::string &name) const override { return shards_map_.GetPropertyId(name).has_value(); } + std::optional MaybeNameToProperty(const std::string &name) const override { + return shards_map_.GetPropertyId(name); + } - bool HasEdgeType(const std::string &name) const override { return shards_map_.GetEdgeTypeId(name).has_value(); } + std::optional MaybeNameToEdge(const std::string &name) const override { + return shards_map_.GetEdgeTypeId(name); + } - bool HasLabel(const std::string &name) const override { return shards_map_.GetLabelId(name).has_value(); } + std::optional MaybeNameToLabel(const std::string &name) const override { + return shards_map_.GetLabelId(name); + } private: enum class PaginatedResponseState { Pending, PartiallyFinished }; diff --git a/tests/e2e/distributed_queries/awesome_memgraph_functions.py b/tests/e2e/distributed_queries/awesome_memgraph_functions.py index 469979733..1c4bc87a4 100644 --- a/tests/e2e/distributed_queries/awesome_memgraph_functions.py +++ b/tests/e2e/distributed_queries/awesome_memgraph_functions.py @@ -19,7 +19,7 @@ import pytest from common import * -def test_vertex_creation_and_scanall(connection): +def test_awesome_memgraph_functions(connection): wait_for_shard_manager_to_initialize() cursor = connection.cursor() diff --git a/tests/unit/query_v2_expression_evaluator.cpp b/tests/unit/query_v2_expression_evaluator.cpp index 97122ff0f..1c0130571 100644 --- a/tests/unit/query_v2_expression_evaluator.cpp +++ b/tests/unit/query_v2_expression_evaluator.cpp @@ -30,15 +30,12 @@ #include "query/v2/frontend/ast/ast.hpp" #include "query/v2/requests.hpp" #include "query/v2/shard_request_manager.hpp" +#include "query_v2_query_common.hpp" #include "storage/v3/property_value.hpp" #include "storage/v3/storage.hpp" #include "utils/exceptions.hpp" #include "utils/string.hpp" -#include "query_v2_query_common.hpp" -//#include "utils/temporal.hpp" - -using namespace memgraph::query::v2; using memgraph::query::v2::test_common::ToIntList; using testing::ElementsAre; using testing::UnorderedElementsAre; @@ -67,11 +64,11 @@ using CompoundKey = memgraph::coordinator::PrimaryKey; using memgraph::expr::ExpressionRuntimeException; using memgraph::functions::FunctionRuntimeException; -namespace { +namespace memgraph::query::v2::tests { class MockedShardRequestManager : public memgraph::msgs::ShardRequestManagerInterface { public: - using VertexAccessor = memgraph::query::v2::accessors::VertexAccessor; + using VertexAccessor = accessors::VertexAccessor; explicit MockedShardRequestManager(ShardMap shard_map) : shards_map_(std::move(shard_map)) { SetUpNameIdMappers(); } memgraph::storage::v3::EdgeTypeId NameToEdgeType(const std::string &name) const override { return shards_map_.GetEdgeTypeId(name).value(); @@ -118,11 +115,17 @@ class MockedShardRequestManager : public memgraph::msgs::ShardRequestManagerInte return edge_types_.IdToName(id.AsUint()); } - bool HasProperty(const std::string &name) const override { return shards_map_.GetPropertyId(name).has_value(); } + std::optional MaybeNameToProperty(const std::string &name) const override { + return shards_map_.GetPropertyId(name); + } - bool HasEdgeType(const std::string &name) const override { return shards_map_.GetEdgeTypeId(name).has_value(); } + std::optional MaybeNameToEdge(const std::string &name) const override { + return shards_map_.GetEdgeTypeId(name); + } - bool HasLabel(const std::string &name) const override { return shards_map_.GetLabelId(name).has_value(); } + std::optional MaybeNameToLabel(const std::string &name) const override { + return shards_map_.GetLabelId(name); + } bool IsPrimaryLabel(LabelId label) const override { return true; } @@ -211,7 +214,7 @@ class ExpressionEvaluatorTest : public ::testing::Test { protected: AstStorage storage; memgraph::utils::MonotonicBufferResource mem{1024}; - EvaluationContext ctx{.memory = &mem, .timestamp = memgraph::query::v2::QueryTimestamp()}; + EvaluationContext ctx{.memory = &mem, .timestamp = QueryTimestamp()}; SymbolTable symbol_table; Frame frame{128}; @@ -542,20 +545,19 @@ using Value = memgraph::msgs::Value; using VertexId = memgraph::msgs::VertexId; using Label = memgraph::msgs::Label; -memgraph::query::v2::accessors::VertexAccessor CreateVertex(std::vector> props, - const memgraph::msgs::ShardRequestManagerInterface *manager, - Label label = {}) { - static size_t id = 0; - return {Vertex{VertexId{label, id++}, {label}}, std::move(props), manager}; +accessors::VertexAccessor CreateVertex(std::vector> props, + const memgraph::msgs::ShardRequestManagerInterface *manager, Label label = {}) { + static int64_t id = 0; + return {Vertex{VertexId{label, {memgraph::msgs::Value(id++)}}, {label}}, std::move(props), manager}; } -memgraph::query::v2::accessors::EdgeAccessor CreateEdge(std::vector> props, - const memgraph::msgs::ShardRequestManagerInterface *manager) { - auto edge = Edge{.src = VertexId{{}, 0}, - .dst = VertexId{{}, 0}, +accessors::EdgeAccessor CreateEdge(std::vector> props, + const memgraph::msgs::ShardRequestManagerInterface *manager) { + auto edge = Edge{.src = VertexId{{}, {}}, + .dst = VertexId{{}, {}}, .properties = std::move(props), .type = EdgeType{manager->NameToEdgeType("edge_type")}}; - return memgraph::query::v2::accessors::EdgeAccessor{std::move(edge), manager}; + return accessors::EdgeAccessor{std::move(edge), manager}; } TEST_F(ExpressionEvaluatorTest, VertexAndEdgeIndexing) { @@ -575,8 +577,6 @@ TEST_F(ExpressionEvaluatorTest, VertexAndEdgeIndexing) { auto value2 = Eval(op2); EXPECT_EQ(value2.ValueInt(), 43); } - // TODO(kostasrim) Investigate - // Shall we return null on missing properties? Or shall we throw bad optional access as we do now? { // Legal indexing, non-existing key. @@ -1135,16 +1135,6 @@ class ExpressionEvaluatorPropertyLookup : public ExpressionEvaluatorTest { } }; -// TODO(kostasrim) These will fail because of memory resource not propagating correctly. This should be done as part of -// polishing the allocators. -// TEST_F(ExpressionEvaluatorPropertyLookup, Vertex) { -// auto v1 = CreateVertex({{prop_age.second, memgraph::msgs::Value(static_cast(32))}}, shard_manager.get()); -// frame[symbol] = TypedValue(v1); -// EXPECT_EQ(Value(prop_age).ValueInt(), 10); -// EXPECT_TRUE(Value(prop_height).IsNull()); -// } -// TEST_F(ExpressionEvaluatorPropertyLookup, Edge) {} - TEST_F(ExpressionEvaluatorPropertyLookup, Null) { frame[symbol] = TypedValue(); EXPECT_TRUE(Value(prop_age).IsNull()); @@ -1266,17 +1256,6 @@ TEST_F(FunctionTest, Size) { .ValueInt(), 3); ASSERT_THROW(EvaluateFunction("SIZE", 5), FunctionRuntimeException); - - // TODO(kostasrim) Add this when we enable paths on the accessors - // auto v0 = dba.InsertVertex(); - // memgraph::query::Path path(v0); - // EXPECT_EQ(EvaluateFunction("SIZE", path).ValueInt(), 0); - // auto v1 = dba.InsertVertex(); - // auto edge = dba.InsertEdge(&v0, &v1, dba.NameToEdgeType("type")); - // ASSERT_TRUE(edge.HasValue()); - // path.Expand(*edge); - // path.Expand(v1); - // EXPECT_EQ(EvaluateFunction("SIZE", path).ValueInt(), 1); } TEST_F(FunctionTest, StartNode) { @@ -1290,11 +1269,6 @@ TEST_F(FunctionTest, StartNode) { ASSERT_THROW(EvaluateFunction("STARTNODE", 2), FunctionRuntimeException); } -// TODO(kostasrim) Enable this test once we add degree to the accessors -// TEST_F(FunctionTest, Degree) {} -// TEST_F(FunctionTest, InDegree) {} -// TEST_F(FunctionTest, OutDegree) {} - TEST_F(FunctionTest, ToBoolean) { ASSERT_THROW(EvaluateFunction("TOBOOLEAN"), FunctionRuntimeException); ASSERT_TRUE(EvaluateFunction("TOBOOLEAN", TypedValue()).IsNull()); @@ -1368,9 +1342,9 @@ TEST_F(FunctionTest, Labels) { Label label{shard_manager->NameToLabel("label1")}; auto v = CreateVertex({}, shard_manager.get(), std::move(label)); std::vector labels; - auto _labels = EvaluateFunction("LABELS", v).ValueList(); - labels.reserve(_labels.size()); - for (auto label : _labels) { + auto evaluated_labels = EvaluateFunction("LABELS", v).ValueList(); + labels.reserve(evaluated_labels.size()); + for (auto label : evaluated_labels) { labels.emplace_back(label.ValueString()); } ASSERT_THAT(labels, UnorderedElementsAre("label1")); @@ -1396,27 +1370,6 @@ TEST_F(FunctionTest, Range) { EXPECT_THAT(ToIntList(EvaluateFunction("RANGE", -2, 4, -1)), ElementsAre()); } -TEST_F(FunctionTest, Keys) { - ASSERT_THROW(EvaluateFunction("KEYS"), FunctionRuntimeException); - ASSERT_TRUE(EvaluateFunction("KEYS", TypedValue()).IsNull()); - const auto height = shard_manager->NameToProperty("height"); - const auto age = shard_manager->NameToProperty("age"); - auto v1 = CreateVertex({{height, Value(static_cast(5))}, {age, Value(static_cast(10))}}, - shard_manager.get()); - auto edge = CreateEdge({{height, Value(static_cast(3))}, {age, Value(static_cast(15))}}, - shard_manager.get()); - auto prop_keys_to_string = [](TypedValue t) { - std::vector keys; - for (auto property : t.ValueList()) { - keys.emplace_back(property.ValueString()); - } - return keys; - }; - ASSERT_THAT(prop_keys_to_string(EvaluateFunction("KEYS", v1)), UnorderedElementsAre("height", "age")); - ASSERT_THAT(prop_keys_to_string(EvaluateFunction("KEYS", edge)), UnorderedElementsAre("height", "age")); - ASSERT_THROW(EvaluateFunction("KEYS", 2), FunctionRuntimeException); -} - TEST_F(FunctionTest, Tail) { ASSERT_THROW(EvaluateFunction("TAIL"), FunctionRuntimeException); ASSERT_TRUE(EvaluateFunction("TAIL", TypedValue()).IsNull()); @@ -1606,18 +1559,6 @@ TEST_F(FunctionTest, Counter) { EXPECT_THROW(EvaluateFunction("COUNTER", "c6", 0, 0), FunctionRuntimeException); } -// TODO(kostasrim) Add this once we fix accessors CypherId() functions -// TEST_F(FunctionTest, Id) { -// auto v = CreateVertex({}, shard_manager.get()); -// auto e = CreateEdge({}, shard_manager.get()); -// EXPECT_TRUE(EvaluateFunction("ID", TypedValue()).IsNull()); -// EXPECT_EQ(EvaluateFunction("ID", v).ValueInt(), 0); -// EXPECT_EQ(EvaluateFunction("ID", e).ValueInt(), 0); -// EXPECT_THROW(EvaluateFunction("ID"), FunctionRuntimeException); -// EXPECT_THROW(EvaluateFunction("ID", 0), FunctionRuntimeException); -// EXPECT_THROW(EvaluateFunction("ID", v, e), FunctionRuntimeException); -//} - TEST_F(FunctionTest, ToStringNull) { EXPECT_TRUE(EvaluateFunction("TOSTRING", TypedValue()).IsNull()); } TEST_F(FunctionTest, ToStringString) { @@ -1782,5 +1723,4 @@ TEST_F(FunctionTest, FromByteString) { EXPECT_EQ(EvaluateFunction("FROMBYTESTRING", std::string("\x00\x42", 2)).ValueString(), "0x0042"); } -// TODO(kostasrim) Add temporal type tests. -} // namespace +} // namespace memgraph::query::v2::tests diff --git a/tests/unit/storage_v3_edge.cpp b/tests/unit/storage_v3_edge.cpp index 5c0759e98..99b981b7b 100644 --- a/tests/unit/storage_v3_edge.cpp +++ b/tests/unit/storage_v3_edge.cpp @@ -279,592 +279,6 @@ TEST_P(StorageEdgeTest, EdgeCreateFromSmallerCommit) { } } -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeCreateFromLargerCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_from = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_to = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertices -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_to = acc.CreateVertex(); -// auto vertex_from = acc.CreateVertex(); -// gid_to = vertex_to.Gid(); -// gid_from = vertex_from.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&from_id, &to_id, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex_from); -// ASSERT_EQ(edge.To(), *vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeCreateFromSameCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid_vertex = vertex.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&*vertex, &*vertex, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex); -// ASSERT_EQ(edge.To(), *vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeCreateFromSmallerAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_from = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_to = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertices -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.CreateVertex(); -// auto vertex_to = acc.CreateVertex(); -// gid_from = vertex_from.Gid(); -// gid_to = vertex_to.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&from_id, &to_id, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex_from); -// ASSERT_EQ(edge.To(), *vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Abort(); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&from_id, &to_id, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex_from); -// ASSERT_EQ(edge.To(), *vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - // NOLINTNEXTLINE(hicpp-special-member-functions) TEST_P(StorageEdgeTest, EdgeCreateFromLargerAbort) { // Create vertices @@ -1174,232 +588,6 @@ TEST_P(StorageEdgeTest, EdgeCreateFromLargerAbort) { } } -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeCreateFromSameAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid_vertex = vertex.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&*vertex, &*vertex, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex); -// ASSERT_EQ(edge.To(), *vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Abort(); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&*vertex, &*vertex, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex); -// ASSERT_EQ(edge.To(), *vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - // NOLINTNEXTLINE(hicpp-special-member-functions) TEST_P(StorageEdgeTest, EdgeDeleteFromSmallerCommit) { // Create vertex @@ -1590,921 +778,6 @@ TEST_P(StorageEdgeTest, EdgeDeleteFromSmallerCommit) { } } -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeDeleteFromLargerCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_from = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_to = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertices -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_to = acc.CreateVertex(); -// auto vertex_from = acc.CreateVertex(); -// gid_from = vertex_from.Gid(); -// gid_to = vertex_to.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&from_id, &to_id, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex_from); -// ASSERT_EQ(edge.To(), *vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex_from->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeDeleteFromSameCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid_vertex = vertex.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&*vertex, &*vertex, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex); -// ASSERT_EQ(edge.To(), *vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeDeleteFromSmallerAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_from = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_to = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertices -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.CreateVertex(); -// auto vertex_to = acc.CreateVertex(); -// gid_from = vertex_from.Gid(); -// gid_to = vertex_to.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&from_id, &to_id, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex_from); -// ASSERT_EQ(edge.To(), *vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete the edge, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex_from->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); - -// acc.Abort(); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete the edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex_from->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &to_id)->size(), 1); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD, {}, &from_id)->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &from_id)->size(), 1); -// ASSERT_EQ(vertex_to->InEdges(View::OLD, {}, &to_id)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// // Check edges without filters -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - // NOLINTNEXTLINE(hicpp-special-member-functions) TEST_P(StorageEdgeTest, EdgeDeleteFromLargerAbort) { // Create vertex @@ -2814,365 +1087,6 @@ TEST_P(StorageEdgeTest, EdgeDeleteFromLargerAbort) { } } -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, EdgeDeleteFromSameAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid_vertex = vertex.Gid(); -// acc.Commit(GetNextHlc()); -// } - -// // Create edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&*vertex, &*vertex, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), *vertex); -// ASSERT_EQ(edge.To(), *vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete the edge, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); - -// acc.Abort(); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// { -// auto ret = vertex->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Delete the edge -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// auto et = acc.NameToEdgeType("et5"); - -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto res = acc.DeleteEdge(&edge); -// ASSERT_TRUE(res.HasValue()); -// ASSERT_TRUE(res.GetValue()); - -// // Check edges without filters -// { -// auto ret = vertex->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// { -// auto ret = vertex->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex); -// ASSERT_EQ(e.To(), *vertex); -// } -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// auto other_et = acc.NameToEdgeType("other"); - -// // Check edges with filters -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->InEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->InEdges(View::OLD, {other_et}, &*vertex)->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et})->size(), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {et, other_et})->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {}, &*vertex)->size(), 1); -// ASSERT_EQ(vertex->OutEdges(View::OLD, {other_et}, &*vertex)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check whether the edge exists -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid_vertex, View::NEW); -// ASSERT_TRUE(vertex); - -// // Check edges without filters -// ASSERT_EQ(vertex->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } -// } - // NOLINTNEXTLINE(hicpp-special-member-functions) TEST_P(StorageEdgeTest, VertexDetachDeleteSingleCommit) { // Create vertices @@ -3313,1964 +1227,4 @@ TEST_P(StorageEdgeTest, VertexDetachDeleteSingleCommit) { ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); } } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, VertexDetachDeleteMultipleCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex1 = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_vertex2 = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.CreateVertex(); -// auto vertex2 = acc.CreateVertex(); - -// gid_vertex1 = vertex1.Gid(); -// gid_vertex2 = vertex2.Gid(); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// auto res1 = acc.CreateEdge(&vertex1, &vertex2, et1); -// ASSERT_TRUE(res1.HasValue()); -// auto edge1 = res1.GetValue(); -// ASSERT_EQ(edge1.EdgeType(), et1); -// ASSERT_EQ(edge1.From(), vertex1); -// ASSERT_EQ(edge1.To(), vertex2); - -// auto res2 = acc.CreateEdge(&vertex2, &vertex1, et2); -// ASSERT_TRUE(res2.HasValue()); -// auto edge2 = res2.GetValue(); -// ASSERT_EQ(edge2.EdgeType(), et2); -// ASSERT_EQ(edge2.From(), vertex2); -// ASSERT_EQ(edge2.To(), vertex1); - -// auto res3 = acc.CreateEdge(&vertex1, &vertex1, et3); -// ASSERT_TRUE(res3.HasValue()); -// auto edge3 = res3.GetValue(); -// ASSERT_EQ(edge3.EdgeType(), et3); -// ASSERT_EQ(edge3.From(), vertex1); -// ASSERT_EQ(edge3.To(), vertex1); - -// auto res4 = acc.CreateEdge(&vertex2, &vertex2, et4); -// ASSERT_TRUE(res4.HasValue()); -// auto edge4 = res4.GetValue(); -// ASSERT_EQ(edge4.EdgeType(), et4); -// ASSERT_EQ(edge4.From(), vertex2); -// ASSERT_EQ(edge4.To(), vertex2); - -// // Check edges -// { -// auto ret = vertex1.InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1.InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex1); -// } -// } -// { -// auto ret = vertex1.OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1.OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex1); -// } -// } -// { -// auto ret = vertex2.InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2.InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex2); -// } -// } -// { -// auto ret = vertex2.OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2.OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex2); -// } -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Detach delete vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_TRUE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// // Delete must fail -// { -// auto ret = acc.DeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasError()); -// ASSERT_EQ(ret.GetError(), memgraph::storage::Error::VERTEX_HAS_EDGES); -// } - -// // Detach delete vertex -// { -// auto ret = acc.DetachDeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasValue()); -// ASSERT_TRUE(*ret); -// } - -// // Check edges -// { -// auto ret = vertex1->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->InEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->InDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex1->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->OutEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->OutDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Check dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_FALSE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et4 = acc.NameToEdgeType("et4"); - -// // Check edges -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, VertexDetachDeleteSingleAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_from = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_to = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.CreateVertex(); -// auto vertex_to = acc.CreateVertex(); - -// auto et = acc.NameToEdgeType("et5"); - -// auto res = acc.CreateEdge(&vertex_from, &vertex_to, et); -// ASSERT_TRUE(res.HasValue()); -// auto edge = res.GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex_from); -// ASSERT_EQ(edge.To(), vertex_to); - -// gid_from = vertex_from.Gid(); -// gid_to = vertex_to.Gid(); - -// // Check edges -// ASSERT_EQ(vertex_from.InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from.InDegree(View::NEW), 0); -// { -// auto ret = vertex_from.OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from.OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), vertex_from); -// ASSERT_EQ(e.To(), vertex_to); -// } -// { -// auto ret = vertex_to.InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to.InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), vertex_from); -// ASSERT_EQ(e.To(), vertex_to); -// } -// ASSERT_EQ(vertex_to.OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to.OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Detach delete vertex, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Delete must fail -// { -// auto ret = acc.DeleteVertex(&from_id); -// ASSERT_TRUE(ret.HasError()); -// ASSERT_EQ(ret.GetError(), memgraph::storage::Error::VERTEX_HAS_EDGES); -// } - -// // Detach delete vertex -// { -// auto ret = acc.DetachDeleteVertex(&from_id); -// ASSERT_TRUE(ret.HasValue()); -// ASSERT_TRUE(*ret); -// } - -// // Check edges -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex_from->InDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_from->OutEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex_from->OutDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Abort(); -// } - -// // Check dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Check edges -// ASSERT_EQ(vertex_from->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::NEW), 0); -// { -// auto ret = vertex_from->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// { -// auto ret = vertex_to->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Detach delete vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_TRUE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// auto et = acc.NameToEdgeType("et5"); - -// // Delete must fail -// { -// auto ret = acc.DeleteVertex(&from_id); -// ASSERT_TRUE(ret.HasError()); -// ASSERT_EQ(ret.GetError(), memgraph::storage::Error::VERTEX_HAS_EDGES); -// } - -// // Detach delete vertex -// { -// auto ret = acc.DetachDeleteVertex(&from_id); -// ASSERT_TRUE(ret.HasValue()); -// ASSERT_TRUE(*ret); -// } - -// // Check edges -// ASSERT_EQ(vertex_from->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_from->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_from->InEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex_from->InDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex_from->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_from->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_from->OutEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex_from->OutDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex_to->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et); -// ASSERT_EQ(e.From(), *vertex_from); -// ASSERT_EQ(e.To(), *vertex_to); -// } -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex_from = acc.FindVertex(gid_from, View::NEW); -// auto vertex_to = acc.FindVertex(gid_to, View::NEW); -// ASSERT_FALSE(vertex_from); -// ASSERT_TRUE(vertex_to); - -// // Check edges -// ASSERT_EQ(vertex_to->InEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->InEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->InDegree(View::NEW), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::OLD)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::OLD), 0); -// ASSERT_EQ(vertex_to->OutEdges(View::NEW)->size(), 0); -// ASSERT_EQ(*vertex_to->OutDegree(View::NEW), 0); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST_P(StorageEdgeTest, VertexDetachDeleteMultipleAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = GetParam()}}); -// memgraph::storage::Gid gid_vertex1 = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// memgraph::storage::Gid gid_vertex2 = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.CreateVertex(); -// auto vertex2 = acc.CreateVertex(); - -// gid_vertex1 = vertex1.Gid(); -// gid_vertex2 = vertex2.Gid(); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// auto res1 = acc.CreateEdge(&vertex1, &vertex2, et1); -// ASSERT_TRUE(res1.HasValue()); -// auto edge1 = res1.GetValue(); -// ASSERT_EQ(edge1.EdgeType(), et1); -// ASSERT_EQ(edge1.From(), vertex1); -// ASSERT_EQ(edge1.To(), vertex2); - -// auto res2 = acc.CreateEdge(&vertex2, &vertex1, et2); -// ASSERT_TRUE(res2.HasValue()); -// auto edge2 = res2.GetValue(); -// ASSERT_EQ(edge2.EdgeType(), et2); -// ASSERT_EQ(edge2.From(), vertex2); -// ASSERT_EQ(edge2.To(), vertex1); - -// auto res3 = acc.CreateEdge(&vertex1, &vertex1, et3); -// ASSERT_TRUE(res3.HasValue()); -// auto edge3 = res3.GetValue(); -// ASSERT_EQ(edge3.EdgeType(), et3); -// ASSERT_EQ(edge3.From(), vertex1); -// ASSERT_EQ(edge3.To(), vertex1); - -// auto res4 = acc.CreateEdge(&vertex2, &vertex2, et4); -// ASSERT_TRUE(res4.HasValue()); -// auto edge4 = res4.GetValue(); -// ASSERT_EQ(edge4.EdgeType(), et4); -// ASSERT_EQ(edge4.From(), vertex2); -// ASSERT_EQ(edge4.To(), vertex2); - -// // Check edges -// { -// auto ret = vertex1.InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1.InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex1); -// } -// } -// { -// auto ret = vertex1.OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1.OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex1); -// } -// } -// { -// auto ret = vertex2.InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2.InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), vertex1); -// ASSERT_EQ(e.To(), vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex2); -// } -// } -// { -// auto ret = vertex2.OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2.OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), vertex2); -// ASSERT_EQ(e.To(), vertex2); -// } -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Detach delete vertex, but abort the transaction -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_TRUE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// // Delete must fail -// { -// auto ret = acc.DeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasError()); -// ASSERT_EQ(ret.GetError(), memgraph::storage::Error::VERTEX_HAS_EDGES); -// } - -// // Detach delete vertex -// { -// auto ret = acc.DetachDeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasValue()); -// ASSERT_TRUE(*ret); -// } - -// // Check edges -// { -// auto ret = vertex1->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->InEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->InDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex1->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->OutEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->OutDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } - -// acc.Abort(); -// } - -// // Check dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_TRUE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// // Check edges -// { -// auto ret = vertex1->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// { -// auto ret = vertex1->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// { -// auto ret = vertex1->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// { -// auto ret = vertex1->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->InDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->OutDegree(View::NEW), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Detach delete vertex -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_TRUE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et1 = acc.NameToEdgeType("et1"); -// auto et2 = acc.NameToEdgeType("et2"); -// auto et3 = acc.NameToEdgeType("et3"); -// auto et4 = acc.NameToEdgeType("et4"); - -// // Delete must fail -// { -// auto ret = acc.DeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasError()); -// ASSERT_EQ(ret.GetError(), memgraph::storage::Error::VERTEX_HAS_EDGES); -// } - -// // Detach delete vertex -// { -// auto ret = acc.DetachDeleteVertex(&*vertex1); -// ASSERT_TRUE(ret.HasValue()); -// ASSERT_TRUE(*ret); -// } - -// // Check edges -// { -// auto ret = vertex1->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->InEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->InDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex1->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex1->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et3); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex1); -// } -// } -// ASSERT_EQ(vertex1->OutEdges(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// ASSERT_EQ(vertex1->OutDegree(View::NEW).GetError(), memgraph::storage::Error::DELETED_OBJECT); -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->InDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et1); -// ASSERT_EQ(e.From(), *vertex1); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// std::sort(edges.begin(), edges.end(), [](const auto &a, const auto &b) { return a.EdgeType() < b.EdgeType(); -// }); ASSERT_EQ(edges.size(), 2); ASSERT_EQ(*vertex2->OutDegree(View::OLD), 2); -// { -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et2); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex1); -// } -// { -// auto e = edges[1]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Check dataset -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex1 = acc.FindVertex(gid_vertex1, View::NEW); -// auto vertex2 = acc.FindVertex(gid_vertex2, View::NEW); -// ASSERT_FALSE(vertex1); -// ASSERT_TRUE(vertex2); - -// auto et4 = acc.NameToEdgeType("et4"); - -// // Check edges -// { -// auto ret = vertex2->InEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->InEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->InDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::OLD); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::OLD), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// { -// auto ret = vertex2->OutEdges(View::NEW); -// ASSERT_TRUE(ret.HasValue()); -// auto edges = ret.GetValue(); -// ASSERT_EQ(edges.size(), 1); -// ASSERT_EQ(*vertex2->OutDegree(View::NEW), 1); -// auto e = edges[0]; -// ASSERT_EQ(e.EdgeType(), et4); -// ASSERT_EQ(e.From(), *vertex2); -// ASSERT_EQ(e.To(), *vertex2); -// } -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST(StorageWithProperties, EdgePropertyCommit) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = true}}); -// memgraph::storage::Gid gid = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("temporary")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "temporary"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "temporary"); -// } - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("nandare")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue()); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue()); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); -// } - -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST(StorageWithProperties, EdgePropertyAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = true}}); -// memgraph::storage::Gid gid = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); - -// // Create the vertex. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); -// acc.Commit(GetNextHlc()); -// } - -// // Set property 5 to "nandare", but abort the transaction. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("temporary")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "temporary"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "temporary"); -// } - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("nandare")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// acc.Abort(); -// } - -// // Check that property 5 is null. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } - -// // Set property 5 to "nandare". -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("temporary")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "temporary"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "temporary"); -// } - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue("nandare")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// acc.Commit(GetNextHlc()); -// } - -// // Check that property 5 is "nandare". -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } - -// // Set property 5 to null, but abort the transaction. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue()); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// acc.Abort(); -// } - -// // Check that property 5 is "nandare". -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } - -// // Set property 5 to null. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::NEW)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// { -// auto old_value = edge.SetProperty(property, memgraph::storage::PropertyValue()); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_FALSE(old_value->IsNull()); -// } - -// ASSERT_EQ(edge.GetProperty(property, View::OLD)->ValueString(), "nandare"); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property].ValueString(), "nandare"); -// } - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// acc.Commit(GetNextHlc()); -// } - -// // Check that property 5 is null. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST(StorageWithProperties, EdgePropertySerializationError) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = true}}); -// memgraph::storage::Gid gid = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); -// acc.Commit(GetNextHlc()); -// } - -// auto acc1 = store.Access(GetNextHlc()); -// auto acc2 = store.Access(GetNextHlc()); - -// // Set property 1 to 123 in accessor 1. -// { -// auto vertex = acc1.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property1 = acc1.NameToProperty("property1"); -// auto property2 = acc1.NameToProperty("property2"); - -// ASSERT_TRUE(edge.GetProperty(property1, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto old_value = edge.SetProperty(property1, memgraph::storage::PropertyValue(123)); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); -// } - -// ASSERT_TRUE(edge.GetProperty(property1, View::OLD)->IsNull()); -// ASSERT_EQ(edge.GetProperty(property1, View::NEW)->ValueInt(), 123); -// ASSERT_TRUE(edge.GetProperty(property2, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property1].ValueInt(), 123); -// } -// } - -// // Set property 2 to "nandare" in accessor 2. -// { -// auto vertex = acc2.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property1 = acc2.NameToProperty("property1"); -// auto property2 = acc2.NameToProperty("property2"); - -// ASSERT_TRUE(edge.GetProperty(property1, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto res = edge.SetProperty(property2, memgraph::storage::PropertyValue("nandare")); -// ASSERT_TRUE(res.HasError()); -// ASSERT_EQ(res.GetError(), memgraph::storage::Error::SERIALIZATION_ERROR); -// } -// } - -// // Finalize both accessors. -// ASSERT_FALSE(acc1.Commit(GetNextHlc()); -// acc2.Abort(); - -// // Check which properties exist. -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property1 = acc.NameToProperty("property1"); -// auto property2 = acc.NameToProperty("property2"); - -// ASSERT_EQ(edge.GetProperty(property1, View::OLD)->ValueInt(), 123); -// ASSERT_TRUE(edge.GetProperty(property2, View::OLD)->IsNull()); -// { -// auto properties = edge.Properties(View::OLD).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property1].ValueInt(), 123); -// } - -// ASSERT_EQ(edge.GetProperty(property1, View::NEW)->ValueInt(), 123); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// { -// auto properties = edge.Properties(View::NEW).GetValue(); -// ASSERT_EQ(properties.size(), 1); -// ASSERT_EQ(properties[property1].ValueInt(), 123); -// } - -// acc.Abort(); -// } -// } - -// TEST(StorageWithProperties, EdgePropertyClear) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = true}}); -// memgraph::storage::Gid gid; -// auto property1 = store.NameToProperty("property1"); -// auto property2 = store.NameToProperty("property2"); -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); - -// auto old_value = edge.SetProperty(property1, memgraph::storage::PropertyValue("value")); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); - -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// ASSERT_EQ(edge.GetProperty(property1, View::OLD)->ValueString(), "value"); -// ASSERT_TRUE(edge.GetProperty(property2, View::OLD)->IsNull()); -// ASSERT_THAT(edge.Properties(View::OLD).GetValue(), -// UnorderedElementsAre(std::pair(property1, memgraph::storage::PropertyValue("value")))); - -// { -// auto old_values = edge.ClearProperties(); -// ASSERT_TRUE(old_values.HasValue()); -// ASSERT_FALSE(old_values->empty()); -// } - -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW).GetValue().size(), 0); - -// { -// auto old_values = edge.ClearProperties(); -// ASSERT_TRUE(old_values.HasValue()); -// ASSERT_TRUE(old_values->empty()); -// } - -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW).GetValue().size(), 0); - -// acc.Abort(); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto old_value = edge.SetProperty(property2, memgraph::storage::PropertyValue(42)); -// ASSERT_TRUE(old_value.HasValue()); -// ASSERT_TRUE(old_value->IsNull()); - -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// ASSERT_EQ(edge.GetProperty(property1, View::OLD)->ValueString(), "value"); -// ASSERT_EQ(edge.GetProperty(property2, View::OLD)->ValueInt(), 42); -// ASSERT_THAT(edge.Properties(View::OLD).GetValue(), -// UnorderedElementsAre(std::pair(property1, memgraph::storage::PropertyValue("value")), -// std::pair(property2, memgraph::storage::PropertyValue(42)))); - -// { -// auto old_values = edge.ClearProperties(); -// ASSERT_TRUE(old_values.HasValue()); -// ASSERT_FALSE(old_values->empty()); -// } - -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW).GetValue().size(), 0); - -// { -// auto old_values = edge.ClearProperties(); -// ASSERT_TRUE(old_values.HasValue()); -// ASSERT_TRUE(old_values->empty()); -// } - -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW).GetValue().size(), 0); - -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// ASSERT_TRUE(edge.GetProperty(property1, View::NEW)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(property2, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW).GetValue().size(), 0); - -// acc.Abort(); -// } -// } - -// // NOLINTNEXTLINE(hicpp-special-member-functions) -// TEST(StorageWithoutProperties, EdgePropertyAbort) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = false}}); -// memgraph::storage::Gid gid = memgraph::storage::Gid::FromUint(std::numeric_limits::max()); -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto res = edge.SetProperty(property, memgraph::storage::PropertyValue("temporary")); -// ASSERT_TRUE(res.HasError()); -// ASSERT_EQ(res.GetError(), memgraph::storage::Error::PROPERTIES_DISABLED); -// } - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// { -// auto res = edge.SetProperty(property, memgraph::storage::PropertyValue("nandare")); -// ASSERT_TRUE(res.HasError()); -// ASSERT_EQ(res.GetError(), memgraph::storage::Error::PROPERTIES_DISABLED); -// } - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// acc.Abort(); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// auto property = acc.NameToProperty("property5"); - -// ASSERT_TRUE(edge.GetProperty(property, View::OLD)->IsNull()); -// ASSERT_EQ(edge.Properties(View::OLD)->size(), 0); - -// ASSERT_TRUE(edge.GetProperty(property, View::NEW)->IsNull()); -// ASSERT_EQ(edge.Properties(View::NEW)->size(), 0); - -// auto other_property = acc.NameToProperty("other"); - -// ASSERT_TRUE(edge.GetProperty(other_property, View::OLD)->IsNull()); -// ASSERT_TRUE(edge.GetProperty(other_property, View::NEW)->IsNull()); - -// acc.Abort(); -// } -// } - -// TEST(StorageWithoutProperties, EdgePropertyClear) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = false}}); -// memgraph::storage::Gid gid; -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// gid = vertex.Gid(); -// auto et = acc.NameToEdgeType("et5"); -// auto edge = acc.CreateEdge(&vertex, &vertex, et).GetValue(); -// ASSERT_EQ(edge.EdgeType(), et); -// ASSERT_EQ(edge.From(), vertex); -// ASSERT_EQ(edge.To(), vertex); -// acc.Commit(GetNextHlc()); -// } -// { -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.FindVertex(gid, View::OLD); -// ASSERT_TRUE(vertex); -// auto edge = vertex->OutEdges(View::NEW).GetValue()[0]; - -// ASSERT_EQ(edge.ClearProperties().GetError(), memgraph::storage::Error::PROPERTIES_DISABLED); - -// acc.Abort(); -// } -// } - -// TEST(StorageWithProperties, EdgeNonexistentPropertyAPI) { -// memgraph::storage::Storage store({.items = {.properties_on_edges = true}}); - -// auto property = store.NameToProperty("property"); - -// auto acc = store.Access(GetNextHlc()); -// auto vertex = acc.CreateVertex(); -// auto edge = acc.CreateEdge(&vertex, &vertex, acc.NameToEdgeType("edge")); -// ASSERT_TRUE(edge.HasValue()); - -// // Check state before (OLD view). -// ASSERT_EQ(edge->Properties(View::OLD).GetError(), memgraph::storage::Error::NONEXISTENT_OBJECT); -// ASSERT_EQ(edge->GetProperty(property, View::OLD).GetError(), memgraph::storage::Error::NONEXISTENT_OBJECT); - -// // Check state before (NEW view). -// ASSERT_EQ(edge->Properties(View::NEW)->size(), 0); -// ASSERT_EQ(*edge->GetProperty(property, View::NEW), memgraph::storage::PropertyValue()); - -// // Modify edge. -// ASSERT_TRUE(edge->SetProperty(property, memgraph::storage::PropertyValue("value"))->IsNull()); - -// // Check state after (OLD view). -// ASSERT_EQ(edge->Properties(View::OLD).GetError(), memgraph::storage::Error::NONEXISTENT_OBJECT); -// ASSERT_EQ(edge->GetProperty(property, View::OLD).GetError(), memgraph::storage::Error::NONEXISTENT_OBJECT); - -// // Check state after (NEW view). -// ASSERT_EQ(edge->Properties(View::NEW)->size(), 1); -// ASSERT_EQ(*edge->GetProperty(property, View::NEW), memgraph::storage::PropertyValue("value")); - -// acc.Commit(GetNextHlc()); -// } } // namespace memgraph::storage::v3::tests