Shawn McCarney | 906cc3f | 2024-02-01 13:33:06 -0600 | [diff] [blame] | 1 | /** |
| 2 | * Copyright © 2024 IBM Corporation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | #pragma once |
| 17 | |
| 18 | #include "pmbus.hpp" |
| 19 | |
Shawn McCarney | fb0ccb8 | 2024-04-24 13:14:41 -0500 | [diff] [blame^] | 20 | #include <filesystem> |
| 21 | |
Shawn McCarney | 906cc3f | 2024-02-01 13:33:06 -0600 | [diff] [blame] | 22 | #include <gmock/gmock.h> |
| 23 | |
| 24 | namespace phosphor::pmbus |
| 25 | { |
| 26 | |
Shawn McCarney | fb0ccb8 | 2024-04-24 13:14:41 -0500 | [diff] [blame^] | 27 | namespace fs = std::filesystem; |
| 28 | |
Shawn McCarney | 906cc3f | 2024-02-01 13:33:06 -0600 | [diff] [blame] | 29 | /** |
| 30 | * @class MockPMBus |
| 31 | * |
| 32 | * Mock implementation of the PMBusBase interface. |
| 33 | */ |
| 34 | class MockPMBus : public PMBusBase |
| 35 | { |
| 36 | public: |
| 37 | // Specify which compiler-generated methods we want |
| 38 | MockPMBus() = default; |
| 39 | MockPMBus(const MockPMBus&) = delete; |
| 40 | MockPMBus(MockPMBus&&) = delete; |
| 41 | MockPMBus& operator=(const MockPMBus&) = delete; |
| 42 | MockPMBus& operator=(MockPMBus&&) = delete; |
| 43 | virtual ~MockPMBus() = default; |
| 44 | |
| 45 | MOCK_METHOD(uint64_t, read, |
| 46 | (const std::string& name, Type type, bool errTrace), |
| 47 | (override)); |
| 48 | MOCK_METHOD(std::string, readString, (const std::string& name, Type type), |
| 49 | (override)); |
| 50 | MOCK_METHOD(std::vector<uint8_t>, readBinary, |
| 51 | (const std::string& name, Type type, size_t length), |
| 52 | (override)); |
| 53 | MOCK_METHOD(void, writeBinary, |
| 54 | (const std::string& name, std::vector<uint8_t> data, Type type), |
| 55 | (override)); |
| 56 | MOCK_METHOD(void, findHwmonDir, (), (override)); |
| 57 | MOCK_METHOD(const fs::path&, path, (), (const, override)); |
| 58 | MOCK_METHOD(std::string, insertPageNum, |
| 59 | (const std::string& templateName, size_t page), (override)); |
Shawn McCarney | fb0ccb8 | 2024-04-24 13:14:41 -0500 | [diff] [blame^] | 60 | MOCK_METHOD(fs::path, getPath, (Type type), (override)); |
Shawn McCarney | 906cc3f | 2024-02-01 13:33:06 -0600 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace phosphor::pmbus |