blob: 3b218cd765c816785e2daffa517fc47f2b4e6ac6 [file] [log] [blame]
Shawn McCarney4af83db2024-02-08 16:33:44 -06001/**
2 * Copyright © 2024 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#pragma once
17
18#include "power_sequencer_device.hpp"
19
Shawn McCarney31234452025-10-28 12:32:05 -050020#include <cstdint>
21
Shawn McCarney4af83db2024-02-08 16:33:44 -060022#include <gmock/gmock.h>
23
24namespace phosphor::power::sequencer
25{
26
27/**
28 * @class MockDevice
29 *
30 * Mock implementation of the PowerSequencerDevice interface.
31 */
32class MockDevice : public PowerSequencerDevice
33{
34 public:
35 // Specify which compiler-generated methods we want
36 MockDevice() = default;
37 MockDevice(const MockDevice&) = delete;
38 MockDevice(MockDevice&&) = delete;
39 MockDevice& operator=(const MockDevice&) = delete;
40 MockDevice& operator=(MockDevice&&) = delete;
41 virtual ~MockDevice() = default;
42
43 MOCK_METHOD(const std::string&, getName, (), (const, override));
Shawn McCarney31234452025-10-28 12:32:05 -050044 MOCK_METHOD(uint8_t, getBus, (), (const, override));
45 MOCK_METHOD(uint16_t, getAddress, (), (const, override));
Shawn McCarneyfe536672025-10-29 12:44:08 -050046 MOCK_METHOD(const std::string&, getPowerControlGPIOName, (),
47 (const, override));
48 MOCK_METHOD(const std::string&, getPowerGoodGPIOName, (),
49 (const, override));
Shawn McCarneyf47a7a72024-04-18 16:59:33 -050050 MOCK_METHOD(const std::vector<std::unique_ptr<Rail>>&, getRails, (),
51 (const, override));
Shawn McCarneyfc3f31f2024-04-23 17:02:44 -050052 MOCK_METHOD(std::vector<int>, getGPIOValues, (Services & services),
53 (override));
Shawn McCarney4af83db2024-02-08 16:33:44 -060054 MOCK_METHOD(uint16_t, getStatusWord, (uint8_t page), (override));
55 MOCK_METHOD(uint8_t, getStatusVout, (uint8_t page), (override));
56 MOCK_METHOD(double, getReadVout, (uint8_t page), (override));
57 MOCK_METHOD(double, getVoutUVFaultLimit, (uint8_t page), (override));
Shawn McCarney472101c2024-04-17 16:31:09 -050058 MOCK_METHOD(std::string, findPgoodFault,
Shawn McCarneyf47a7a72024-04-18 16:59:33 -050059 (Services & services, const std::string& powerSupplyError,
Shawn McCarney24956592024-02-19 18:58:57 -060060 (std::map<std::string, std::string> & additionalData)),
Shawn McCarney4af83db2024-02-08 16:33:44 -060061 (override));
62};
63
64} // namespace phosphor::power::sequencer