diff options
author | Nan Zhou <nanzhoumails@gmail.com> | 2022-06-14 02:58:49 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2022-06-18 22:36:51 +0300 |
commit | df91ea73d193d7a0562f072043c44e1b843767d4 (patch) | |
tree | 7d7d3c05815e0d71ce0872ca02eb0424f809951d | |
parent | 4e11f7029bc62e9aaf035bee0631a2394881ee2e (diff) | |
download | bmcweb-df91ea73d193d7a0562f072043c44e1b843767d4.tar.xz |
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
-rw-r--r-- | include/ut/openbmc_dbus_rest_test.cpp | 50 | ||||
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | src/openbmc_jtag_rest_test.cpp | 53 |
3 files changed, 50 insertions, 54 deletions
diff --git a/include/ut/openbmc_dbus_rest_test.cpp b/include/ut/openbmc_dbus_rest_test.cpp index e671e47718..554ab74d9c 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 @@ TEST(OpenbmcDbusRestTest, ValidFilenameBad) 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 59b68873fb..8724c62013 100644 --- a/meson.build +++ b/meson.build @@ -398,7 +398,6 @@ srcfiles_unittest = [ '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 cb262e05f1..0000000000 --- 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")); -} |