Xiuzhi Cheng | 4f3eb90 | 2022-06-08 09:06:33 +0800 | [diff] [blame] | 1 | #include "config.h" |
| 2 | |
| 3 | #include "kunlun_oem.hpp" |
| 4 | |
| 5 | #include <ipmid/api.h> |
| 6 | |
| 7 | #include <gmock/gmock.h> |
| 8 | #include <gtest/gtest.h> |
| 9 | |
| 10 | using ::testing::_; |
| 11 | using ::testing::Invoke; |
| 12 | using ::testing::IsNull; |
| 13 | using ::testing::Return; |
| 14 | using ::testing::StrEq; |
| 15 | using ::testing::VariantWith; |
| 16 | |
| 17 | namespace ipmi |
| 18 | { |
| 19 | |
| 20 | namespace impl |
| 21 | { |
| 22 | |
Patrick Williams | b8c9244 | 2022-08-04 13:27:05 -0500 | [diff] [blame] | 23 | bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, |
| 24 | ::ipmi::HandlerBase::ptr handler) |
Xiuzhi Cheng | 4f3eb90 | 2022-06-08 09:06:33 +0800 | [diff] [blame] | 25 | { |
| 26 | (void)prio; |
| 27 | (void)netFn; |
| 28 | (void)cmd; |
| 29 | (void)priv; |
| 30 | (void)handler; |
| 31 | |
| 32 | return true; |
| 33 | } |
| 34 | |
| 35 | } // namespace impl |
| 36 | |
| 37 | TEST(TestKunlunIpmiOem, SetAndGetCpuInfo) |
| 38 | { |
| 39 | uint8_t index = 0; |
| 40 | uint32_t loop; |
| 41 | std::vector<char> infoSet; |
| 42 | std::vector<char> infoGet; |
| 43 | |
| 44 | for (loop = 0; loop < 256; loop++) |
| 45 | { |
| 46 | infoSet.push_back(static_cast<char>(loop)); |
| 47 | } |
| 48 | |
| 49 | EXPECT_EQ(setCpuInfo(index, infoSet), responseSuccess()); |
| 50 | |
| 51 | auto result = getCpuInfo(index); |
| 52 | infoGet = std::get<0>(std::get<1>(result).value()); |
| 53 | |
| 54 | EXPECT_TRUE(infoSet == infoGet); |
| 55 | } |
| 56 | |
| 57 | } // namespace ipmi |