blob: e290a0ffd6fa2a6897d52cbcb2a4209a517b43a7 [file] [log] [blame]
Bob King07301ea2020-04-21 17:22:23 +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.hpp"
17#include "action_environment.hpp"
18#include "compare_presence_action.hpp"
19#include "id_map.hpp"
20#include "mock_action.hpp"
21
22#include <exception>
23#include <memory>
24#include <stdexcept>
25#include <utility>
26
27#include <gtest/gtest.h>
28
29using namespace phosphor::power::regulators;
30
31TEST(ComparePresenceActionTests, Constructor)
32{
33 ComparePresenceAction action{"/system/chassis/motherboard/cpu3", true};
34 EXPECT_EQ(action.getFRU(), "/system/chassis/motherboard/cpu3");
35 EXPECT_EQ(action.getValue(), true);
36}
37
38TEST(ComparePresenceActionTests, Execute)
39{
40 // TODO: Not implemented yet
41}
42
43TEST(ComparePresenceActionTests, GetFRU)
44{
45 ComparePresenceAction action{"/system/chassis/motherboard/cpu2", true};
46 EXPECT_EQ(action.getFRU(), "/system/chassis/motherboard/cpu2");
47}
48
49TEST(ComparePresenceActionTests, GetValue)
50{
51 ComparePresenceAction action{"/system/chassis/motherboard/cpu3", false};
52 EXPECT_EQ(action.getValue(), false);
53}
54
55TEST(ComparePresenceActionTests, ToString)
56{
57 ComparePresenceAction action{"/system/chassis/motherboard/cpu2", true};
58 EXPECT_EQ(action.toString(),
59 "compare_presence: { fru: /system/chassis/motherboard/cpu2, "
60 "value: true }");
61}