Andrew Geissler | 4cea4d2 | 2017-07-10 15:13:33 -0500 | [diff] [blame] | 1 | #include <gtest/gtest.h> |
| 2 | #include "powercap.hpp" |
| 3 | |
| 4 | using namespace open_power::occ; |
| 5 | |
| 6 | class VerifyOccInput : public ::testing::Test |
| 7 | { |
| 8 | public: |
| 9 | VerifyOccInput() : |
| 10 | bus(sdbusplus::bus::new_default()), |
| 11 | occStatus(bus,"/test/path"), |
| 12 | pcap(bus,occStatus) |
| 13 | {} |
| 14 | ~VerifyOccInput() |
| 15 | {} |
| 16 | |
| 17 | sdbusplus::bus::bus bus; |
| 18 | Status occStatus; |
| 19 | powercap::PowerCap pcap; |
| 20 | }; |
| 21 | |
| 22 | TEST_F(VerifyOccInput, PcapDisabled) { |
| 23 | uint32_t occInput = pcap.getOccInput(100,false); |
| 24 | EXPECT_EQ(occInput, 0); |
| 25 | } |
| 26 | |
| 27 | TEST_F(VerifyOccInput, PcapEnabled) { |
| 28 | uint32_t occInput = pcap.getOccInput(100,true); |
| 29 | EXPECT_EQ(occInput, 90); |
| 30 | } |