diff --git a/src/memgraph_init.cpp b/src/memgraph_init.cpp index ce3c54018..82c378997 100644 --- a/src/memgraph_init.cpp +++ b/src/memgraph_init.cpp @@ -47,7 +47,7 @@ std::vector<std::string> BoltSession::Interpret( params_pv.emplace(kv.first, glue::ToPropertyValue(kv.second)); #ifndef MG_SINGLE_NODE_HA audit_log_->Record(endpoint_.address(), user_ ? user_->username() : "", query, - params_pv); + PropertyValue(params_pv)); #endif try { auto result = transaction_engine_.Interpret(query, params_pv); diff --git a/src/query/frontend/stripped.cpp b/src/query/frontend/stripped.cpp index ab4fd3eb0..36d00223e 100644 --- a/src/query/frontend/stripped.cpp +++ b/src/query/frontend/stripped.cpp @@ -66,9 +66,9 @@ StrippedQuery::StrippedQuery(const std::string &query) : original_(query) { // literals_. In stripped query text literal is replaced with a new_value. // new_value can be any value that is lexed as a literal. auto replace_stripped = [this, &token_strings](int position, - const PropertyValue &value, + const auto &value, const std::string &new_value) { - literals_.Add(position, value); + literals_.Add(position, PropertyValue(value)); token_strings.push_back(new_value); }; diff --git a/src/storage/common/types/property_value.hpp b/src/storage/common/types/property_value.hpp index a6f97e916..ef6f0c742 100644 --- a/src/storage/common/types/property_value.hpp +++ b/src/storage/common/types/property_value.hpp @@ -42,35 +42,38 @@ class PropertyValue { PropertyValue() : type_(Type::Null) {} // constructors for primitive types - PropertyValue(bool value) : type_(Type::Bool) { bool_v = value; } - PropertyValue(int value) : type_(Type::Int) { int_v = value; } - PropertyValue(int64_t value) : type_(Type::Int) { int_v = value; } - PropertyValue(double value) : type_(Type::Double) { double_v = value; } + explicit PropertyValue(bool value) : type_(Type::Bool) { bool_v = value; } + explicit PropertyValue(int value) : type_(Type::Int) { int_v = value; } + explicit PropertyValue(int64_t value) : type_(Type::Int) { int_v = value; } + explicit PropertyValue(double value) : type_(Type::Double) { + double_v = value; + } // constructors for non-primitive types - PropertyValue(const std::string &value) : type_(Type::String) { + explicit PropertyValue(const std::string &value) : type_(Type::String) { new (&string_v) std::string(value); } - PropertyValue(const char *value) : type_(Type::String) { + explicit PropertyValue(const char *value) : type_(Type::String) { new (&string_v) std::string(value); } - PropertyValue(const std::vector<PropertyValue> &value) : type_(Type::List) { + explicit PropertyValue(const std::vector<PropertyValue> &value) + : type_(Type::List) { new (&list_v) std::vector<PropertyValue>(value); } - PropertyValue(const std::map<std::string, PropertyValue> &value) + explicit PropertyValue(const std::map<std::string, PropertyValue> &value) : type_(Type::Map) { new (&map_v) std::map<std::string, PropertyValue>(value); } // move constructors for non-primitive types - PropertyValue(std::string &&value) noexcept : type_(Type::String) { + explicit PropertyValue(std::string &&value) noexcept : type_(Type::String) { new (&string_v) std::string(std::move(value)); } - PropertyValue(std::vector<PropertyValue> &&value) noexcept + explicit PropertyValue(std::vector<PropertyValue> &&value) noexcept : type_(Type::List) { new (&list_v) std::vector<PropertyValue>(std::move(value)); } - PropertyValue(std::map<std::string, PropertyValue> &&value) noexcept + explicit PropertyValue(std::map<std::string, PropertyValue> &&value) noexcept : type_(Type::Map) { new (&map_v) std::map<std::string, PropertyValue>(std::move(value)); } diff --git a/src/storage/common/types/property_value_store.cpp b/src/storage/common/types/property_value_store.cpp index ea7d47804..1c80bc4c8 100644 --- a/src/storage/common/types/property_value_store.cpp +++ b/src/storage/common/types/property_value_store.cpp @@ -76,7 +76,7 @@ PropertyValue PropertyValueStore::at(const Property &key) const { } void PropertyValueStore::set(const Property &key, const char *value) { - set(key, std::string(value)); + set(key, PropertyValue(value)); } void PropertyValueStore::set(const Property &key, const PropertyValue &value) { diff --git a/src/storage/common/types/slk.cpp b/src/storage/common/types/slk.cpp index 499a3db49..d2aa4d177 100644 --- a/src/storage/common/types/slk.cpp +++ b/src/storage/common/types/slk.cpp @@ -56,25 +56,25 @@ void Load(PropertyValue *value, slk::Reader *reader) { case static_cast<uint8_t>(1): { bool v; slk::Load(&v, reader); - *value = v; + *value = PropertyValue(v); return; } case static_cast<uint8_t>(2): { int64_t v; slk::Load(&v, reader); - *value = v; + *value = PropertyValue(v); return; } case static_cast<uint8_t>(3): { double v; slk::Load(&v, reader); - *value = v; + *value = PropertyValue(v); return; } case static_cast<uint8_t>(4): { std::string v; slk::Load(&v, reader); - *value = std::move(v); + *value = PropertyValue(std::move(v)); return; } case static_cast<uint8_t>(5): { @@ -84,7 +84,7 @@ void Load(PropertyValue *value, slk::Reader *reader) { for (size_t i = 0; i < size; ++i) { slk::Load(&list[i], reader); } - *value = std::move(list); + *value = PropertyValue(std::move(list)); return; } case static_cast<uint8_t>(6): { @@ -96,7 +96,7 @@ void Load(PropertyValue *value, slk::Reader *reader) { slk::Load(&kv, reader); map.insert(kv); } - *value = std::move(map); + *value = PropertyValue(std::move(map)); return; } default: diff --git a/tests/benchmark/query/planner.cpp b/tests/benchmark/query/planner.cpp index ef741b580..3187138e8 100644 --- a/tests/benchmark/query/planner.cpp +++ b/tests/benchmark/query/planner.cpp @@ -99,7 +99,7 @@ static auto CreateIndexedVertices(int index_count, int vertex_count, for (int index = 0; index < index_count; ++index) { auto vertex = dba.InsertVertex(); vertex.add_label(label); - vertex.PropsSet(prop, index); + vertex.PropsSet(prop, PropertyValue(index)); } } dba.Commit(); diff --git a/tests/manual/repl.cpp b/tests/manual/repl.cpp index bc932327b..5792898ae 100644 --- a/tests/manual/repl.cpp +++ b/tests/manual/repl.cpp @@ -149,7 +149,8 @@ class RandomGraphGenerator { auto dba = db_.Access(); auto property = dba.Property(prop_name); for (VertexAccessor va : dba.Vertices(false)) - if (predicate(va)) va.PropsSet(property, value_generator()); + if (predicate(va)) + va.PropsSet(property, PropertyValue(value_generator())); dba.Commit(); } diff --git a/tests/unit/bfs_common.hpp b/tests/unit/bfs_common.hpp index 083b40f66..ef1477e2a 100644 --- a/tests/unit/bfs_common.hpp +++ b/tests/unit/bfs_common.hpp @@ -368,7 +368,7 @@ void BfsTest(Database *db, int lower_bound, int upper_bound, {query::TypedValue(VertexAccessor(vertices[5], *dba_ptr))}}); filter_expr = NEQ(PROPERTY_LOOKUP(inner_node, PROPERTY_PAIR("id")), PARAMETER_LOOKUP(0)); - context.evaluation_context.parameters.Add(0, 5); + context.evaluation_context.parameters.Add(0, PropertyValue(5)); break; case FilterLambdaType::ERROR: // Evaluate to 42 for vertex #5 which is on worker 1. diff --git a/tests/unit/bfs_single_node.cpp b/tests/unit/bfs_single_node.cpp index 9c442054b..3b9a13b5c 100644 --- a/tests/unit/bfs_single_node.cpp +++ b/tests/unit/bfs_single_node.cpp @@ -39,7 +39,8 @@ class SingleNodeDb : public Database { for (size_t id = 0; id < vertex_locations.size(); ++id) { auto vertex = dba->InsertVertex(); - vertex.PropsSet(dba->Property("id"), (int64_t)id); + vertex.PropsSet(dba->Property("id"), + PropertyValue(static_cast<int64_t>(id))); vertex_addr.push_back(vertex.address()); } @@ -50,8 +51,8 @@ class SingleNodeDb : public Database { VertexAccessor from(vertex_addr[u], *dba); VertexAccessor to(vertex_addr[v], *dba); auto edge = dba->InsertEdge(from, to, dba->EdgeType(type)); - edge.PropsSet(dba->Property("from"), u); - edge.PropsSet(dba->Property("to"), v); + edge.PropsSet(dba->Property("from"), PropertyValue(u)); + edge.PropsSet(dba->Property("to"), PropertyValue(v)); edge_addr.push_back(edge.address()); } diff --git a/tests/unit/bolt_session.cpp b/tests/unit/bolt_session.cpp index 21f8a0bd3..187459495 100644 --- a/tests/unit/bolt_session.cpp +++ b/tests/unit/bolt_session.cpp @@ -39,7 +39,7 @@ class TestSession : public Session<TestInputStream, TestOutputStream> { std::map<std::string, Value> PullAll(TEncoder *encoder) override { if (query_ == kQueryReturn42) { - encoder->MessageRecord(std::vector<Value>{42}); + encoder->MessageRecord(std::vector<Value>{Value(42)}); return {}; } else if (query_ == kQueryEmpty) { return {}; diff --git a/tests/unit/database_dump.cpp b/tests/unit/database_dump.cpp index d15fda9d4..e33ff214d 100644 --- a/tests/unit/database_dump.cpp +++ b/tests/unit/database_dump.cpp @@ -456,7 +456,7 @@ TEST(DumpTest, UniqueConstraints) { DatabaseEnvironment db; { auto dba = db.Access(); - CreateVertex(&dba, {"Label"}, {{"prop", 1}}, false); + CreateVertex(&dba, {"Label"}, {{"prop", PropertyValue(1)}}, false); Execute(&dba, "CREATE CONSTRAINT ON (u:Label) ASSERT u.prop IS UNIQUE;"); // Create one with multiple properties. Execute( @@ -489,8 +489,9 @@ TEST(DumpTest, CheckStateVertexWithMultipleProperties) { auto dba = db.Access(); std::map<std::string, PropertyValue> prop1 = { {"nested1", PropertyValue(1337)}, {"nested2", PropertyValue(3.14)}}; - CreateVertex(&dba, {"Label1", "Label2"}, - {{"prop1", prop1}, {"prop2", PropertyValue("$'\t'")}}); + CreateVertex( + &dba, {"Label1", "Label2"}, + {{"prop1", PropertyValue(prop1)}, {"prop2", PropertyValue("$'\t'")}}); dba.Commit(); } @@ -513,18 +514,22 @@ TEST(DumpTest, CheckStateSimpleGraph) { DatabaseEnvironment db; { auto dba = db.Access(); - auto u = CreateVertex(&dba, {"Person"}, {{"name", "Ivan"}}); - auto v = CreateVertex(&dba, {"Person"}, {{"name", "Josko"}}); - auto w = CreateVertex(&dba, {"Person"}, {{"name", "Bosko"}, {"id", 0}}); - auto z = CreateVertex(&dba, {"Person"}, {{"name", "Buha"}, {"id", 1}}); + auto u = CreateVertex(&dba, {"Person"}, {{"name", PropertyValue("Ivan")}}); + auto v = CreateVertex(&dba, {"Person"}, {{"name", PropertyValue("Josko")}}); + auto w = CreateVertex( + &dba, {"Person"}, + {{"name", PropertyValue("Bosko")}, {"id", PropertyValue(0)}}); + auto z = CreateVertex( + &dba, {"Person"}, + {{"name", PropertyValue("Buha")}, {"id", PropertyValue(1)}}); CreateEdge(&dba, u, v, "Knows", {}); - CreateEdge(&dba, v, w, "Knows", {{"how_long", 5}}); - CreateEdge(&dba, w, u, "Knows", {{"how", "distant past"}}); + CreateEdge(&dba, v, w, "Knows", {{"how_long", PropertyValue(5)}}); + CreateEdge(&dba, w, u, "Knows", {{"how", PropertyValue("distant past")}}); CreateEdge(&dba, v, u, "Knows", {}); CreateEdge(&dba, v, u, "Likes", {}); CreateEdge(&dba, z, u, "Knows", {}); - CreateEdge(&dba, w, z, "Knows", {{"how", "school"}}); - CreateEdge(&dba, w, z, "Likes", {{"how", "very much"}}); + CreateEdge(&dba, w, z, "Knows", {{"how", PropertyValue("school")}}); + CreateEdge(&dba, w, z, "Likes", {{"how", PropertyValue("very much")}}); // Create few indices Execute(&dba, "CREATE CONSTRAINT ON (u:Person) ASSERT u.name IS UNIQUE;"); Execute(&dba, "CREATE INDEX ON :Person(id);"); diff --git a/tests/unit/durability.cpp b/tests/unit/durability.cpp index f30d9faea..5acdd92e9 100644 --- a/tests/unit/durability.cpp +++ b/tests/unit/durability.cpp @@ -153,11 +153,11 @@ class DbGenerator { PropertyValue RandomValue() { switch (RandomInt(3)) { case 0: - return rand_(gen_); // Float + return PropertyValue(rand_(gen_)); // Float case 1: - return RandomInt(1000); + return PropertyValue(RandomInt(1000)); case 2: - return rand_(gen_) < 0.5; + return PropertyValue(rand_(gen_) < 0.5); default: LOG(FATAL) << "Unsupported random value"; } @@ -368,12 +368,14 @@ TEST_F(Durability, WalEncoding) { auto v0 = dba.InsertVertex(); ASSERT_EQ(v0.gid(), gid0); v0.add_label(dba.Label("l0")); - v0.PropsSet(dba.Property("p0"), 42); + v0.PropsSet(dba.Property("p0"), PropertyValue(42)); auto v1 = dba.InsertVertex(); ASSERT_EQ(v1.gid(), gid1); auto e0 = dba.InsertEdge(v0, v1, dba.EdgeType("et0")); ASSERT_EQ(e0.gid(), gid0); - e0.PropsSet(dba.Property("p0"), std::vector<PropertyValue>{1, 2, 3}); + e0.PropsSet(dba.Property("p0"), + PropertyValue(std::vector<PropertyValue>{ + PropertyValue(1), PropertyValue(2), PropertyValue(3)})); dba.BuildIndex(dba.Label("l1"), dba.Property("p1")); dba.DeleteIndex(dba.Label("l1"), dba.Property("p1")); dba.Commit(); @@ -452,18 +454,20 @@ TEST_F(Durability, SnapshotEncoding) { auto v0 = dba.InsertVertex(); ASSERT_EQ(v0.gid(), gid0); v0.add_label(dba.Label("l0")); - v0.PropsSet(dba.Property("p0"), 42); + v0.PropsSet(dba.Property("p0"), PropertyValue(42)); auto v1 = dba.InsertVertex(); ASSERT_EQ(v1.gid(), gid1); v1.add_label(dba.Label("l0")); v1.add_label(dba.Label("l1")); auto v2 = dba.InsertVertex(); ASSERT_EQ(v2.gid(), gid2); - v2.PropsSet(dba.Property("p0"), true); - v2.PropsSet(dba.Property("p1"), "Johnny"); + v2.PropsSet(dba.Property("p0"), PropertyValue(true)); + v2.PropsSet(dba.Property("p1"), PropertyValue("Johnny")); auto e0 = dba.InsertEdge(v0, v1, dba.EdgeType("et0")); ASSERT_EQ(e0.gid(), gid0); - e0.PropsSet(dba.Property("p0"), std::vector<PropertyValue>{1, 2, 3}); + e0.PropsSet(dba.Property("p0"), + PropertyValue(std::vector<PropertyValue>{ + PropertyValue(1), PropertyValue(2), PropertyValue(3)})); auto e1 = dba.InsertEdge(v2, v1, dba.EdgeType("et1")); ASSERT_EQ(e1.gid(), gid1); dba.BuildIndex(dba.Label("l1"), dba.Property("p1")); @@ -821,7 +825,7 @@ TEST_F(Durability, SequentialRecovery) { auto dba = db.Access(); auto v = dba.FindVertex(random_int(kNumVertices), false); try { - v.PropsSet(dba.Property("prop"), random_int(100)); + v.PropsSet(dba.Property("prop"), PropertyValue(random_int(100))); } catch (utils::LockTimeoutException &) { } catch (mvcc::SerializationError &) { } @@ -943,7 +947,7 @@ TEST_F(Durability, UniqueIndexRecoverySnapshotAndWal) { auto v0 = dba.InsertVertex(); v0.add_label(label); - v0.PropsSet(property, 5); + v0.PropsSet(property, PropertyValue(5)); dba.Commit(); } @@ -959,7 +963,7 @@ TEST_F(Durability, UniqueIndexRecoverySnapshotAndWal) { auto v0 = dba.InsertVertex(); v0.add_label(label); - v0.PropsSet(property, 5); + v0.PropsSet(property, PropertyValue(5)); dba.Commit(); } @@ -987,13 +991,13 @@ TEST_F(Durability, UniqueIndexRecoveryWal) { auto v0 = dba.InsertVertex(); v0.add_label(label); - v0.PropsSet(property, 5); + v0.PropsSet(property, PropertyValue(5)); dba.DeleteIndex(label, property); auto v1 = dba.InsertVertex(); v1.add_label(label); - v1.PropsSet(property, 5); + v1.PropsSet(property, PropertyValue(5)); dba.Commit(); } diff --git a/tests/unit/graph_db.cpp b/tests/unit/graph_db.cpp index 06d72e026..25c2f3206 100644 --- a/tests/unit/graph_db.cpp +++ b/tests/unit/graph_db.cpp @@ -24,7 +24,7 @@ TEST(GraphDbTest, GarbageCollectIndices) { auto vertex = dba.InsertVertex(); vertex.add_label(label); - vertex.PropsSet(property, 42); + vertex.PropsSet(property, PropertyValue(42)); commit(); EXPECT_EQ(dba.VerticesCount(label, property), 1); diff --git a/tests/unit/graph_db_accessor.cpp b/tests/unit/graph_db_accessor.cpp index 75586259a..29e67d91c 100644 --- a/tests/unit/graph_db_accessor.cpp +++ b/tests/unit/graph_db_accessor.cpp @@ -371,11 +371,11 @@ TEST(GraphDbAccessorTest, Transfer) { auto dba1 = db.Access(); auto prop = dba1.Property("property"); VertexAccessor v1 = dba1.InsertVertex(); - v1.PropsSet(prop, 1); + v1.PropsSet(prop, PropertyValue(1)); VertexAccessor v2 = dba1.InsertVertex(); - v2.PropsSet(prop, 2); + v2.PropsSet(prop, PropertyValue(2)); EdgeAccessor e12 = dba1.InsertEdge(v1, v2, dba1.EdgeType("et")); - e12.PropsSet(prop, 12); + e12.PropsSet(prop, PropertyValue(12)); // make dba2 that has dba1 in it's snapshot, so data isn't visible auto dba2 = db.Access(); diff --git a/tests/unit/graph_db_accessor_index_api.cpp b/tests/unit/graph_db_accessor_index_api.cpp index 46a8f1cb7..f84e2da6f 100644 --- a/tests/unit/graph_db_accessor_index_api.cpp +++ b/tests/unit/graph_db_accessor_index_api.cpp @@ -38,7 +38,7 @@ class GraphDbAccessorIndex : public testing::Test { auto AddVertex(int property_value) { auto vertex = dba.InsertVertex(); vertex.add_label(label); - vertex.PropsSet(property, property_value); + vertex.PropsSet(property, PropertyValue(property_value)); return vertex; } @@ -185,6 +185,16 @@ TEST(GraphDbAccessorIndexApi, LabelPropertyBuildIndexConcurrent) { EXPECT_THAT( \ x, testing::AllOf(testing::Ge(center - 2), testing::Le(center + 2))); +template <class TValue> +auto Inclusive(TValue value) { + return std::make_optional(utils::MakeBoundInclusive(PropertyValue(value))); +} + +template <class TValue> +auto Exclusive(TValue value) { + return std::make_optional(utils::MakeBoundExclusive(PropertyValue(value))); +} + TEST_F(GraphDbAccessorIndex, LabelPropertyValueCount) { dba.BuildIndex(label, property); @@ -197,19 +207,15 @@ TEST_F(GraphDbAccessorIndex, LabelPropertyValueCount) { for (int i = 0; i < 1000; i++) AddVertex(30 + i / 100); // test estimates for exact value count - EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, 10), 10); - EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, 14), 10); - EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, 30), 100); - EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, 39), 100); - EXPECT_EQ(dba.VerticesCount(label, property, 40), 0); + EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, PropertyValue(10)), 10); + EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, PropertyValue(14)), 10); + EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, PropertyValue(30)), + 100); + EXPECT_WITH_MARGIN(dba.VerticesCount(label, property, PropertyValue(39)), + 100); + EXPECT_EQ(dba.VerticesCount(label, property, PropertyValue(40)), 0); // helper functions - auto Inclusive = [](int64_t value) { - return std::make_optional(utils::MakeBoundInclusive(PropertyValue(value))); - }; - auto Exclusive = [](int64_t value) { - return std::make_optional(utils::MakeBoundExclusive(PropertyValue(value))); - }; auto VerticesCount = [this](auto lower, auto upper) { return dba.VerticesCount(label, property, lower, upper); }; @@ -235,32 +241,31 @@ TEST_F(GraphDbAccessorIndex, LabelPropertyValueIteration) { // insert 10 verties and and check visibility for (int i = 0; i < 10; i++) AddVertex(12); - EXPECT_EQ(Count(dba.Vertices(label, property, 12, false)), 0); - EXPECT_EQ(Count(dba.Vertices(label, property, 12, true)), 10); + EXPECT_EQ(Count(dba.Vertices(label, property, PropertyValue(12), false)), 0); + EXPECT_EQ(Count(dba.Vertices(label, property, PropertyValue(12), true)), 10); Commit(); - EXPECT_EQ(Count(dba.Vertices(label, property, 12, false)), 10); - EXPECT_EQ(Count(dba.Vertices(label, property, 12, true)), 10); + EXPECT_EQ(Count(dba.Vertices(label, property, PropertyValue(12), false)), 10); + EXPECT_EQ(Count(dba.Vertices(label, property, PropertyValue(12), true)), 10); } TEST_F(GraphDbAccessorIndex, LabelPropertyValueSorting) { dba.BuildIndex(label, property); Commit(); - std::vector<PropertyValue> expected_property_value(50, 0); + std::vector<PropertyValue> expected_property_value(50, PropertyValue(0)); // strings for (int i = 0; i < 10; ++i) { auto vertex_accessor = dba.InsertVertex(); vertex_accessor.add_label(label); - vertex_accessor.PropsSet(property, - static_cast<std::string>(std::to_string(i))); + vertex_accessor.PropsSet(property, PropertyValue(std::to_string(i))); expected_property_value[i] = vertex_accessor.PropsAt(property); } // bools - insert in reverse to check for comparison between values. for (int i = 9; i >= 0; --i) { auto vertex_accessor = dba.InsertVertex(); vertex_accessor.add_label(label); - vertex_accessor.PropsSet(property, static_cast<bool>(i / 5)); + vertex_accessor.PropsSet(property, PropertyValue(static_cast<bool>(i / 5))); expected_property_value[10 + i] = vertex_accessor.PropsAt(property); } @@ -268,14 +273,15 @@ TEST_F(GraphDbAccessorIndex, LabelPropertyValueSorting) { for (int i = 0; i < 10; ++i) { auto vertex_accessor = dba.InsertVertex(); vertex_accessor.add_label(label); - vertex_accessor.PropsSet(property, i); + vertex_accessor.PropsSet(property, PropertyValue(i)); expected_property_value[20 + 2 * i] = vertex_accessor.PropsAt(property); } // doubles for (int i = 0; i < 10; ++i) { auto vertex_accessor = dba.InsertVertex(); vertex_accessor.add_label(label); - vertex_accessor.PropsSet(property, static_cast<double>(i + 0.5)); + vertex_accessor.PropsSet(property, + PropertyValue(static_cast<double>(i + 0.5))); expected_property_value[20 + 2 * i + 1] = vertex_accessor.PropsAt(property); } @@ -286,25 +292,24 @@ TEST_F(GraphDbAccessorIndex, LabelPropertyValueSorting) { vertex_accessor.add_label(label); std::vector<PropertyValue> value; value.push_back(PropertyValue(i)); - vertex_accessor.PropsSet(property, value); + vertex_accessor.PropsSet(property, PropertyValue(value)); expected_property_value[40 + i] = vertex_accessor.PropsAt(property); } // Maps. Declare a vector in the expected order, then shuffle when setting on // vertices. std::vector<std::map<std::string, PropertyValue>> maps{ - {{"b", 12}}, - {{"b", 12}, {"a", 77}}, - {{"a", 77}, {"c", 0}}, - {{"a", 78}, {"b", 12}}}; - expected_property_value.insert(expected_property_value.end(), maps.begin(), - maps.end()); + {{"b", PropertyValue(12)}}, + {{"b", PropertyValue(12)}, {"a", PropertyValue(77)}}, + {{"a", PropertyValue(77)}, {"c", PropertyValue(0)}}, + {{"a", PropertyValue(78)}, {"b", PropertyValue(12)}}}; + for (const auto &map : maps) expected_property_value.emplace_back(map); auto shuffled = maps; std::random_shuffle(shuffled.begin(), shuffled.end()); for (const auto &map : shuffled) { auto vertex_accessor = dba.InsertVertex(); vertex_accessor.add_label(label); - vertex_accessor.PropsSet(property, map); + vertex_accessor.PropsSet(property, PropertyValue(map)); } EXPECT_EQ(Count(dba.Vertices(label, property, false)), 0); @@ -379,14 +384,6 @@ class GraphDbAccessorIndexRange : public GraphDbAccessorIndex { bool current_state = false) { return dba.Vertices(label, property, lower, upper, current_state); } - - auto Inclusive(PropertyValue value) { - return std::make_optional(utils::MakeBoundInclusive(PropertyValue(value))); - } - - auto Exclusive(int value) { - return std::make_optional(utils::MakeBoundExclusive(PropertyValue(value))); - } }; TEST_F(GraphDbAccessorIndexRange, RangeIteration) { @@ -422,7 +419,8 @@ TEST_F(GraphDbAccessorIndexRange, RangeInterationIncompatibleTypes) { EXPECT_DEATH(Vertices(Inclusive(PropertyValue()), nullopt), "not a valid index bound"); std::vector<PropertyValue> incompatible_with_int{ - "string", true, std::vector<PropertyValue>{1}}; + PropertyValue("string"), PropertyValue(true), + PropertyValue(std::vector<PropertyValue>{PropertyValue(1)})}; // using incompatible upper and lower bounds yields no results EXPECT_EQ(Count(Vertices(Inclusive(2), Inclusive("string"))), 0); diff --git a/tests/unit/interpreter.cpp b/tests/unit/interpreter.cpp index 596f790dd..d1da8f035 100644 --- a/tests/unit/interpreter.cpp +++ b/tests/unit/interpreter.cpp @@ -90,7 +90,8 @@ TEST_F(InterpreterTest, AstCache) { // Run query with same ast multiple times with different parameters. TEST_F(InterpreterTest, Parameters) { { - auto stream = Interpret("RETURN $2 + $`a b`", {{"2", 10}, {"a b", 15}}); + auto stream = Interpret("RETURN $2 + $`a b`", {{"2", PropertyValue(10)}, + {"a b", PropertyValue(15)}}); ASSERT_EQ(stream.GetHeader().size(), 1U); EXPECT_EQ(stream.GetHeader()[0], "$2 + $`a b`"); ASSERT_EQ(stream.GetResults().size(), 1U); @@ -99,8 +100,9 @@ TEST_F(InterpreterTest, Parameters) { } { // Not needed parameter. - auto stream = - Interpret("RETURN $2 + $`a b`", {{"2", 10}, {"a b", 15}, {"c", 10}}); + auto stream = Interpret("RETURN $2 + $`a b`", {{"2", PropertyValue(10)}, + {"a b", PropertyValue(15)}, + {"c", PropertyValue(10)}}); ASSERT_EQ(stream.GetHeader().size(), 1U); EXPECT_EQ(stream.GetHeader()[0], "$2 + $`a b`"); ASSERT_EQ(stream.GetResults().size(), 1U); @@ -109,15 +111,19 @@ TEST_F(InterpreterTest, Parameters) { } { // Cached ast, different parameters. - auto stream = Interpret("RETURN $2 + $`a b`", {{"2", "da"}, {"a b", "ne"}}); + auto stream = + Interpret("RETURN $2 + $`a b`", + {{"2", PropertyValue("da")}, {"a b", PropertyValue("ne")}}); ASSERT_EQ(stream.GetResults().size(), 1U); ASSERT_EQ(stream.GetResults()[0].size(), 1U); ASSERT_EQ(stream.GetResults()[0][0].ValueString(), "dane"); } { // Non-primitive literal. - auto stream = - Interpret("RETURN $2", {{"2", std::vector<PropertyValue>{5, 2, 3}}}); + auto stream = Interpret( + "RETURN $2", + {{"2", PropertyValue(std::vector<PropertyValue>{ + PropertyValue(5), PropertyValue(2), PropertyValue(3)})}}); ASSERT_EQ(stream.GetResults().size(), 1U); ASSERT_EQ(stream.GetResults()[0].size(), 1U); auto result = query::test_common::ToIntList(stream.GetResults()[0][0]); @@ -125,7 +131,8 @@ TEST_F(InterpreterTest, Parameters) { } { // Cached ast, unprovided parameter. - ASSERT_THROW(Interpret("RETURN $2 + $`a b`", {{"2", "da"}, {"ab", "ne"}}), + ASSERT_THROW(Interpret("RETURN $2 + $`a b`", {{"2", PropertyValue("da")}, + {"ab", PropertyValue("ne")}}), query::UnprovidedParameterError); } } @@ -149,8 +156,8 @@ TEST_F(InterpreterTest, Bfs) { auto dba = db_.Access(); auto add_node = [&](int level, bool reachable) { auto node = dba.InsertVertex(); - node.PropsSet(dba.Property(kId), id++); - node.PropsSet(dba.Property(kReachable), reachable); + node.PropsSet(dba.Property(kId), PropertyValue(id++)); + node.PropsSet(dba.Property(kReachable), PropertyValue(reachable)); levels[level].push_back(node); return node; }; @@ -158,7 +165,7 @@ TEST_F(InterpreterTest, Bfs) { auto add_edge = [&](VertexAccessor &v1, VertexAccessor &v2, bool reachable) { auto edge = dba.InsertEdge(v1, v2, dba.EdgeType("edge")); - edge.PropsSet(dba.Property(kReachable), reachable); + edge.PropsSet(dba.Property(kReachable), PropertyValue(reachable)); }; // Add source node. diff --git a/tests/unit/property_value_store.cpp b/tests/unit/property_value_store.cpp index 035738690..0456602ea 100644 --- a/tests/unit/property_value_store.cpp +++ b/tests/unit/property_value_store.cpp @@ -30,8 +30,9 @@ class PropertyValueStoreTest : public ::testing::Test { utils::EnsureDir(fs::path(FLAGS_durability_directory)); } - void Set(int key, Location location, PropertyValue value) { - props_.set(storage::Property(key, location), value); + template <class TValue> + void Set(int key, Location location, const TValue &value) { + props_.set(storage::Property(key, location), PropertyValue(value)); } PropertyValue At(int key, Location location) { @@ -231,8 +232,10 @@ TEST_F(PropertyValueStoreTest, Size) { } TEST_F(PropertyValueStoreTest, InsertRetrieveListMemory) { - Set(0, Location::Memory, std::vector<PropertyValue>{1, true, 2.5, "something", - PropertyValue()}); + Set(0, Location::Memory, + std::vector<PropertyValue>{PropertyValue(1), PropertyValue(true), + PropertyValue(2.5), PropertyValue("something"), + PropertyValue()}); auto p = At(0, Location::Memory); EXPECT_EQ(p.type(), PropertyValue::Type::List); @@ -251,7 +254,8 @@ TEST_F(PropertyValueStoreTest, InsertRetrieveListMemory) { TEST_F(PropertyValueStoreTest, InsertRetrieveListDisk) { Set(0, Location::Disk, - std::vector<PropertyValue>{1, true, 2.5, "something", + std::vector<PropertyValue>{PropertyValue(1), PropertyValue(true), + PropertyValue(2.5), PropertyValue("something"), PropertyValue()}); auto p = At(0, Location::Disk); @@ -270,8 +274,10 @@ TEST_F(PropertyValueStoreTest, InsertRetrieveListDisk) { } TEST_F(PropertyValueStoreTest, InsertRetrieveMap) { - Set(0, Location::Memory, std::map<std::string, PropertyValue>{ - {"a", 1}, {"b", true}, {"c", "something"}}); + Set(0, Location::Memory, + std::map<std::string, PropertyValue>{{"a", PropertyValue(1)}, + {"b", PropertyValue(true)}, + {"c", PropertyValue("something")}}); auto p = At(0, Location::Memory); EXPECT_EQ(p.type(), PropertyValue::Type::Map); @@ -289,8 +295,10 @@ TEST_F(PropertyValueStoreTest, InsertRetrieveMap) { } TEST_F(PropertyValueStoreTest, InsertRetrieveMapDisk) { - Set(0, Location::Disk, std::map<std::string, PropertyValue>{ - {"a", 1}, {"b", true}, {"c", "something"}}); + Set(0, Location::Disk, + std::map<std::string, PropertyValue>{{"a", PropertyValue(1)}, + {"b", PropertyValue(true)}, + {"c", PropertyValue("something")}}); auto p = At(0, Location::Disk); EXPECT_EQ(p.type(), PropertyValue::Type::Map); @@ -341,10 +349,10 @@ TEST_F(PropertyValueStoreTest, CopyConstructor) { PropertyValueStore props; for (int i = 1; i <= 3; ++i) props.set(storage::Property(i, Location::Memory), - "mem_" + std::to_string(i)); + PropertyValue("mem_" + std::to_string(i))); for (int i = 4; i <= 5; ++i) props.set(storage::Property(i, Location::Disk), - "disk_" + std::to_string(i)); + PropertyValue("disk_" + std::to_string(i))); PropertyValueStore new_props = props; for (int i = 1; i <= 3; ++i) @@ -355,19 +363,23 @@ TEST_F(PropertyValueStoreTest, CopyConstructor) { EXPECT_EQ(new_props.at(storage::Property(i, Location::Disk)).ValueString(), "disk_" + std::to_string(i)); - props.set(storage::Property(1, Location::Memory), "mem_1_update"); + props.set(storage::Property(1, Location::Memory), + PropertyValue("mem_1_update")); EXPECT_EQ(new_props.at(storage::Property(1, Location::Memory)).ValueString(), "mem_1"); - new_props.set(storage::Property(2, Location::Memory), "mem_2_update"); + new_props.set(storage::Property(2, Location::Memory), + PropertyValue("mem_2_update")); EXPECT_EQ(props.at(storage::Property(2, Location::Memory)).ValueString(), "mem_2"); - props.set(storage::Property(4, Location::Disk), "disk_4_update"); + props.set(storage::Property(4, Location::Disk), + PropertyValue("disk_4_update")); EXPECT_EQ(new_props.at(storage::Property(4, Location::Disk)).ValueString(), "disk_4"); - new_props.set(storage::Property(5, Location::Disk), "disk_5_update"); + new_props.set(storage::Property(5, Location::Disk), + PropertyValue("disk_5_update")); EXPECT_EQ(props.at(storage::Property(5, Location::Disk)).ValueString(), "disk_5"); } diff --git a/tests/unit/query_cost_estimator.cpp b/tests/unit/query_cost_estimator.cpp index 2f85525c9..cbad968d4 100644 --- a/tests/unit/query_cost_estimator.cpp +++ b/tests/unit/query_cost_estimator.cpp @@ -55,7 +55,7 @@ class QueryCostEstimator : public ::testing::Test { for (int i = 0; i < vertex_count; i++) { auto vertex = dba.InsertVertex(); if (i < labeled_count) vertex.add_label(label); - if (i < property_count) vertex.PropsSet(property, i); + if (i < property_count) vertex.PropsSet(property, PropertyValue(i)); } dba.AdvanceCommand(); @@ -77,9 +77,10 @@ class QueryCostEstimator : public ::testing::Test { return storage_.Create<PrimitiveLiteral>(value); } - Expression *Parameter(const PropertyValue &value) { + template <typename TValue> + Expression *Parameter(TValue value) { int token_position = parameters_.size(); - parameters_.Add(token_position, value); + parameters_.Add(token_position, PropertyValue(value)); return storage_.Create<ParameterLookup>(token_position); } diff --git a/tests/unit/query_expression_evaluator.cpp b/tests/unit/query_expression_evaluator.cpp index 567210db2..4df12fd12 100644 --- a/tests/unit/query_expression_evaluator.cpp +++ b/tests/unit/query_expression_evaluator.cpp @@ -418,8 +418,8 @@ TEST_F(ExpressionEvaluatorTest, VertexAndEdgeIndexing) { auto prop = dba.Property("prop"); auto v1 = dba.InsertVertex(); auto e11 = dba.InsertEdge(v1, v1, edge_type); - v1.PropsSet(prop, 42); - e11.PropsSet(prop, 43); + v1.PropsSet(prop, PropertyValue(42)); + e11.PropsSet(prop, PropertyValue(43)); auto *vertex_id = CreateIdentifierWithValue("v1", TypedValue(v1)); auto *edge_id = CreateIdentifierWithValue("e11", TypedValue(e11)); @@ -690,7 +690,7 @@ TEST_F(ExpressionEvaluatorTest, ListLiteral) { } TEST_F(ExpressionEvaluatorTest, ParameterLookup) { - ctx.parameters.Add(0, 42); + ctx.parameters.Add(0, PropertyValue(42)); auto *param_lookup = storage.Create<ParameterLookup>(0); auto value = Eval(param_lookup); ASSERT_TRUE(value.IsInt()); @@ -914,7 +914,7 @@ class ExpressionEvaluatorPropertyLookup : public ExpressionEvaluatorTest { TEST_F(ExpressionEvaluatorPropertyLookup, Vertex) { auto v1 = dba.InsertVertex(); - v1.PropsSet(prop_age.second, 10); + v1.PropsSet(prop_age.second, PropertyValue(10)); frame[symbol] = TypedValue(v1); EXPECT_EQ(Value(prop_age).ValueInt(), 10); EXPECT_TRUE(Value(prop_height).IsNull()); @@ -924,7 +924,7 @@ TEST_F(ExpressionEvaluatorPropertyLookup, Edge) { auto v1 = dba.InsertVertex(); auto v2 = dba.InsertVertex(); auto e12 = dba.InsertEdge(v1, v2, dba.EdgeType("edge_type")); - e12.PropsSet(prop_age.second, 10); + e12.PropsSet(prop_age.second, PropertyValue(10)); frame[symbol] = TypedValue(e12); EXPECT_EQ(Value(prop_age).ValueInt(), 10); EXPECT_TRUE(Value(prop_height).IsNull()); @@ -1020,12 +1020,12 @@ TEST_F(FunctionTest, Properties) { ASSERT_THROW(EvaluateFunction("PROPERTIES"), QueryRuntimeException); ASSERT_TRUE(EvaluateFunction("PROPERTIES", TypedValue()).IsNull()); auto v1 = dba.InsertVertex(); - v1.PropsSet(dba.Property("height"), 5); - v1.PropsSet(dba.Property("age"), 10); + v1.PropsSet(dba.Property("height"), PropertyValue(5)); + v1.PropsSet(dba.Property("age"), PropertyValue(10)); auto v2 = dba.InsertVertex(); auto e = dba.InsertEdge(v1, v2, dba.EdgeType("type1")); - e.PropsSet(dba.Property("height"), 3); - e.PropsSet(dba.Property("age"), 15); + e.PropsSet(dba.Property("height"), PropertyValue(3)); + e.PropsSet(dba.Property("age"), PropertyValue(15)); auto prop_values_to_int = [](TypedValue t) { std::unordered_map<std::string, int> properties; @@ -1259,12 +1259,12 @@ TEST_F(FunctionTest, Keys) { ASSERT_THROW(EvaluateFunction("KEYS"), QueryRuntimeException); ASSERT_TRUE(EvaluateFunction("KEYS", TypedValue()).IsNull()); auto v1 = dba.InsertVertex(); - v1.PropsSet(dba.Property("height"), 5); - v1.PropsSet(dba.Property("age"), 10); + v1.PropsSet(dba.Property("height"), PropertyValue(5)); + v1.PropsSet(dba.Property("age"), PropertyValue(10)); auto v2 = dba.InsertVertex(); auto e = dba.InsertEdge(v1, v2, dba.EdgeType("type1")); - e.PropsSet(dba.Property("width"), 3); - e.PropsSet(dba.Property("age"), 15); + e.PropsSet(dba.Property("width"), PropertyValue(3)); + e.PropsSet(dba.Property("age"), PropertyValue(15)); auto prop_keys_to_string = [](TypedValue t) { std::vector<std::string> keys; diff --git a/tests/unit/query_plan_accumulate_aggregate.cpp b/tests/unit/query_plan_accumulate_aggregate.cpp index 17e040a5a..6a16ebd11 100644 --- a/tests/unit/query_plan_accumulate_aggregate.cpp +++ b/tests/unit/query_plan_accumulate_aggregate.cpp @@ -32,9 +32,9 @@ TEST(QueryPlan, Accumulate) { auto prop = dba.Property("x"); auto v1 = dba.InsertVertex(); - v1.PropsSet(prop, 0); + v1.PropsSet(prop, PropertyValue(0)); auto v2 = dba.InsertVertex(); - v2.PropsSet(prop, 0); + v2.PropsSet(prop, PropertyValue(0)); dba.InsertEdge(v1, v2, dba.EdgeType("T")); dba.AdvanceCommand(); @@ -155,9 +155,9 @@ class QueryPlanAggregateOps : public ::testing::Test { // setup is several nodes most of which have an int property set // we will take the sum, avg, min, max and count // we won't group by anything - dba.InsertVertex().PropsSet(prop, 5); - dba.InsertVertex().PropsSet(prop, 7); - dba.InsertVertex().PropsSet(prop, 12); + dba.InsertVertex().PropsSet(prop, PropertyValue(5)); + dba.InsertVertex().PropsSet(prop, PropertyValue(7)); + dba.InsertVertex().PropsSet(prop, PropertyValue(12)); // a missing property (null) gets ignored by all aggregations except // COUNT(*) dba.InsertVertex(); @@ -298,14 +298,17 @@ TEST(QueryPlan, AggregateGroupByValues) { group_by_vals.emplace_back("1"); group_by_vals.emplace_back(true); group_by_vals.emplace_back(false); - group_by_vals.emplace_back(std::vector<PropertyValue>{1}); - group_by_vals.emplace_back(std::vector<PropertyValue>{1, 2}); - group_by_vals.emplace_back(std::vector<PropertyValue>{2, 1}); + group_by_vals.emplace_back(std::vector<PropertyValue>{PropertyValue(1)}); + group_by_vals.emplace_back( + std::vector<PropertyValue>{PropertyValue(1), PropertyValue(2)}); + group_by_vals.emplace_back( + std::vector<PropertyValue>{PropertyValue(2), PropertyValue(1)}); group_by_vals.emplace_back(PropertyValue()); // should NOT result in another group because 7.0 == 7 group_by_vals.emplace_back(7.0); // should NOT result in another group - group_by_vals.emplace_back(std::vector<PropertyValue>{1, 2.0}); + group_by_vals.emplace_back( + std::vector<PropertyValue>{PropertyValue(1), PropertyValue(2.0)}); // generate a lot of vertices and set props on them auto prop = dba.Property("prop"); @@ -354,9 +357,9 @@ TEST(QueryPlan, AggregateMultipleGroupBy) { auto prop3 = dba.Property("prop3"); for (int i = 0; i < 2 * 3 * 5; ++i) { auto v = dba.InsertVertex(); - v.PropsSet(prop1, (bool)(i % 2)); - v.PropsSet(prop2, i % 3); - v.PropsSet(prop3, "value" + std::to_string(i % 5)); + v.PropsSet(prop1, PropertyValue(static_cast<bool>(i % 2))); + v.PropsSet(prop2, PropertyValue(i % 3)); + v.PropsSet(prop3, PropertyValue("value" + std::to_string(i % 5))); } dba.AdvanceCommand(); @@ -437,7 +440,8 @@ TEST(QueryPlan, AggregateCountEdgeCases) { EXPECT_EQ(0, count()); // one vertex, property set - for (VertexAccessor va : dba.Vertices(false)) va.PropsSet(prop, 42); + for (VertexAccessor va : dba.Vertices(false)) + va.PropsSet(prop, PropertyValue(42)); dba.AdvanceCommand(); EXPECT_EQ(1, count()); @@ -447,7 +451,8 @@ TEST(QueryPlan, AggregateCountEdgeCases) { EXPECT_EQ(1, count()); // two vertices, both with property set - for (VertexAccessor va : dba.Vertices(false)) va.PropsSet(prop, 42); + for (VertexAccessor va : dba.Vertices(false)) + va.PropsSet(prop, PropertyValue(42)); dba.AdvanceCommand(); EXPECT_EQ(2, count()); } @@ -461,9 +466,9 @@ TEST(QueryPlan, AggregateFirstValueTypes) { auto v1 = dba.InsertVertex(); auto prop_string = dba.Property("string"); - v1.PropsSet(prop_string, "johhny"); + v1.PropsSet(prop_string, PropertyValue("johhny")); auto prop_int = dba.Property("int"); - v1.PropsSet(prop_int, 12); + v1.PropsSet(prop_int, PropertyValue(12)); dba.AdvanceCommand(); AstStorage storage; @@ -516,11 +521,11 @@ TEST(QueryPlan, AggregateTypes) { auto dba = db.Access(); auto p1 = dba.Property("p1"); // has only string props - dba.InsertVertex().PropsSet(p1, "string"); - dba.InsertVertex().PropsSet(p1, "str2"); + dba.InsertVertex().PropsSet(p1, PropertyValue("string")); + dba.InsertVertex().PropsSet(p1, PropertyValue("str2")); auto p2 = dba.Property("p2"); // combines int and bool - dba.InsertVertex().PropsSet(p2, 42); - dba.InsertVertex().PropsSet(p2, true); + dba.InsertVertex().PropsSet(p2, PropertyValue(42)); + dba.InsertVertex().PropsSet(p2, PropertyValue(true)); dba.AdvanceCommand(); AstStorage storage; @@ -574,8 +579,10 @@ TEST(QueryPlan, Unwind) { // UNWIND [ [1, true, "x"], [], ["bla"] ] AS x UNWIND x as y RETURN x, y auto input_expr = storage.Create<PrimitiveLiteral>(std::vector<PropertyValue>{ - std::vector<PropertyValue>{1, true, "x"}, std::vector<PropertyValue>{}, - std::vector<PropertyValue>{"bla"}}); + PropertyValue(std::vector<PropertyValue>{ + PropertyValue(1), PropertyValue(true), PropertyValue("x")}), + PropertyValue(std::vector<PropertyValue>{}), + PropertyValue(std::vector<PropertyValue>{PropertyValue("bla")})}); auto x = symbol_table.CreateSymbol("x", true); auto unwind_0 = std::make_shared<plan::Unwind>(nullptr, input_expr, x); diff --git a/tests/unit/query_plan_bag_semantics.cpp b/tests/unit/query_plan_bag_semantics.cpp index 9a3b85ef1..83eea0531 100644 --- a/tests/unit/query_plan_bag_semantics.cpp +++ b/tests/unit/query_plan_bag_semantics.cpp @@ -117,12 +117,23 @@ TEST(QueryPlan, OrderBy) { // each test defines the ordering a vector of values in the desired order auto Null = PropertyValue(); std::vector<std::pair<Ordering, std::vector<PropertyValue>>> orderable{ - {Ordering::ASC, {0, 0, 0.5, 1, 2, 12.6, 42, Null, Null}}, - {Ordering::ASC, {false, false, true, true, Null, Null}}, - {Ordering::ASC, {"A", "B", "a", "a", "aa", "ab", "aba", Null, Null}}, - {Ordering::DESC, {Null, Null, 33, 33, 32.5, 32, 2.2, 2.1, 0}}, - {Ordering::DESC, {Null, true, false}}, - {Ordering::DESC, {Null, "zorro", "borro"}}}; + {Ordering::ASC, + {PropertyValue(0), PropertyValue(0), PropertyValue(0.5), + PropertyValue(1), PropertyValue(2), PropertyValue(12.6), + PropertyValue(42), Null, Null}}, + {Ordering::ASC, + {PropertyValue(false), PropertyValue(false), PropertyValue(true), + PropertyValue(true), Null, Null}}, + {Ordering::ASC, + {PropertyValue("A"), PropertyValue("B"), PropertyValue("a"), + PropertyValue("a"), PropertyValue("aa"), PropertyValue("ab"), + PropertyValue("aba"), Null, Null}}, + {Ordering::DESC, + {Null, Null, PropertyValue(33), PropertyValue(33), PropertyValue(32.5), + PropertyValue(32), PropertyValue(2.2), PropertyValue(2.1), + PropertyValue(0)}}, + {Ordering::DESC, {Null, PropertyValue(true), PropertyValue(false)}}, + {Ordering::DESC, {Null, PropertyValue("zorro"), PropertyValue("borro")}}}; for (const auto &order_value_pair : orderable) { std::vector<TypedValue> values; @@ -187,8 +198,8 @@ TEST(QueryPlan, OrderByMultiple) { std::random_shuffle(prop_values.begin(), prop_values.end()); for (const auto &pair : prop_values) { auto v = dba.InsertVertex(); - v.PropsSet(p1, pair.first); - v.PropsSet(p2, pair.second); + v.PropsSet(p1, PropertyValue(pair.first)); + v.PropsSet(p2, PropertyValue(pair.second)); } dba.AdvanceCommand(); @@ -233,14 +244,18 @@ TEST(QueryPlan, OrderByExceptions) { // a vector of pairs of typed values that should result // in an exception when trying to order on them std::vector<std::pair<PropertyValue, PropertyValue>> exception_pairs{ - {42, true}, - {42, "bla"}, - {42, std::vector<PropertyValue>{42}}, - {true, "bla"}, - {true, std::vector<PropertyValue>{true}}, - {"bla", std::vector<PropertyValue>{"bla"}}, + {PropertyValue(42), PropertyValue(true)}, + {PropertyValue(42), PropertyValue("bla")}, + {PropertyValue(42), + PropertyValue(std::vector<PropertyValue>{PropertyValue(42)})}, + {PropertyValue(true), PropertyValue("bla")}, + {PropertyValue(true), + PropertyValue(std::vector<PropertyValue>{PropertyValue(true)})}, + {PropertyValue("bla"), + PropertyValue(std::vector<PropertyValue>{PropertyValue("bla")})}, // illegal comparisons of same-type values - {std::vector<PropertyValue>{42}, std::vector<PropertyValue>{42}}}; + {PropertyValue(std::vector<PropertyValue>{PropertyValue(42)}), + PropertyValue(std::vector<PropertyValue>{PropertyValue(42)})}}; for (const auto &pair : exception_pairs) { // empty database diff --git a/tests/unit/query_plan_create_set_remove_delete.cpp b/tests/unit/query_plan_create_set_remove_delete.cpp index 08f16144d..7e61f6a1d 100644 --- a/tests/unit/query_plan_create_set_remove_delete.cpp +++ b/tests/unit/query_plan_create_set_remove_delete.cpp @@ -374,7 +374,7 @@ TEST(QueryPlan, DeleteReturn) { auto prop = PROPERTY_PAIR("property"); for (int i = 0; i < 4; ++i) { auto va = dba.InsertVertex(); - va.PropsSet(prop.second, 42); + va.PropsSet(prop.second, PropertyValue(42)); } dba.AdvanceCommand(); @@ -508,9 +508,9 @@ TEST(QueryPlan, SetProperties) { auto v1 = dba.InsertVertex(); auto v2 = dba.InsertVertex(); auto e = dba.InsertEdge(v1, v2, dba.EdgeType("R")); - v1.PropsSet(prop_a, 0); - e.PropsSet(prop_b, 1); - v2.PropsSet(prop_c, 2); + v1.PropsSet(prop_a, PropertyValue(0)); + e.PropsSet(prop_b, PropertyValue(1)); + v2.PropsSet(prop_c, PropertyValue(2)); dba.AdvanceCommand(); AstStorage storage; @@ -607,14 +607,14 @@ TEST(QueryPlan, RemoveProperty) { auto v3 = dba.InsertVertex(); auto v4 = dba.InsertVertex(); auto edge_type = dba.EdgeType("edge_type"); - dba.InsertEdge(v1, v3, edge_type).PropsSet(prop1, 42); + dba.InsertEdge(v1, v3, edge_type).PropsSet(prop1, PropertyValue(42)); dba.InsertEdge(v2, v4, edge_type); - v2.PropsSet(prop1, 42); - v3.PropsSet(prop1, 42); - v4.PropsSet(prop1, 42); + v2.PropsSet(prop1, PropertyValue(42)); + v3.PropsSet(prop1, PropertyValue(42)); + v4.PropsSet(prop1, PropertyValue(42)); auto prop2 = dba.Property("prop2"); - v1.PropsSet(prop2, 0); - v2.PropsSet(prop2, 0); + v1.PropsSet(prop2, PropertyValue(0)); + v2.PropsSet(prop2, PropertyValue(0)); dba.AdvanceCommand(); AstStorage storage; @@ -685,7 +685,7 @@ TEST(QueryPlan, NodeFilterSet) { // Create a graph such that (v1 {prop: 42}) is connected to v2 and v3. auto v1 = dba.InsertVertex(); auto prop = PROPERTY_PAIR("property"); - v1.PropsSet(prop.second, 42); + v1.PropsSet(prop.second, PropertyValue(42)); auto v2 = dba.InsertVertex(); auto v3 = dba.InsertVertex(); auto edge_type = dba.EdgeType("Edge"); @@ -728,7 +728,7 @@ TEST(QueryPlan, FilterRemove) { // Create a graph such that (v1 {prop: 42}) is connected to v2 and v3. auto v1 = dba.InsertVertex(); auto prop = PROPERTY_PAIR("property"); - v1.PropsSet(prop.second, 42); + v1.PropsSet(prop.second, PropertyValue(42)); auto v2 = dba.InsertVertex(); auto v3 = dba.InsertVertex(); auto edge_type = dba.EdgeType("Edge"); @@ -993,7 +993,7 @@ TEST(QueryPlan, DeleteSetPropertiesFromVertex) { // Add a single vertex. { auto v = dba.InsertVertex(); - v.PropsSet(dba.Property("property"), 1); + v.PropsSet(dba.Property("property"), PropertyValue(1)); } dba.AdvanceCommand(); EXPECT_EQ(1, CountIterable(dba.Vertices(false))); diff --git a/tests/unit/query_plan_match_filter_return.cpp b/tests/unit/query_plan_match_filter_return.cpp index 4338b1d9b..33102301f 100644 --- a/tests/unit/query_plan_match_filter_return.cpp +++ b/tests/unit/query_plan_match_filter_return.cpp @@ -161,10 +161,10 @@ TEST(QueryPlan, NodeFilterLabelsAndProperties) { v2.add_label(label); v3.add_label(label); // v1 and v4 will have the right properties - v1.PropsSet(property.second, 42); - v2.PropsSet(property.second, 1); - v4.PropsSet(property.second, 42); - v5.PropsSet(property.second, 1); + v1.PropsSet(property.second, PropertyValue(42)); + v2.PropsSet(property.second, PropertyValue(1)); + v4.PropsSet(property.second, PropertyValue(42)); + v5.PropsSet(property.second, PropertyValue(1)); dba.AdvanceCommand(); AstStorage storage; @@ -504,8 +504,9 @@ class QueryPlanExpandVariable : public testing::Test { auto &v_from = layer[v_from_ind]; auto edge = dba_.InsertEdge(v_from, v_to, edge_type); edge.PropsSet(dba_.Property("p"), - fmt::format("V{}{}->V{}{}", from_layer_ind, v_from_ind, - from_layer_ind + 1, v_to_ind)); + PropertyValue(fmt::format( + "V{}{}->V{}{}", from_layer_ind, v_from_ind, + from_layer_ind + 1, v_to_ind))); } } layer = new_layer; @@ -830,12 +831,12 @@ class QueryPlanExpandWeightedShortestPath : public testing::Test { void SetUp() { for (int i = 0; i < 5; i++) { v.push_back(dba.InsertVertex()); - v.back().PropsSet(prop.second, i); + v.back().PropsSet(prop.second, PropertyValue(i)); } auto add_edge = [&](int from, int to, double weight) { EdgeAccessor edge = dba.InsertEdge(v[from], v[to], edge_type); - edge.PropsSet(prop.second, weight); + edge.PropsSet(prop.second, PropertyValue(weight)); e.emplace(std::make_pair(from, to), edge); }; @@ -1083,9 +1084,9 @@ TEST_F(QueryPlanExpandWeightedShortestPath, UpperBound) { } { auto new_vertex = dba.InsertVertex(); - new_vertex.PropsSet(prop.second, 5); + new_vertex.PropsSet(prop.second, PropertyValue(5)); auto edge = dba.InsertEdge(v[4], new_vertex, edge_type); - edge.PropsSet(prop.second, 2); + edge.PropsSet(prop.second, PropertyValue(2)); dba.AdvanceCommand(); auto results = ExpandWShortest(EdgeAtom::Direction::BOTH, 3, LITERAL(true)); @@ -1106,9 +1107,9 @@ TEST_F(QueryPlanExpandWeightedShortestPath, UpperBound) { TEST_F(QueryPlanExpandWeightedShortestPath, NonNumericWeight) { auto new_vertex = dba.InsertVertex(); - new_vertex.PropsSet(prop.second, 5); + new_vertex.PropsSet(prop.second, PropertyValue(5)); auto edge = dba.InsertEdge(v[4], new_vertex, edge_type); - edge.PropsSet(prop.second, "not a number"); + edge.PropsSet(prop.second, PropertyValue("not a number")); dba.AdvanceCommand(); EXPECT_THROW(ExpandWShortest(EdgeAtom::Direction::BOTH, 1000, LITERAL(true)), QueryRuntimeException); @@ -1116,9 +1117,9 @@ TEST_F(QueryPlanExpandWeightedShortestPath, NonNumericWeight) { TEST_F(QueryPlanExpandWeightedShortestPath, NegativeWeight) { auto new_vertex = dba.InsertVertex(); - new_vertex.PropsSet(prop.second, 5); + new_vertex.PropsSet(prop.second, PropertyValue(5)); auto edge = dba.InsertEdge(v[4], new_vertex, edge_type); - edge.PropsSet(prop.second, -10); // negative weight + edge.PropsSet(prop.second, PropertyValue(-10)); // negative weight dba.AdvanceCommand(); EXPECT_THROW(ExpandWShortest(EdgeAtom::Direction::BOTH, 1000, LITERAL(true)), QueryRuntimeException); @@ -1140,12 +1141,12 @@ TEST(QueryPlan, ExpandOptional) { auto prop = dba.Property("p"); auto edge_type = dba.EdgeType("T"); auto v1 = dba.InsertVertex(); - v1.PropsSet(prop, 1); + v1.PropsSet(prop, PropertyValue(1)); auto v2 = dba.InsertVertex(); - v2.PropsSet(prop, 2); + v2.PropsSet(prop, PropertyValue(2)); dba.InsertEdge(v1, v2, edge_type); auto v3 = dba.InsertVertex(); - v3.PropsSet(prop, 2); + v3.PropsSet(prop, PropertyValue(2)); dba.InsertEdge(v1, v3, edge_type); dba.AdvanceCommand(); @@ -1363,10 +1364,10 @@ TEST(QueryPlan, EdgeFilter) { dba.InsertEdge(vertices[0], vertices[i + 1], edge_types[i % 2])); switch (i % 3) { case 0: - edges.back().PropsSet(prop.second, 42); + edges.back().PropsSet(prop.second, PropertyValue(42)); break; case 1: - edges.back().PropsSet(prop.second, 100); + edges.back().PropsSet(prop.second, PropertyValue(100)); break; default: break; @@ -1406,7 +1407,7 @@ TEST(QueryPlan, EdgeFilter) { EXPECT_EQ(1, test_filter()); // test that edge filtering always filters on old state - for (auto &edge : edges) edge.PropsSet(prop.second, 42); + for (auto &edge : edges) edge.PropsSet(prop.second, PropertyValue(42)); EXPECT_EQ(1, test_filter()); dba.AdvanceCommand(); EXPECT_EQ(3, test_filter()); @@ -1452,7 +1453,7 @@ TEST(QueryPlan, Filter) { // add a 6 nodes with property 'prop', 2 have true as value auto property = PROPERTY_PAIR("property"); for (int i = 0; i < 6; ++i) - dba.InsertVertex().PropsSet(property.second, i % 3 == 0); + dba.InsertVertex().PropsSet(property.second, PropertyValue(i % 3 == 0)); dba.InsertVertex(); // prop not set, gives NULL dba.AdvanceCommand(); @@ -1593,12 +1594,21 @@ TEST(QueryPlan, ScanAllByLabelProperty) { auto label = db.Access().Label("label"); auto prop = db.Access().Property("prop"); // vertex property values that will be stored into the DB - // clang-format off std::vector<PropertyValue> values{ - true, false, "a", "b", "c", 0, 1, 2, 0.5, 1.5, 2.5, - std::vector<PropertyValue>{0}, std::vector<PropertyValue>{1}, - std::vector<PropertyValue>{2}}; - // clang-format on + PropertyValue(true), + PropertyValue(false), + PropertyValue("a"), + PropertyValue("b"), + PropertyValue("c"), + PropertyValue(0), + PropertyValue(1), + PropertyValue(2), + PropertyValue(0.5), + PropertyValue(1.5), + PropertyValue(2.5), + PropertyValue(std::vector<PropertyValue>{PropertyValue(0)}), + PropertyValue(std::vector<PropertyValue>{PropertyValue(1)}), + PropertyValue(std::vector<PropertyValue>{PropertyValue(2)})}; { auto dba = db.Access(); for (const auto &value : values) { @@ -1675,10 +1685,10 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualityNoError) { auto dba = db.Access(); auto number_vertex = dba.InsertVertex(); number_vertex.add_label(label); - number_vertex.PropsSet(prop, 42); + number_vertex.PropsSet(prop, PropertyValue(42)); auto string_vertex = dba.InsertVertex(); string_vertex.add_label(label); - string_vertex.PropsSet(prop, "string"); + string_vertex.PropsSet(prop, PropertyValue("string")); dba.Commit(); db.Access().BuildIndex(label, prop); } @@ -1713,7 +1723,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyValueError) { for (int i = 0; i < 2; ++i) { auto vertex = dba.InsertVertex(); vertex.add_label(label); - vertex.PropsSet(prop, i); + vertex.PropsSet(prop, PropertyValue(i)); } dba.Commit(); } @@ -1741,7 +1751,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeError) { for (int i = 0; i < 2; ++i) { auto vertex = dba.InsertVertex(); vertex.add_label(label); - vertex.PropsSet(prop, i); + vertex.PropsSet(prop, PropertyValue(i)); } dba.Commit(); } @@ -1794,7 +1804,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyEqualNull) { vertex.add_label(label); auto vertex_with_prop = dba.InsertVertex(); vertex_with_prop.add_label(label); - vertex_with_prop.PropsSet(prop, 42); + vertex_with_prop.PropsSet(prop, PropertyValue(42)); dba.Commit(); db.Access().BuildIndex(label, prop); } @@ -1828,7 +1838,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyRangeNull) { vertex.add_label(label); auto vertex_with_prop = dba.InsertVertex(); vertex_with_prop.add_label(label); - vertex_with_prop.PropsSet(prop, 42); + vertex_with_prop.PropsSet(prop, PropertyValue(42)); dba.Commit(); db.Access().BuildIndex(label, prop); } @@ -1858,7 +1868,7 @@ TEST(QueryPlan, ScanAllByLabelPropertyNoValueInIndexContinuation) { auto dba = db.Access(); auto v = dba.InsertVertex(); v.add_label(label); - v.PropsSet(prop, 2); + v.PropsSet(prop, PropertyValue(2)); dba.Commit(); db.Access().BuildIndex(label, prop); } @@ -1896,7 +1906,8 @@ TEST(QueryPlan, ScanAllEqualsScanAllByLabelProperty) { auto dba = db.Access(); auto v = dba.InsertVertex(); v.add_label(label); - v.PropsSet(prop, i < vertex_prop_count ? prop_value1 : prop_value2); + v.PropsSet( + prop, PropertyValue(i < vertex_prop_count ? prop_value1 : prop_value2)); dba.Commit(); } diff --git a/tests/unit/query_pretty_print.cpp b/tests/unit/query_pretty_print.cpp index 74aba00ca..35e54cb76 100644 --- a/tests/unit/query_pretty_print.cpp +++ b/tests/unit/query_pretty_print.cpp @@ -41,13 +41,14 @@ TEST_F(ExpressionPrettyPrinterTest, Literals) { EXPECT_EQ(ToString(LITERAL(false)), "false"); // [1 null "hello"] - EXPECT_EQ(ToString(LITERAL( - (std::vector<PropertyValue>{1, PropertyValue(), "hello"}))), - "[1, null, \"hello\"]"); + std::vector<PropertyValue> values{PropertyValue(1), PropertyValue(), + PropertyValue("hello")}; + EXPECT_EQ(ToString(LITERAL(PropertyValue(values))), "[1, null, \"hello\"]"); // {hello: 1, there: 2} - EXPECT_EQ(ToString(LITERAL((std::map<std::string, PropertyValue>{ - {"hello", 1}, {"there", 2}}))), + std::map<std::string, PropertyValue> map{{"hello", PropertyValue(1)}, + {"there", PropertyValue(2)}}; + EXPECT_EQ(ToString(LITERAL(PropertyValue(map))), "{\"hello\": 1, \"there\": 2}"); } diff --git a/tests/unit/query_variable_start_planner.cpp b/tests/unit/query_variable_start_planner.cpp index 8b9c35ab6..050a32e5e 100644 --- a/tests/unit/query_variable_start_planner.cpp +++ b/tests/unit/query_variable_start_planner.cpp @@ -244,11 +244,11 @@ TEST(TestVariableStartPlanner, MatchVariableExpandReferenceNode) { auto id = dba.Property("id"); // Graph (v1 {id:1}) -[:r1]-> (v2 {id: 2}) -[:r2]-> (v3 {id: 3}) auto v1 = dba.InsertVertex(); - v1.PropsSet(id, 1); + v1.PropsSet(id, PropertyValue(1)); auto v2 = dba.InsertVertex(); - v2.PropsSet(id, 2); + v2.PropsSet(id, PropertyValue(2)); auto v3 = dba.InsertVertex(); - v3.PropsSet(id, 3); + v3.PropsSet(id, PropertyValue(3)); auto r1 = dba.InsertEdge(v1, v2, dba.EdgeType("r1")); auto r2 = dba.InsertEdge(v2, v3, dba.EdgeType("r2")); dba.AdvanceCommand(); @@ -274,7 +274,7 @@ TEST(TestVariableStartPlanner, MatchVariableExpandBoth) { auto id = dba.Property("id"); // Graph (v1 {id:1}) -[:r1]-> (v2) -[:r2]-> (v3) auto v1 = dba.InsertVertex(); - v1.PropsSet(id, 1); + v1.PropsSet(id, PropertyValue(1)); auto v2 = dba.InsertVertex(); auto v3 = dba.InsertVertex(); auto r1 = dba.InsertEdge(v1, v2, dba.EdgeType("r1")); @@ -303,11 +303,11 @@ TEST(TestVariableStartPlanner, MatchBfs) { auto id = dba.Property("id"); // Graph (v1 {id:1}) -[:r1]-> (v2 {id: 2}) -[:r2]-> (v3 {id: 3}) auto v1 = dba.InsertVertex(); - v1.PropsSet(id, 1); + v1.PropsSet(id, PropertyValue(1)); auto v2 = dba.InsertVertex(); - v2.PropsSet(id, 2); + v2.PropsSet(id, PropertyValue(2)); auto v3 = dba.InsertVertex(); - v3.PropsSet(id, 3); + v3.PropsSet(id, PropertyValue(3)); auto r1 = dba.InsertEdge(v1, v2, dba.EdgeType("r1")); dba.InsertEdge(v2, v3, dba.EdgeType("r2")); dba.AdvanceCommand(); diff --git a/tests/unit/record_edge_vertex_accessor.cpp b/tests/unit/record_edge_vertex_accessor.cpp index ec40a363f..95373f0d8 100644 --- a/tests/unit/record_edge_vertex_accessor.cpp +++ b/tests/unit/record_edge_vertex_accessor.cpp @@ -22,7 +22,7 @@ TEST(RecordAccessor, Properties) { auto property_other = dba.Property("Other"); EXPECT_EQ(vertex.PropsAt(property).type(), PropertyValue::Type::Null); - vertex.PropsSet(property, 42); + vertex.PropsSet(property, PropertyValue(42)); EXPECT_EQ(vertex.PropsAt(property).ValueInt(), 42); EXPECT_EQ(properties.at(property).ValueInt(), 42); EXPECT_EQ(vertex.PropsAt(property_other).type(), PropertyValue::Type::Null); diff --git a/tests/unit/slk_advanced.cpp b/tests/unit/slk_advanced.cpp index 502588a50..5b1bc2954 100644 --- a/tests/unit/slk_advanced.cpp +++ b/tests/unit/slk_advanced.cpp @@ -5,8 +5,9 @@ #include "slk_common.hpp" TEST(SlkAdvanced, PropertyValueList) { - std::vector<PropertyValue> original{"hello world!", 5, 1.123423, true, - PropertyValue()}; + std::vector<PropertyValue> original{PropertyValue("hello world!"), + PropertyValue(5), PropertyValue(1.123423), + PropertyValue(true), PropertyValue()}; ASSERT_EQ(original[0].type(), PropertyValue::Type::String); ASSERT_EQ(original[1].type(), PropertyValue::Type::Int); ASSERT_EQ(original[2].type(), PropertyValue::Type::Double); @@ -25,11 +26,12 @@ TEST(SlkAdvanced, PropertyValueList) { } TEST(SlkAdvanced, PropertyValueMap) { - std::map<std::string, PropertyValue> original{{"hello", "world"}, - {"number", 5}, - {"real", 1.123423}, - {"truth", true}, - {"nothing", PropertyValue()}}; + std::map<std::string, PropertyValue> original{ + {"hello", PropertyValue("world")}, + {"number", PropertyValue(5)}, + {"real", PropertyValue(1.123423)}, + {"truth", PropertyValue(true)}, + {"nothing", PropertyValue()}}; ASSERT_EQ(original["hello"].type(), PropertyValue::Type::String); ASSERT_EQ(original["number"].type(), PropertyValue::Type::Int); ASSERT_EQ(original["real"].type(), PropertyValue::Type::Double); @@ -48,18 +50,19 @@ TEST(SlkAdvanced, PropertyValueMap) { } TEST(SlkAdvanced, PropertyValueComplex) { - std::vector<PropertyValue> vec_v{"hello world!", 5, 1.123423, true, - PropertyValue()}; + std::vector<PropertyValue> vec_v{PropertyValue("hello world!"), + PropertyValue(5), PropertyValue(1.123423), + PropertyValue(true), PropertyValue()}; ASSERT_EQ(vec_v[0].type(), PropertyValue::Type::String); ASSERT_EQ(vec_v[1].type(), PropertyValue::Type::Int); ASSERT_EQ(vec_v[2].type(), PropertyValue::Type::Double); ASSERT_EQ(vec_v[3].type(), PropertyValue::Type::Bool); ASSERT_EQ(vec_v[4].type(), PropertyValue::Type::Null); - std::map<std::string, PropertyValue> map_v{{"hello", "world"}, - {"number", 5}, - {"real", 1.123423}, - {"truth", true}, + std::map<std::string, PropertyValue> map_v{{"hello", PropertyValue("world")}, + {"number", PropertyValue(5)}, + {"real", PropertyValue(1.123423)}, + {"truth", PropertyValue(true)}, {"nothing", PropertyValue()}}; ASSERT_EQ(map_v["hello"].type(), PropertyValue::Type::String); ASSERT_EQ(map_v["number"].type(), PropertyValue::Type::Int); @@ -67,7 +70,8 @@ TEST(SlkAdvanced, PropertyValueComplex) { ASSERT_EQ(map_v["truth"].type(), PropertyValue::Type::Bool); ASSERT_EQ(map_v["nothing"].type(), PropertyValue::Type::Null); - PropertyValue original({vec_v, map_v}); + PropertyValue original( + std::vector<PropertyValue>{PropertyValue(vec_v), PropertyValue(map_v)}); ASSERT_EQ(original.type(), PropertyValue::Type::List); slk::Loopback loopback; diff --git a/tests/unit/typed_value.cpp b/tests/unit/typed_value.cpp index a05c9ac7f..4630cc879 100644 --- a/tests/unit/typed_value.cpp +++ b/tests/unit/typed_value.cpp @@ -112,7 +112,8 @@ TEST(TypedValue, Equals) { EXPECT_PROP_EQ(TypedValue("str3"), TypedValue("str3")); EXPECT_PROP_EQ(TypedValue(std::string("str3")), TypedValue("str3")); - EXPECT_PROP_NE(TypedValue(std::vector<TypedValue>{1}), TypedValue(1)); + EXPECT_PROP_NE(TypedValue(std::vector<TypedValue>{TypedValue(1)}), + TypedValue(1)); EXPECT_PROP_NE(TypedValue(std::vector<TypedValue>{ TypedValue(1), TypedValue(true), TypedValue("a")}), TypedValue(std::vector<TypedValue>{