Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include "../i2c_interface.hpp" |
| 4 | |
| 5 | #include <gmock/gmock.h> |
| 6 | |
| 7 | namespace i2c |
| 8 | { |
| 9 | |
| 10 | class MockedI2CInterface : public I2CInterface |
| 11 | { |
| 12 | public: |
| 13 | virtual ~MockedI2CInterface() = default; |
| 14 | |
Shawn McCarney | d45a9a6 | 2019-12-10 18:35:44 -0600 | [diff] [blame] | 15 | MOCK_METHOD(void, open, (), (override)); |
| 16 | MOCK_METHOD(bool, isOpen, (), (const, override)); |
| 17 | MOCK_METHOD(void, close, (), (override)); |
| 18 | |
Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 19 | MOCK_METHOD(void, read, (uint8_t & data), (override)); |
| 20 | MOCK_METHOD(void, read, (uint8_t addr, uint8_t& data), (override)); |
| 21 | MOCK_METHOD(void, read, (uint8_t addr, uint16_t& data), (override)); |
Lei YU | 1d10342 | 2019-11-29 14:00:02 +0800 | [diff] [blame] | 22 | MOCK_METHOD(void, read, |
| 23 | (uint8_t addr, uint8_t& size, uint8_t* data, Mode mode), |
Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 24 | (override)); |
| 25 | |
| 26 | MOCK_METHOD(void, write, (uint8_t data), (override)); |
| 27 | MOCK_METHOD(void, write, (uint8_t addr, uint8_t data), (override)); |
| 28 | MOCK_METHOD(void, write, (uint8_t addr, uint16_t data), (override)); |
Lei YU | 1d10342 | 2019-11-29 14:00:02 +0800 | [diff] [blame] | 29 | MOCK_METHOD(void, write, |
| 30 | (uint8_t addr, uint8_t size, const uint8_t* data, Mode mode), |
Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 31 | (override)); |
Shawn McCarney | a3ff7e7 | 2024-10-15 17:34:49 -0500 | [diff] [blame] | 32 | |
| 33 | MOCK_METHOD(void, processCall, |
| 34 | (uint8_t addr, uint16_t writeData, uint16_t& readData), |
| 35 | (override)); |
| 36 | MOCK_METHOD(void, processCall, |
| 37 | (uint8_t addr, uint8_t writeSize, const uint8_t* writeData, |
| 38 | uint8_t& readSize, uint8_t* readData), |
| 39 | (override)); |
Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 40 | }; |
| 41 | |
Lei YU | ab1327c | 2019-11-04 16:53:39 +0800 | [diff] [blame] | 42 | } // namespace i2c |