From 4b063fc4577fad5733897772b17b4e6bd063bd48 Mon Sep 17 00:00:00 2001 From: Andi Skrgat Date: Mon, 15 May 2023 15:50:21 +0200 Subject: [PATCH] Bolt encoder --- tests/unit/bolt_encoder.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/unit/bolt_encoder.cpp b/tests/unit/bolt_encoder.cpp index dd6c021e4..c3ed1e5db 100644 --- a/tests/unit/bolt_encoder.cpp +++ b/tests/unit/bolt_encoder.cpp @@ -184,44 +184,44 @@ TEST_F(BoltEncoder, VertexAndEdge) { auto va2 = dba->CreateVertex(); auto l1 = dba->NameToLabel("label1"); auto l2 = dba->NameToLabel("label2"); - ASSERT_TRUE(va1->AddLabel(l1).HasValue()); - ASSERT_TRUE(va1->AddLabel(l2).HasValue()); + ASSERT_TRUE(va1.AddLabel(l1).HasValue()); + ASSERT_TRUE(va1.AddLabel(l2).HasValue()); auto p1 = dba->NameToProperty("prop1"); auto p2 = dba->NameToProperty("prop2"); memgraph::storage::PropertyValue pv1(12), pv2(200); - ASSERT_TRUE(va1->SetProperty(p1, pv1).HasValue()); - ASSERT_TRUE(va1->SetProperty(p2, pv2).HasValue()); + ASSERT_TRUE(va1.SetProperty(p1, pv1).HasValue()); + ASSERT_TRUE(va1.SetProperty(p2, pv2).HasValue()); // create edge auto et = dba->NameToEdgeType("edgetype"); - auto ea = dba->CreateEdge(va1.get(), va2.get(), et).GetValue(); + auto ea = dba->CreateEdge(&va1, &va2, et).GetValue(); auto p3 = dba->NameToProperty("prop3"); auto p4 = dba->NameToProperty("prop4"); memgraph::storage::PropertyValue pv3(42), pv4(1234); - ASSERT_TRUE(ea->SetProperty(p3, pv3).HasValue()); - ASSERT_TRUE(ea->SetProperty(p4, pv4).HasValue()); + ASSERT_TRUE(ea.SetProperty(p3, pv3).HasValue()); + ASSERT_TRUE(ea.SetProperty(p4, pv4).HasValue()); // check everything std::vector vals; - vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::VertexAccessor(va1->Copy())), - *db, memgraph::storage::View::NEW)); - vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::VertexAccessor(va2->Copy())), - *db, memgraph::storage::View::NEW)); - vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::EdgeAccessor(ea->Copy())), - *db, memgraph::storage::View::NEW)); + vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::VertexAccessor(va1)), *db, + memgraph::storage::View::NEW)); + vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::VertexAccessor(va2)), *db, + memgraph::storage::View::NEW)); + vals.push_back(*memgraph::glue::ToBoltValue(memgraph::query::TypedValue(memgraph::query::EdgeAccessor(ea)), *db, + memgraph::storage::View::NEW)); bolt_encoder.MessageRecord(vals); // The vertexedge_encoded testdata has hardcoded zeros for IDs, // and Memgraph now encodes IDs so we need to check the output // part by part. CheckOutput(output, vertexedge_encoded, 5, false); - CheckInt(output, va1->Gid().AsInt()); + CheckInt(output, va1.Gid().AsInt()); CheckOutput(output, vertexedge_encoded + 6, 34, false); - CheckInt(output, va2->Gid().AsInt()); + CheckInt(output, va2.Gid().AsInt()); CheckOutput(output, vertexedge_encoded + 41, 4, false); - CheckInt(output, ea->Gid().AsInt()); - CheckInt(output, va1->Gid().AsInt()); - CheckInt(output, va2->Gid().AsInt()); + CheckInt(output, ea.Gid().AsInt()); + CheckInt(output, va1.Gid().AsInt()); + CheckInt(output, va2.Gid().AsInt()); CheckOutput(output, vertexedge_encoded + 48, 26); }