xref: /openbmc/phosphor-power/phosphor-power-sequencer/test/mock_gpio.hpp (revision fdaa950b078e162b99dd1358f66b942a26b3bd19)
1 /**
2  * Copyright © 2025 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 "gpio.hpp"
19 
20 #include <gmock/gmock.h>
21 
22 namespace phosphor::power::sequencer
23 {
24 
25 /**
26  * @class MockGPIO
27  *
28  * Mock implementation of the GPIO interface.
29  */
30 class MockGPIO : public GPIO
31 {
32   public:
33     MockGPIO() = default;
34     MockGPIO(const MockGPIO&) = delete;
35     MockGPIO(MockGPIO&&) = delete;
36     MockGPIO& operator=(const MockGPIO&) = delete;
37     MockGPIO& operator=(MockGPIO&&) = delete;
38     virtual ~MockGPIO() = default;
39 
40     MOCK_METHOD(void, requestRead, (), (override));
41     MOCK_METHOD(void, requestWrite, (int initialValue), (override));
42     MOCK_METHOD(int, getValue, (), (override));
43     MOCK_METHOD(void, setValue, (int value), (override));
44     MOCK_METHOD(void, release, (), (override));
45 };
46 
47 } // namespace phosphor::power::sequencer
48