summaryrefslogtreecommitdiffstats
path: root/test/gpio_mock.hpp
blob: d1acfefd610342afc1d85826a641f1603f0cab52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#pragma once

#include <gpioplus/handle.hpp>
#include <memory>
#include <string>

#include <gmock/gmock.h>

class GpioHandleInterface
{
  public:
    virtual ~GpioHandleInterface() = default;
    virtual std::unique_ptr<gpioplus::HandleInterface>
        build(const std::string& gpiochip, const std::string& line) const = 0;
};

class GpioHandleMock : public GpioHandleInterface
{
  public:
    virtual ~GpioHandleMock() = default;
    MOCK_CONST_METHOD2(build, std::unique_ptr<gpioplus::HandleInterface>(
                                  const std::string&, const std::string&));
};

// Set this before each test that hits a call to getEnv().
extern GpioHandleInterface* gpioIntf;
OpenPOWER on IntegriCloud