Add overload of operator< for mgp::Value (#1090)
This commit is contained in:
@@ -473,6 +473,29 @@ TYPED_TEST(CppApiTestFixture, TestNodeProperties) {
|
||||
ASSERT_EQ(node_1.GetProperty("b").ValueString(), "b");
|
||||
}
|
||||
|
||||
|
||||
TYPED_TEST(CppApiTestFixture, TestValueOperatorLessThan) {
|
||||
const int64_t int1 = 3;
|
||||
const int64_t int2 = 4;
|
||||
const double double1 = 3.5;
|
||||
const mgp::List list1 = mgp::List();
|
||||
const mgp::Map map1 = mgp::Map();
|
||||
const mgp::Value int_test1 = mgp::Value(int1);
|
||||
const mgp::Value int_test2 = mgp::Value(int2);
|
||||
const mgp::Value double_test1 = mgp::Value(double1);
|
||||
const mgp::Value list_test = mgp::Value(list1);
|
||||
const mgp::Value map_test = mgp::Value(map1);
|
||||
|
||||
ASSERT_TRUE(int_test1 < int_test2);
|
||||
ASSERT_TRUE(double_test1 < int_test2);
|
||||
|
||||
const std::string string1 = "string";
|
||||
const mgp::Value string_test1 = mgp::Value(string1);
|
||||
|
||||
ASSERT_THROW(int_test1 < string_test1, mgp::ValueException);
|
||||
ASSERT_THROW(list_test < map_test, mgp::ValueException);
|
||||
ASSERT_THROW(list_test < list_test, mgp::ValueException);
|
||||
}
|
||||
TYPED_TEST(CppApiTestFixture, TestNumberEquality) {
|
||||
mgp::Value double_1{1.0};
|
||||
mgp::Value int_1{static_cast<int64_t>(1)};
|
||||
@@ -480,6 +503,7 @@ TYPED_TEST(CppApiTestFixture, TestNumberEquality) {
|
||||
mgp::Value double_2{2.01};
|
||||
mgp::Value int_2{static_cast<int64_t>(2)};
|
||||
ASSERT_FALSE(double_2 == int_2);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(CppApiTestFixture, TestTypeOperatorStream) {
|
||||
|
||||
Reference in New Issue
Block a user