blob: b02e1d6ba4374cae22e397145109335e2f1d9228 [file] [log] [blame]
Patrick Venture8b4478c2020-10-06 08:30:27 -07001#include "dbus/dbusutil.hpp"
2
3#include <string>
4#include <tuple>
5
6#include <gmock/gmock.h>
7#include <gtest/gtest.h>
8
9namespace pid_control
10{
11namespace
12{
13
14using ::testing::StrEq;
15
16class GetSensorPathTest :
17 public ::testing::TestWithParam<
18 std::tuple<std::string, std::string, std::string>>
19{};
20
21TEST_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
29INSTANTIATE_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