isapego commented on code in PR #7966:
URL: https://github.com/apache/ignite-3/pull/7966#discussion_r3080281956
##########
modules/platforms/cpp/ignite/common/uuid_test.cpp:
##########
@@ -64,3 +64,54 @@ TEST(uuid, stream) {
EXPECT_EQ(uuidString, uuidString2);
}
+
+TEST(uuid, incorrect_string_representation) {
+ auto uuidText = "foo";
+
+ auto resOpt = ignite::uuid::from_string(uuidText);
+
+ EXPECT_FALSE(resOpt.has_value());
+}
+
+class uuid_string_presentation_fixture: public
::testing::TestWithParam<std::tuple<std::string, ignite::uuid>> {};
+
+TEST_P(uuid_string_presentation_fixture, from_string) {
+ auto [uuidText, uuid] = GetParam();
+
+ auto resOpt = ignite::uuid::from_string(uuidText);
+
+ EXPECT_TRUE(resOpt.has_value());
+
+ EXPECT_EQ(uuid.get_most_significant_bits(),
resOpt->get_most_significant_bits());
+ EXPECT_EQ(uuid.get_least_significant_bits(),
resOpt->get_least_significant_bits());
+}
+
+// We check that two representation are consistent both ways.
+TEST_P(uuid_string_presentation_fixture, to_string) {
+ auto [uuidText, uuid] = GetParam();
+
+
+ std::stringstream ss;
+ ss << uuid;
+
+ EXPECT_EQ(uuidText, ss.str());
+}
Review Comment:
Let's go here uuid -> string -> uuid.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]