clang-tidy: Enable readability-convert-member-functions-to-static
This check finds non-static member functions that can be made
static because the functions don’t use this.
This check also triggers readability-static-accessed-through
-instance check as we are trying to access a static member
function through an instance.
Change-Id: I887b514a8478abedc24d5495d057b9d3e7dc9bdf
Signed-off-by: Pavithra Barithaya <pavithrabarithaya07@gmail.com>
diff --git a/test/test_scheduled_host_transition.cpp b/test/test_scheduled_host_transition.cpp
index 74d43aa..4807a8f 100644
--- a/test/test_scheduled_host_transition.cpp
+++ b/test/test_scheduled_host_transition.cpp
@@ -36,9 +36,9 @@
// Empty
}
- seconds getCurrentTime()
+ static seconds getCurrentTime()
{
- return scheduledHostTransition.getTime();
+ return ScheduledHostTransition::getTime();
}
bool isTimerEnabled()
@@ -60,18 +60,20 @@
TEST_F(TestScheduledHostTransition, invalidScheduledTime)
{
+ seconds currentTime = getCurrentTime();
// scheduled time is 1 min earlier than current time
uint64_t schTime =
- static_cast<uint64_t>((getCurrentTime() - seconds(60)).count());
+ static_cast<uint64_t>((currentTime - seconds(60)).count());
EXPECT_THROW(scheduledHostTransition.scheduledTime(schTime),
InvalidTimeError);
}
TEST_F(TestScheduledHostTransition, validScheduledTime)
{
+ seconds currentTime = getCurrentTime();
// scheduled time is 1 min later than current time
uint64_t schTime =
- static_cast<uint64_t>((getCurrentTime() + seconds(60)).count());
+ static_cast<uint64_t>((currentTime + seconds(60)).count());
EXPECT_EQ(scheduledHostTransition.scheduledTime(schTime), schTime);
EXPECT_TRUE(isTimerEnabled());
}
@@ -99,9 +101,10 @@
TEST_F(TestScheduledHostTransition, bmcTimeChangeBackward)
{
+ seconds currentTime = getCurrentTime();
// Current time is earlier than scheduled time due to BMC time changing
uint64_t schTime =
- static_cast<uint64_t>((getCurrentTime() + seconds(60)).count());
+ static_cast<uint64_t>((currentTime + seconds(60)).count());
// Set scheduled time, which is the same as bmc time is changed.
// But can't use this method to write another case like
// bmcTimeChangeForward, because set a scheduled time earlier than current