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