dbus_utility_test: add namespace
This commit does nothing but add namespace to the test source. It can be
shown that it saves a lot of duplicate codes.
Tested: unit test compiles and passes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I42a70c5c32c32c1cb09f7c3e36d6e5816aa3a53e
diff --git a/include/ut/dbus_utility_test.cpp b/include/ut/dbus_utility_test.cpp
index d4342a5..7163d62 100644
--- a/include/ut/dbus_utility_test.cpp
+++ b/include/ut/dbus_utility_test.cpp
@@ -5,32 +5,39 @@
#include "gmock/gmock.h"
+namespace dbus::utility
+{
+namespace
+{
+
TEST(DbusUtility, getNthStringFromPathGoodTest)
{
std::string path("/0th/1st/2nd/3rd");
std::string result;
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 0, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 0, result));
EXPECT_EQ(result, "0th");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 1, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 1, result));
EXPECT_EQ(result, "1st");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 2, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 2, result));
EXPECT_EQ(result, "2nd");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 3, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 3, result));
EXPECT_EQ(result, "3rd");
- EXPECT_FALSE(dbus::utility::getNthStringFromPath(path, 4, result));
+ EXPECT_FALSE(getNthStringFromPath(path, 4, result));
}
TEST(DbusUtility, getNthStringFromPathBadTest)
{
std::string path("////0th///1st//\2nd///3rd?/");
std::string result;
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 0, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 0, result));
EXPECT_EQ(result, "0th");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 1, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 1, result));
EXPECT_EQ(result, "1st");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 2, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 2, result));
EXPECT_EQ(result, "\2nd");
- EXPECT_TRUE(dbus::utility::getNthStringFromPath(path, 3, result));
+ EXPECT_TRUE(getNthStringFromPath(path, 3, result));
EXPECT_EQ(result, "3rd?");
- EXPECT_FALSE(dbus::utility::getNthStringFromPath(path, -1, result));
+ EXPECT_FALSE(getNthStringFromPath(path, -1, result));
}
+} // namespace
+} // namespace dbus::utility
\ No newline at end of file