summaryrefslogtreecommitdiffstats
path: root/test/serialize_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/serialize_test.cpp')
-rw-r--r--test/serialize_test.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/serialize_test.cpp b/test/serialize_test.cpp
index 4ed6446..7061978 100644
--- a/test/serialize_test.cpp
+++ b/test/serialize_test.cpp
@@ -1 +1,24 @@
#include "../serialize.hpp"
+
+#include <gtest/gtest.h>
+
+using namespace phosphor::inventory::manager;
+using namespace std::string_literals;
+
+TEST(SerializeTest, TestStoragePathNoSlashes)
+{
+ auto path = "foo/bar/baz"s;
+ auto iface = "xyz.foo"s;
+ auto p1 = detail::getStoragePath(path, iface);
+ auto p2 = fs::path(PIM_PERSIST_PATH "/foo/bar/baz/xyz.foo");
+ EXPECT_EQ(p1, p2);
+}
+
+TEST(SerializeTest, TestStoragePathSlashes)
+{
+ auto path = "/foo/bar/baz"s;
+ auto iface = "/xyz.foo"s;
+ auto p1 = detail::getStoragePath(path, iface);
+ auto p2 = fs::path(PIM_PERSIST_PATH "/foo/bar/baz/xyz.foo");
+ EXPECT_EQ(p1, p2);
+}
OpenPOWER on IntegriCloud