Patrick Venture | 8b4478c | 2020-10-06 08:30:27 -0700 | [diff] [blame^] | 1 | #include "dbus/dbusutil.hpp" |
| 2 | |
| 3 | #include <string> |
| 4 | #include <tuple> |
| 5 | |
| 6 | #include <gmock/gmock.h> |
| 7 | #include <gtest/gtest.h> |
| 8 | |
| 9 | namespace pid_control |
| 10 | { |
| 11 | namespace |
| 12 | { |
| 13 | |
| 14 | using ::testing::StrEq; |
| 15 | |
| 16 | class GetSensorPathTest : |
| 17 | public ::testing::TestWithParam< |
| 18 | std::tuple<std::string, std::string, std::string>> |
| 19 | {}; |
| 20 | |
| 21 | TEST_P(GetSensorPathTest, ReturnsExpectedValue) |
| 22 | { |
| 23 | // type, id, output |
| 24 | const auto& params = GetParam(); |
| 25 | EXPECT_THAT(getSensorPath(std::get<0>(params), std::get<1>(params)), |
| 26 | StrEq(std::get<2>(params))); |
| 27 | } |
| 28 | |
| 29 | INSTANTIATE_TEST_CASE_P( |
| 30 | GetSensorPathTests, GetSensorPathTest, |
| 31 | ::testing::Values( |
| 32 | std::make_tuple("fan", "0", "/xyz/openbmc_project/sensors/fan_tach/0"), |
| 33 | std::make_tuple("as", "we", "/xyz/openbmc_project/sensors/unknown/we"), |
| 34 | std::make_tuple("margin", "9", |
| 35 | "/xyz/openbmc_project/sensors/temperature/9"), |
| 36 | std::make_tuple("temp", "123", |
| 37 | "/xyz/openbmc_project/sensors/temperature/123"))); |
| 38 | |
| 39 | } // namespace |
| 40 | } // namespace pid_control |