utest.cpp (b5ca101530dc5fa0992d00ab36edb292519cef94) utest.cpp (bcef3b4870bd93e6350f952706861bfac79982f4)
1#include "powercap.hpp"
2#include "utils.hpp"
3
4#include <occ_events.hpp>
5#include <occ_manager.hpp>
6
1#include "powercap.hpp"
2#include "utils.hpp"
3
4#include <occ_events.hpp>
5#include <occ_manager.hpp>
6
7#include <experimental/filesystem>
7#include <filesystem>
8
9#include <gtest/gtest.h>
10
11using namespace open_power::occ;
12using namespace open_power::occ::utils;
13
14class VerifyOccInput : public ::testing::Test
15{

--- 26 unchanged lines hidden (view full) ---

42TEST_F(VerifyOccInput, PcapEnabled)
43{
44 uint32_t occInput = pcap.getOccInput(100, true);
45 EXPECT_EQ(occInput, 90);
46}
47
48TEST(VerifyPathParsing, EmptyPath)
49{
8
9#include <gtest/gtest.h>
10
11using namespace open_power::occ;
12using namespace open_power::occ::utils;
13
14class VerifyOccInput : public ::testing::Test
15{

--- 26 unchanged lines hidden (view full) ---

42TEST_F(VerifyOccInput, PcapEnabled)
43{
44 uint32_t occInput = pcap.getOccInput(100, true);
45 EXPECT_EQ(occInput, 90);
46}
47
48TEST(VerifyPathParsing, EmptyPath)
49{
50 std::experimental::filesystem::path path = "";
50 std::filesystem::path path = "";
51 std::string parsed = Device::getPathBack(path);
52
53 EXPECT_STREQ(parsed.c_str(), "");
54}
55
56TEST(VerifyPathParsing, FilenamePath)
57{
51 std::string parsed = Device::getPathBack(path);
52
53 EXPECT_STREQ(parsed.c_str(), "");
54}
55
56TEST(VerifyPathParsing, FilenamePath)
57{
58 std::experimental::filesystem::path path = "/test/foo.bar";
58 std::filesystem::path path = "/test/foo.bar";
59 std::string parsed = Device::getPathBack(path);
60
61 EXPECT_STREQ(parsed.c_str(), "foo.bar");
62}
63
64TEST(VerifyPathParsing, DirectoryPath)
65{
59 std::string parsed = Device::getPathBack(path);
60
61 EXPECT_STREQ(parsed.c_str(), "foo.bar");
62}
63
64TEST(VerifyPathParsing, DirectoryPath)
65{
66 std::experimental::filesystem::path path = "/test/bar/";
66 std::filesystem::path path = "/test/bar/";
67 std::string parsed = Device::getPathBack(path);
68
69 EXPECT_STREQ(parsed.c_str(), "bar");
70}
67 std::string parsed = Device::getPathBack(path);
68
69 EXPECT_STREQ(parsed.c_str(), "bar");
70}