dbus_utility_test: fix test case names
This commit applies the GTest test case naming convention: Camel case,
use decriptive Test names.
It also groups test cases according to the name.
Reference:
https://testing.googleblog.com/2014/10/testing-on-toilet-writing-descriptive.html
http://google.github.io/googletest/primer.html#simple-tests
Tested: unit test passes.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: Ibd1bfcb4456b64e43f437cc2afa7464f03ee634c
diff --git a/include/ut/dbus_utility_test.cpp b/include/ut/dbus_utility_test.cpp
index cde6c33..a8fad63 100644
--- a/include/ut/dbus_utility_test.cpp
+++ b/include/ut/dbus_utility_test.cpp
@@ -9,7 +9,7 @@
namespace
{
-TEST(DbusUtility, getNthStringFromPathGoodTest)
+TEST(GetNthStringFromPath, ParsingSucceedsAndReturnsNthArg)
{
std::string path("/0th/1st/2nd/3rd");
std::string result;
@@ -22,12 +22,8 @@
EXPECT_TRUE(getNthStringFromPath(path, 3, result));
EXPECT_EQ(result, "3rd");
EXPECT_FALSE(getNthStringFromPath(path, 4, result));
-}
-TEST(DbusUtility, getNthStringFromPathBadTest)
-{
- std::string path("////0th///1st//\2nd///3rd?/");
- std::string result;
+ path = "////0th///1st//\2nd///3rd?/";
EXPECT_TRUE(getNthStringFromPath(path, 0, result));
EXPECT_EQ(result, "0th");
EXPECT_TRUE(getNthStringFromPath(path, 1, result));
@@ -36,6 +32,12 @@
EXPECT_EQ(result, "\2nd");
EXPECT_TRUE(getNthStringFromPath(path, 3, result));
EXPECT_EQ(result, "3rd?");
+}
+
+TEST(GetNthStringFromPath, InvalidIndexReturnsFalse)
+{
+ std::string path("////0th///1st//\2nd///3rd?/");
+ std::string result;
EXPECT_FALSE(getNthStringFromPath(path, -1, result));
}
} // namespace