-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
c1d019a Sensor Optimization Recently changed the way Ids were calculated in the sensor subsystem. Unfortunately, it wasn't clear to the author that this would effect the sensor override system, which relies on matching up a member ID with a dbus path, and was broken by this change. This commit breaks out the code to calculate the type and name from a given URI segment into a helper method. Tested: Inspection only. Very few systems support this feature. Code appears more correct than previously, which is known broken, so the lack of testing here seems reasonable. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9aa8099a947a36b5ce914bc07ae60f1ebf0d209b
- Loading branch information
Showing
3 changed files
with
69 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include "sensors.hpp" | ||
|
||
#include <gmock/gmock.h> // IWYU pragma: keep | ||
#include <gtest/gtest.h> // IWYU pragma: keep | ||
|
||
// IWYU pragma: no_include <gtest/gtest-message.h> | ||
// IWYU pragma: no_include <gtest/gtest-test-part.h> | ||
// IWYU pragma: no_include "gtest/gtest_pred_impl.h" | ||
// IWYU pragma: no_include <gmock/gmock-matchers.h> | ||
// IWYU pragma: no_include <gtest/gtest-matchers.h> | ||
|
||
namespace redfish | ||
{ | ||
namespace | ||
{ | ||
|
||
TEST(SplitSensorNameAndType, Type) | ||
{ | ||
EXPECT_EQ(splitSensorNameAndType("fantach_foo_1").first, "fan_tach"); | ||
EXPECT_EQ(splitSensorNameAndType("temperature_foo2").first, "temperature"); | ||
} | ||
|
||
TEST(SplitSensorNameAndType, Name) | ||
{ | ||
EXPECT_EQ(splitSensorNameAndType("fantach_foo_1").second, "foo_1"); | ||
EXPECT_EQ(splitSensorNameAndType("temperature_foo2").second, "foo2"); | ||
} | ||
|
||
TEST(SplitSensorNameAndType, Error) | ||
{ | ||
EXPECT_TRUE(splitSensorNameAndType("fantach").first.empty()); | ||
EXPECT_TRUE(splitSensorNameAndType("temperature").second.empty()); | ||
} | ||
|
||
} // namespace | ||
} // namespace redfish |