openbmc_jtag_rest_test: move to openbmc_dbus_rest
This commit does nothing but moving test codes from
openbmc_jtag_rest_test.cc, a very old test file whose name is obsolote
now, to a more recent and well maintained unit test file
(openbmc_dbus_rest_test.cc).
Tested: unit test passed.
Signed-off-by: Nan Zhou <nanzhoumails@gmail.com>
Change-Id: I3709d18c8ef5cbba5b3f6490a1e9d1798dfc8b52
diff --git a/include/ut/openbmc_dbus_rest_test.cpp b/include/ut/openbmc_dbus_rest_test.cpp
index e671e47..554ab74 100644
--- a/include/ut/openbmc_dbus_rest_test.cpp
+++ b/include/ut/openbmc_dbus_rest_test.cpp
@@ -1,5 +1,6 @@
#include "include/openbmc_dbus_rest.hpp"
+#include "gmock/gmock.h"
#include "gtest/gtest.h"
// Also see redfish-core/ut/configfile_test.cpp
@@ -33,3 +34,52 @@
crow::openbmc_mapper::validateFilename("../../../../../../etc/shadow"));
EXPECT_FALSE(crow::openbmc_mapper::validateFilename("."));
}
+
+TEST(OpenBmcDbusTest, TestArgSplit)
+{
+ // test the basic types
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("x"),
+ ::testing::ElementsAre("x"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("y"),
+ ::testing::ElementsAre("y"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("b"),
+ ::testing::ElementsAre("b"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("n"),
+ ::testing::ElementsAre("n"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("q"),
+ ::testing::ElementsAre("q"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("i"),
+ ::testing::ElementsAre("i"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("u"),
+ ::testing::ElementsAre("u"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("x"),
+ ::testing::ElementsAre("x"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("t"),
+ ::testing::ElementsAre("t"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("d"),
+ ::testing::ElementsAre("d"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("h"),
+ ::testing::ElementsAre("h"));
+ // test arrays
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("ai"),
+ ::testing::ElementsAre("ai"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("ax"),
+ ::testing::ElementsAre("ax"));
+ // test tuples
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("(sss)"),
+ ::testing::ElementsAre("(sss)"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("(sss)b"),
+ ::testing::ElementsAre("(sss)", "b"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("b(sss)"),
+ ::testing::ElementsAre("b", "(sss)"));
+
+ // Test nested types
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("a{si}b"),
+ ::testing::ElementsAre("a{si}", "b"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("a(sss)b"),
+ ::testing::ElementsAre("a(sss)", "b"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("aa{si}b"),
+ ::testing::ElementsAre("aa{si}", "b"));
+ EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("i{si}b"),
+ ::testing::ElementsAre("i", "{si}", "b"));
+}
diff --git a/meson.build b/meson.build
index 59b6887..8724c62 100644
--- a/meson.build
+++ b/meson.build
@@ -398,7 +398,6 @@
'redfish-core/ut/registries_test.cpp',
'redfish-core/ut/stl_utils_test.cpp',
'redfish-core/ut/time_utils_test.cpp',
- 'src/openbmc_jtag_rest_test.cpp',
]
if(get_option('tests').enabled())
diff --git a/src/openbmc_jtag_rest_test.cpp b/src/openbmc_jtag_rest_test.cpp
deleted file mode 100644
index cb262e0..0000000
--- a/src/openbmc_jtag_rest_test.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "openbmc_dbus_rest.hpp"
-
-#include "gmock/gmock.h"
-#include "gtest/gtest.h"
-
-TEST(OpenBmcDbusTest, TestArgSplit)
-{
- // test the basic types
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("x"),
- ::testing::ElementsAre("x"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("y"),
- ::testing::ElementsAre("y"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("b"),
- ::testing::ElementsAre("b"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("n"),
- ::testing::ElementsAre("n"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("q"),
- ::testing::ElementsAre("q"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("i"),
- ::testing::ElementsAre("i"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("u"),
- ::testing::ElementsAre("u"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("x"),
- ::testing::ElementsAre("x"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("t"),
- ::testing::ElementsAre("t"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("d"),
- ::testing::ElementsAre("d"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("h"),
- ::testing::ElementsAre("h"));
- // test arrays
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("ai"),
- ::testing::ElementsAre("ai"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("ax"),
- ::testing::ElementsAre("ax"));
- // test tuples
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("(sss)"),
- ::testing::ElementsAre("(sss)"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("(sss)b"),
- ::testing::ElementsAre("(sss)", "b"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("b(sss)"),
- ::testing::ElementsAre("b", "(sss)"));
-
- // Test nested types
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("a{si}b"),
- ::testing::ElementsAre("a{si}", "b"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("a(sss)b"),
- ::testing::ElementsAre("a(sss)", "b"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("aa{si}b"),
- ::testing::ElementsAre("aa{si}", "b"));
- EXPECT_THAT(crow::openbmc_mapper::dbusArgSplit("i{si}b"),
- ::testing::ElementsAre("i", "{si}", "b"));
-}