diff options
Diffstat (limited to 'test/utest.cpp')
-rw-r--r-- | test/utest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/utest.cpp b/test/utest.cpp index eb9ca0b..39e5250 100644 --- a/test/utest.cpp +++ b/test/utest.cpp @@ -1,5 +1,6 @@ #include "powercap.hpp" +#include <experimental/filesystem> #include <occ_events.hpp> #include <occ_manager.hpp> @@ -43,3 +44,27 @@ TEST_F(VerifyOccInput, PcapEnabled) uint32_t occInput = pcap.getOccInput(100, true); EXPECT_EQ(occInput, 90); } + +TEST(VerifyPathParsing, EmptyPath) +{ + std::experimental::filesystem::path path = ""; + std::string parsed = Device::getPathBack(path); + + EXPECT_STREQ(parsed.c_str(), ""); +} + +TEST(VerifyPathParsing, FilenamePath) +{ + std::experimental::filesystem::path path = "/test/foo.bar"; + std::string parsed = Device::getPathBack(path); + + EXPECT_STREQ(parsed.c_str(), "foo.bar"); +} + +TEST(VerifyPathParsing, DirectoryPath) +{ + std::experimental::filesystem::path path = "/test/bar/"; + std::string parsed = Device::getPathBack(path); + + EXPECT_STREQ(parsed.c_str(), "bar"); +} |