empiredan commented on code in PR #1300:
URL:
https://github.com/apache/incubator-pegasus/pull/1300#discussion_r1055164514
##########
src/utils/test/utils.cpp:
##########
@@ -115,6 +115,52 @@ TEST(core, check_c_string_empty)
}
}
+TEST(core, check_c_string_equal)
+{
+ struct test_case
+ {
+ const char *lhs;
+ const char *rhs;
+ bool is_equal;
+ } tests[] = {
+ {nullptr, nullptr, true}, {nullptr, "", false}, {nullptr, "a", false},
+ {nullptr, "abc", false}, {"", nullptr, false}, {"a", nullptr, false},
+ {"abc", nullptr, false}, {"", "", true}, {"", "a", false},
+ {"", "abc", false}, {"a", "", false}, {"abc", "", false},
+ {"a", "a", true}, {"a", "A", false}, {"A", "A", true},
+ {"abc", "abc", true}, {"aBc", "abc", false}, {"abc", "ABC", false},
+ {"a", "abc", false}, {"A", "abc", false}, {"abc", "a", false},
+ {"Abc", "a", false},
+ };
+
+ for (const auto &test : tests) {
+ EXPECT_EQ(test.is_equal, dsn::utils::equals(test.lhs, test.rhs));
Review Comment:
Yes, once a case failed it is really hard to look out it. I'll use `TEST_P`
to refactor this.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]