blob: 4cf232f0e08fc8440b739d5b6a88dde1c3e8be8f [file] [log] [blame]
Patrick Venturea67a9472018-12-19 07:29:43 -08001#pragma once
2
3#include "sensorset.hpp"
4
5#include <string>
6
7#include <gmock/gmock.h>
8
9class EnvInterface
10{
11 public:
12 virtual ~EnvInterface() = default;
13
14 virtual std::string getEnv(const char* key) const = 0;
15 virtual std::string getEnv(const char* prefix,
16 const SensorSet::key_type& sensor) const = 0;
17 virtual std::string getEnv(const char* prefix, const std::string& type,
18 const std::string& id) const = 0;
19 virtual std::string
20 getIndirectID(std::string path, const std::string& fileSuffix,
21 const SensorSet::key_type& sensor) const = 0;
22};
23
24class EnvMock : public EnvInterface
25{
26 public:
27 virtual ~EnvMock() = default;
28
29 MOCK_CONST_METHOD1(getEnv, std::string(const char*));
30 MOCK_CONST_METHOD2(getEnv,
31 std::string(const char*, const SensorSet::key_type&));
32 MOCK_CONST_METHOD3(getEnv, std::string(const char*, const std::string&,
33 const std::string&));
34 MOCK_CONST_METHOD3(getIndirectID,
35 std::string(std::string, const std::string&,
36 const SensorSet::key_type&));
37};
38
39// Set this before each test that hits a call to getEnv().
40extern EnvInterface* envIntf;