Fix bug on (vertex|edge) properties in C++ API (#732)
This commit is contained in:
committed by
GitHub
parent
128a6cd522
commit
1cd1da84fd
@@ -1,4 +1,4 @@
|
||||
// Copyright 2022 Memgraph Ltd.
|
||||
// Copyright 2023 Memgraph Ltd.
|
||||
//
|
||||
// Use of this software is governed by the Business Source License
|
||||
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
|
||||
@@ -195,7 +195,7 @@ TEST_F(CppApiTestFixture, TestNode) {
|
||||
ASSERT_EQ(node_1.HasLabel("L1"), true);
|
||||
ASSERT_EQ(node_1.HasLabel("L2"), true);
|
||||
|
||||
ASSERT_EQ(node_1.Properties().Size(), 0);
|
||||
ASSERT_EQ(node_1.Properties().size(), 0);
|
||||
|
||||
auto node_2 = graph.GetNodeById(node_1.Id());
|
||||
|
||||
@@ -264,7 +264,7 @@ TEST_F(CppApiTestFixture, TestRelationship) {
|
||||
auto relationship = graph.CreateRelationship(node_1, node_2, "edge_type");
|
||||
|
||||
ASSERT_EQ(relationship.Type(), "edge_type");
|
||||
ASSERT_EQ(relationship.Properties().Size(), 0);
|
||||
ASSERT_EQ(relationship.Properties().size(), 0);
|
||||
ASSERT_EQ(relationship.From().Id(), node_1.Id());
|
||||
ASSERT_EQ(relationship.To().Id(), node_2.Id());
|
||||
|
||||
@@ -419,3 +419,19 @@ TEST_F(CppApiTestFixture, TestDuration) {
|
||||
// Use Value move constructor
|
||||
auto value_y = mgp::Value(mgp::Duration("PT2M2.33S"));
|
||||
}
|
||||
|
||||
TEST_F(CppApiTestFixture, TestNodeProperties) {
|
||||
mgp_graph raw_graph = CreateGraph(memgraph::storage::View::NEW);
|
||||
auto graph = mgp::Graph(&raw_graph);
|
||||
|
||||
auto node_1 = graph.CreateNode();
|
||||
|
||||
ASSERT_EQ(node_1.Properties().size(), 0);
|
||||
|
||||
std::map<std::string, mgp::Value> node1_prop = node_1.Properties();
|
||||
node_1.SetProperty("b", mgp::Value("b"));
|
||||
|
||||
ASSERT_EQ(node_1.Properties().size(), 1);
|
||||
ASSERT_EQ(node_1.Properties()["b"].ValueString(), "b");
|
||||
ASSERT_EQ(node_1.GetProperty("b").ValueString(), "b");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user