blob: 8ae721b999f83320f3204d3fd232740af3641c69 [file] [log] [blame]
Bob King8e4cb642020-04-24 13:18:53 +08001/**
2 * Copyright © 2020 IBM Corporation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include "action_environment.hpp"
17#include "compare_vpd_action.hpp"
18#include "id_map.hpp"
19
20#include <exception>
21#include <memory>
22#include <stdexcept>
23#include <utility>
24
25#include <gtest/gtest.h>
26
27using namespace phosphor::power::regulators;
28
29TEST(CompareVPDActionTests, Constructor)
30{
31 CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
32 EXPECT_EQ(action.getFRU(), "/system/chassis/disk_backplane");
33 EXPECT_EQ(action.getKeyword(), "CCIN");
34 EXPECT_EQ(action.getValue(), "2D35");
35}
36
37TEST(CompareVPDActionTests, Execute)
38{
39 // TODO: Not implemented yet
40}
41
42TEST(CompareVPDActionTests, GetFRU)
43{
44 CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
45 EXPECT_EQ(action.getFRU(), "/system/chassis/disk_backplane");
46}
47
48TEST(CompareVPDActionTests, GetKeyword)
49{
50 CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
51 EXPECT_EQ(action.getKeyword(), "CCIN");
52}
53
54TEST(CompareVPDActionTests, GetValue)
55{
56 CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
57 EXPECT_EQ(action.getValue(), "2D35");
58}
59
60TEST(CompareVPDActionTests, ToString)
61{
62 CompareVPDAction action{"/system/chassis/disk_backplane", "CCIN", "2D35"};
63 EXPECT_EQ(action.toString(),
64 "compare_vpd: { fru: /system/chassis/disk_backplane, keyword: "
65 "CCIN, value: 2D35 }");
66}