Overload << operator for mgp::Value::Type (#1080)

This commit is contained in:
Matija Pintarić
2023-07-25 13:30:02 +02:00
committed by GitHub
parent 036da58d30
commit ab4d1efe0b
2 changed files with 64 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
// licenses/APL.txt.
#include <queue>
#include <sstream>
#include <unordered_map>
#include <unordered_set>
@@ -471,3 +472,29 @@ TYPED_TEST(CppApiTestFixture, TestNodeProperties) {
ASSERT_EQ(node_1.Properties()["b"].ValueString(), "b");
ASSERT_EQ(node_1.GetProperty("b").ValueString(), "b");
}
TYPED_TEST(CppApiTestFixture, TestTypeOperatorStream) {
std::string string1 = "string";
int64_t int1 = 4;
mgp::List list = mgp::List();
mgp::Value string_value = mgp::Value(string1);
mgp::Value int_value = mgp::Value(int1);
mgp::Value list_value = mgp::Value(list);
std::ostringstream oss_str;
oss_str << string_value.Type();
std::string str_test = oss_str.str();
std::ostringstream oss_int;
oss_int << int_value.Type();
std::string int_test = oss_int.str();
std::ostringstream oss_list;
oss_list << list_value.Type();
std::string list_test = oss_list.str();
ASSERT_EQ(str_test, "string");
ASSERT_EQ(int_test, "int");
ASSERT_EQ(list_test, "list");
}