Matt Spinler | 0d92b52 | 2021-06-16 13:28:17 -0600 | [diff] [blame] | 1 | #include "extensions/openpower-pels/data_interface.hpp" |
| 2 | |
| 3 | #include <gtest/gtest.h> |
| 4 | |
| 5 | using namespace openpower::pels; |
| 6 | |
| 7 | TEST(DataInterfaceTest, ExtractConnectorLocCode) |
| 8 | { |
| 9 | { |
| 10 | auto [base, connector] = |
| 11 | DataInterface::extractConnectorFromLocCode("Ufcs-P0-C2-T11"); |
| 12 | |
| 13 | EXPECT_EQ(base, "Ufcs-P0-C2"); |
| 14 | EXPECT_EQ(connector, "-T11"); |
| 15 | } |
| 16 | |
| 17 | { |
| 18 | auto [base, connector] = |
| 19 | DataInterface::extractConnectorFromLocCode("Ufcs-P0-C2"); |
| 20 | |
| 21 | EXPECT_EQ(base, "Ufcs-P0-C2"); |
| 22 | EXPECT_TRUE(connector.empty()); |
| 23 | } |
| 24 | } |
George Liu | 9ac0d9b | 2022-07-15 10:57:38 +0800 | [diff] [blame] | 25 | |
| 26 | TEST(DataInterfaceTest, ExtractUptime) |
| 27 | { |
| 28 | uint64_t seconds = 123456789; |
| 29 | std::string retUptime = "3y 332d 21h 33m 9s"; |
| 30 | |
| 31 | auto bus = sdbusplus::bus::new_default(); |
| 32 | DataInterface dataIntf(bus); |
| 33 | std::string uptime = dataIntf.getBMCUptime(seconds); |
| 34 | |
| 35 | EXPECT_EQ(uptime, retUptime); |
Patrick Williams | ac1ba3f | 2023-05-10 07:50:16 -0500 | [diff] [blame] | 36 | } |