xref: /openbmc/phosphor-hwmon/test/gpio_mock.hpp (revision e3e0f97d648d7251f6670289ae38284c79686e47)
1 #pragma once
2 
3 #include <gpioplus/handle.hpp>
4 #include <memory>
5 #include <string>
6 
7 #include <gmock/gmock.h>
8 
9 class GpioHandleInterface
10 {
11   public:
12     virtual ~GpioHandleInterface() = default;
13     virtual std::unique_ptr<gpioplus::HandleInterface>
14         build(const std::string& gpiochip, const std::string& line) const = 0;
15 };
16 
17 class GpioHandleMock : public GpioHandleInterface
18 {
19   public:
20     virtual ~GpioHandleMock() = default;
21     MOCK_CONST_METHOD2(build, std::unique_ptr<gpioplus::HandleInterface>(
22                                   const std::string&, const std::string&));
23 };
24 
25 // Set this before each test that hits a call to getEnv().
26 extern GpioHandleInterface* gpioIntf;
27