Patrick Venture | a67a947 | 2018-12-19 07:29:43 -0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "sensorset.hpp" |
| 4 | |
| 5 | #include <string> |
| 6 | |
| 7 | #include <gmock/gmock.h> |
| 8 | |
| 9 | class 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 | |
| 24 | class 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(). |
| 40 | extern EnvInterface* envIntf; |