blob: 1b4526a062ad879da91eeb97fa5af31ef3b14f64 [file] [log] [blame]
Xiuzhi Cheng4f3eb902022-06-08 09:06:33 +08001#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
10using ::testing::_;
11using ::testing::Invoke;
12using ::testing::IsNull;
13using ::testing::Return;
14using ::testing::StrEq;
15using ::testing::VariantWith;
16
17namespace ipmi
18{
19
20namespace impl
21{
22
23bool registerHandler(int prio, NetFn netFn, Cmd cmd, Privilege priv, ::ipmi::HandlerBase::ptr handler)
24{
25 (void)prio;
26 (void)netFn;
27 (void)cmd;
28 (void)priv;
29 (void)handler;
30
31 return true;
32}
33
34} // namespace impl
35
36TEST(TestKunlunIpmiOem, SetAndGetCpuInfo)
37{
38 uint8_t index = 0;
39 uint32_t loop;
40 std::vector<char> infoSet;
41 std::vector<char> infoGet;
42
43 for (loop = 0; loop < 256; loop++)
44 {
45 infoSet.push_back(static_cast<char>(loop));
46 }
47
48 EXPECT_EQ(setCpuInfo(index, infoSet), responseSuccess());
49
50 auto result = getCpuInfo(index);
51 infoGet = std::get<0>(std::get<1>(result).value());
52
53 EXPECT_TRUE(infoSet == infoGet);
54}
55
56} // namespace ipmi