style: member functions should be lower camel
Rename member functions to be lower camel instead of snake case.
Change-Id: Ib227fd3dadb6d9607290277205223a4324cd4ce5
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/test/controller_mock.hpp b/test/controller_mock.hpp
index 38d0446..c0af859 100644
--- a/test/controller_mock.hpp
+++ b/test/controller_mock.hpp
@@ -14,7 +14,7 @@
{
}
- MOCK_METHOD0(input_proc, float());
- MOCK_METHOD0(setpt_proc, float());
- MOCK_METHOD1(output_proc, void(float));
+ MOCK_METHOD0(inputProc, float());
+ MOCK_METHOD0(setptProc, float());
+ MOCK_METHOD1(outputProc, void(float));
};
diff --git a/test/dbus_active_unittest.cpp b/test/dbus_active_unittest.cpp
index 5a7bcfe..e6dcc9d 100644
--- a/test/dbus_active_unittest.cpp
+++ b/test/dbus_active_unittest.cpp
@@ -36,7 +36,7 @@
DbusActiveRead ar(bus_mock, path, service, &helper);
- EXPECT_CALL(helper, GetProperties(_, service, path, NotNull()))
+ EXPECT_CALL(helper, getProperties(_, service, path, NotNull()))
.WillOnce(
Invoke([&](sdbusplus::bus::bus& bus, const std::string& service,
const std::string& path, struct SensorProperties* prop) {
@@ -49,5 +49,5 @@
EXPECT_EQ(10, r.value);
}
-// WARN: GetProperties will raise an exception on failure
+// WARN: getProperties will raise an exception on failure
// Instead of just not updating the value.
diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp
index 43f5cc6..777a623 100644
--- a/test/dbus_passive_unittest.cpp
+++ b/test/dbus_passive_unittest.cpp
@@ -29,7 +29,7 @@
DbusHelperMock helper;
std::unique_ptr<ReadInterface> ri =
- DbusPassive::CreateDbusPassive(bus_mock, type, id, &helper);
+ DbusPassive::createDbusPassive(bus_mock, type, id, &helper);
EXPECT_EQ(ri, nullptr);
}
@@ -46,10 +46,10 @@
std::string path = "/xyz/openbmc_project/sensors/unknown/id";
DbusHelperMock helper;
- EXPECT_CALL(helper, GetService(_, StrEq(SensorIntf), StrEq(path)))
+ EXPECT_CALL(helper, getService(_, StrEq(SensorIntf), StrEq(path)))
.WillOnce(Return("asdf"));
- EXPECT_CALL(helper, GetProperties(_, StrEq("asdf"), StrEq(path), NotNull()))
+ EXPECT_CALL(helper, getProperties(_, StrEq("asdf"), StrEq(path), NotNull()))
.WillOnce(
Invoke([&](sdbusplus::bus::bus& bus, const std::string& service,
const std::string& path, struct SensorProperties* prop) {
@@ -57,7 +57,7 @@
prop->value = 10;
prop->unit = "x";
}));
- EXPECT_CALL(helper, ThresholdsAsserted(_, StrEq("asdf"), StrEq(path)))
+ EXPECT_CALL(helper, thresholdsAsserted(_, StrEq("asdf"), StrEq(path)))
.WillOnce(Return(false));
DbusPassive(bus_mock, type, id, &helper);
@@ -71,11 +71,11 @@
sdbus_mock(),
bus_mock(std::move(sdbusplus::get_mocked_new(&sdbus_mock))), helper()
{
- EXPECT_CALL(helper, GetService(_, StrEq(SensorIntf), StrEq(path)))
+ EXPECT_CALL(helper, getService(_, StrEq(SensorIntf), StrEq(path)))
.WillOnce(Return("asdf"));
EXPECT_CALL(helper,
- GetProperties(_, StrEq("asdf"), StrEq(path), NotNull()))
+ getProperties(_, StrEq("asdf"), StrEq(path), NotNull()))
.WillOnce(Invoke(
[&](sdbusplus::bus::bus& bus, const std::string& service,
const std::string& path, struct SensorProperties* prop) {
@@ -83,10 +83,10 @@
prop->value = _value;
prop->unit = "x";
}));
- EXPECT_CALL(helper, ThresholdsAsserted(_, StrEq("asdf"), StrEq(path)))
+ EXPECT_CALL(helper, thresholdsAsserted(_, StrEq("asdf"), StrEq(path)))
.WillOnce(Return(false));
- ri = DbusPassive::CreateDbusPassive(bus_mock, type, id, &helper);
+ ri = DbusPassive::createDbusPassive(bus_mock, type, id, &helper);
passive = reinterpret_cast<DbusPassive*>(ri.get());
EXPECT_FALSE(passive == nullptr);
}
@@ -133,10 +133,10 @@
EXPECT_EQ(_scale, passive->getScale());
}
-TEST_F(DbusPassiveTestObj, GetIdReturnsExpectedValue)
+TEST_F(DbusPassiveTestObj, getIDReturnsExpectedValue)
{
- // Verify getId returns the expected value.
- EXPECT_EQ(id, passive->getId());
+ // Verify getID returns the expected value.
+ EXPECT_EQ(id, passive->getID());
}
TEST_F(DbusPassiveTestObj, VerifyHandlesDbusSignal)
@@ -425,4 +425,4 @@
EXPECT_EQ(rv, 0); // It's always 0.
bool failed = passive->getFailed();
EXPECT_EQ(failed, false);
-}
\ No newline at end of file
+}
diff --git a/test/dbushelper_mock.hpp b/test/dbushelper_mock.hpp
index d7dbcbb..e373f8a 100644
--- a/test/dbushelper_mock.hpp
+++ b/test/dbushelper_mock.hpp
@@ -12,14 +12,14 @@
public:
virtual ~DbusHelperMock() = default;
- MOCK_METHOD3(GetService,
+ MOCK_METHOD3(getService,
std::string(sdbusplus::bus::bus&, const std::string&,
const std::string&));
- MOCK_METHOD4(GetProperties,
+ MOCK_METHOD4(getProperties,
void(sdbusplus::bus::bus&, const std::string&,
const std::string&, struct SensorProperties*));
- MOCK_METHOD3(ThresholdsAsserted,
+ MOCK_METHOD3(thresholdsAsserted,
bool(sdbusplus::bus::bus& bus, const std::string& service,
const std::string& path));
};
diff --git a/test/pid_fancontroller_unittest.cpp b/test/pid_fancontroller_unittest.cpp
index 17291f9..57932c9 100644
--- a/test/pid_fancontroller_unittest.cpp
+++ b/test/pid_fancontroller_unittest.cpp
@@ -25,7 +25,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
// Success
EXPECT_FALSE(p == nullptr);
}
@@ -40,7 +40,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_TRUE(p == nullptr);
}
@@ -54,13 +54,13 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getCachedValue(StrEq("fan0"))).WillOnce(Return(0));
EXPECT_CALL(z, getCachedValue(StrEq("fan1"))).WillOnce(Return(0));
- EXPECT_EQ(0.0, p->input_proc());
+ EXPECT_EQ(0.0, p->inputProc());
}
TEST(FanControllerTest, InputProc_IfSensorNegativeIsIgnored)
@@ -72,13 +72,13 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getCachedValue(StrEq("fan0"))).WillOnce(Return(-1));
EXPECT_CALL(z, getCachedValue(StrEq("fan1"))).WillOnce(Return(-1));
- EXPECT_EQ(0.0, p->input_proc());
+ EXPECT_EQ(0.0, p->inputProc());
}
TEST(FanControllerTest, InputProc_ChoosesMinimumValue)
@@ -91,14 +91,14 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getCachedValue(StrEq("fan0"))).WillOnce(Return(10.0));
EXPECT_CALL(z, getCachedValue(StrEq("fan1"))).WillOnce(Return(30.0));
EXPECT_CALL(z, getCachedValue(StrEq("fan2"))).WillOnce(Return(5.0));
- EXPECT_EQ(5.0, p->input_proc());
+ EXPECT_EQ(5.0, p->inputProc());
}
// The direction is unused presently, but these tests validate the logic.
@@ -114,7 +114,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
// Grab pointer for mocking.
FanController* fp = reinterpret_cast<FanController*>(p.get());
@@ -125,19 +125,19 @@
// getMaxRPMRequest returns a higher value than 0, so the fans should be
// marked as speeding up.
EXPECT_CALL(z, getMaxRPMRequest()).WillOnce(Return(10.0));
- EXPECT_EQ(10.0, p->setpt_proc());
+ EXPECT_EQ(10.0, p->setptProc());
EXPECT_EQ(FanSpeedDirection::UP, fp->getFanDirection());
// getMaxRPMRequest returns a lower value than 10, so the fans should be
// marked as slowing down.
EXPECT_CALL(z, getMaxRPMRequest()).WillOnce(Return(5.0));
- EXPECT_EQ(5.0, p->setpt_proc());
+ EXPECT_EQ(5.0, p->setptProc());
EXPECT_EQ(FanSpeedDirection::DOWN, fp->getFanDirection());
// getMaxRPMRequest returns the same value, so the fans should be marked as
// neutral.
EXPECT_CALL(z, getMaxRPMRequest()).WillOnce(Return(5.0));
- EXPECT_EQ(5.0, p->setpt_proc());
+ EXPECT_EQ(5.0, p->setptProc());
EXPECT_EQ(FanSpeedDirection::NEUTRAL, fp->getFanDirection());
}
@@ -153,7 +153,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getFailSafeMode()).WillOnce(Return(true));
@@ -171,18 +171,18 @@
EXPECT_CALL(z, getSensor(StrEq("fan1"))).WillOnce(Return(s2.get()));
EXPECT_CALL(*sm2, write(0.75));
- // This is a fan PID, so calling output_proc will try to write this value
+ // This is a fan PID, so calling outputProc will try to write this value
// to the sensors.
// Setting 50%, will end up being 75% because the sensors are in failsafe
// mode.
- p->output_proc(50.0);
+ p->outputProc(50.0);
}
TEST(FanControllerTest, OutputProc_BehavesAsExpected)
{
// Verifies that when the system is not in failsafe mode, the input value
- // to output_proc is used to drive the sensors (fans).
+ // to outputProc is used to drive the sensors (fans).
ZoneMock z;
@@ -190,7 +190,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getFailSafeMode()).WillOnce(Return(false));
@@ -207,15 +207,15 @@
EXPECT_CALL(z, getSensor(StrEq("fan1"))).WillOnce(Return(s2.get()));
EXPECT_CALL(*sm2, write(0.5));
- // This is a fan PID, so calling output_proc will try to write this value
+ // This is a fan PID, so calling outputProc will try to write this value
// to the sensors.
- p->output_proc(50.0);
+ p->outputProc(50.0);
}
TEST(FanControllerTest, OutputProc_VerifyFailSafeIgnoredIfInputHigher)
{
// If the requested output is higher than the failsafe value, then use the
- // value provided to output_proc.
+ // value provided to outputProc.
ZoneMock z;
@@ -223,7 +223,7 @@
ec::pidinfo initial;
std::unique_ptr<PIDController> p =
- FanController::CreateFanPid(&z, "fan1", inputs, initial);
+ FanController::createFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getFailSafeMode()).WillOnce(Return(true));
@@ -241,7 +241,7 @@
EXPECT_CALL(z, getSensor(StrEq("fan0"))).WillOnce(Return(s1.get()));
EXPECT_CALL(*sm1, write(value));
- // This is a fan PID, so calling output_proc will try to write this value
+ // This is a fan PID, so calling outputProc will try to write this value
// to the sensors.
- p->output_proc(percent);
+ p->outputProc(percent);
}
diff --git a/test/pid_stepwisecontroller_unittest.cpp b/test/pid_stepwisecontroller_unittest.cpp
index 45d1b81..880864d 100644
--- a/test/pid_stepwisecontroller_unittest.cpp
+++ b/test/pid_stepwisecontroller_unittest.cpp
@@ -29,7 +29,7 @@
initial.output[1] = 60.0;
std::unique_ptr<Controller> p =
- StepwiseController::CreateStepwiseController(&z, "foo", inputs,
+ StepwiseController::createStepwiseController(&z, "foo", inputs,
initial);
EXPECT_CALL(z, getCachedValue(StrEq("test")))
@@ -64,7 +64,7 @@
initial.output[1] = 60.0;
std::unique_ptr<Controller> p =
- StepwiseController::CreateStepwiseController(&z, "foo", inputs,
+ StepwiseController::createStepwiseController(&z, "foo", inputs,
initial);
EXPECT_CALL(z, getCachedValue(StrEq("test")))
diff --git a/test/pid_thermalcontroller_unittest.cpp b/test/pid_thermalcontroller_unittest.cpp
index 386c779..97550f8 100644
--- a/test/pid_thermalcontroller_unittest.cpp
+++ b/test/pid_thermalcontroller_unittest.cpp
@@ -22,7 +22,7 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
// Success
EXPECT_FALSE(p == nullptr);
@@ -38,7 +38,7 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
EXPECT_TRUE(p == nullptr);
}
@@ -54,14 +54,14 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
EXPECT_TRUE(p == nullptr);
}
TEST(ThermalControllerTest, InputProc_BehavesAsExpected)
{
- // This test just verifies input_proc behaves as expected.
+ // This test just verifies inputProc behaves as expected.
ZoneMock z;
@@ -69,18 +69,18 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
EXPECT_FALSE(p == nullptr);
EXPECT_CALL(z, getCachedValue(StrEq("fleeting0"))).WillOnce(Return(5.0));
- EXPECT_EQ(5.0, p->input_proc());
+ EXPECT_EQ(5.0, p->inputProc());
}
TEST(ThermalControllerTest, SetPtProc_BehavesAsExpected)
{
- // This test just verifies input_proc behaves as expected.
+ // This test just verifies inputProc behaves as expected.
ZoneMock z;
@@ -88,16 +88,16 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
EXPECT_FALSE(p == nullptr);
- EXPECT_EQ(setpoint, p->setpt_proc());
+ EXPECT_EQ(setpoint, p->setptProc());
}
TEST(ThermalControllerTest, OutputProc_BehavesAsExpected)
{
- // This test just verifies input_proc behaves as expected.
+ // This test just verifies inputProc behaves as expected.
ZoneMock z;
@@ -105,12 +105,12 @@
float setpoint = 10.0;
ec::pidinfo initial;
- std::unique_ptr<PIDController> p = ThermalController::CreateThermalPid(
+ std::unique_ptr<PIDController> p = ThermalController::createThermalPid(
&z, "therm1", inputs, setpoint, initial);
EXPECT_FALSE(p == nullptr);
float value = 90.0;
EXPECT_CALL(z, addRPMSetPoint(value));
- p->output_proc(value);
+ p->outputProc(value);
}
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index 44df7b1..e358296 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -359,18 +359,18 @@
// Access the internal pid configuration to clear it out (unrelated to the
// test).
- ec::pid_info_t* info = tpid->get_pid_info();
+ ec::pid_info_t* info = tpid->getPIDInfo();
std::memset(info, 0x00, sizeof(ec::pid_info_t));
zone->addThermalPID(std::move(tpid));
- EXPECT_CALL(*tmock, setpt_proc()).WillOnce(Return(10.0));
- EXPECT_CALL(*tmock, input_proc()).WillOnce(Return(11.0));
- EXPECT_CALL(*tmock, output_proc(_));
+ EXPECT_CALL(*tmock, setptProc()).WillOnce(Return(10.0));
+ EXPECT_CALL(*tmock, inputProc()).WillOnce(Return(11.0));
+ EXPECT_CALL(*tmock, outputProc(_));
// Method under test will, for each thermal PID, call setpt, input, and
// output.
- zone->process_thermals();
+ zone->processThermals();
}
TEST_F(PidZoneTest, AddFanPIDTest_VerifiesFanPIDsProcessed)
@@ -384,17 +384,17 @@
// Access the internal pid configuration to clear it out (unrelated to the
// test).
- ec::pid_info_t* info = tpid->get_pid_info();
+ ec::pid_info_t* info = tpid->getPIDInfo();
std::memset(info, 0x00, sizeof(ec::pid_info_t));
zone->addFanPID(std::move(tpid));
- EXPECT_CALL(*tmock, setpt_proc()).WillOnce(Return(10.0));
- EXPECT_CALL(*tmock, input_proc()).WillOnce(Return(11.0));
- EXPECT_CALL(*tmock, output_proc(_));
+ EXPECT_CALL(*tmock, setptProc()).WillOnce(Return(10.0));
+ EXPECT_CALL(*tmock, inputProc()).WillOnce(Return(11.0));
+ EXPECT_CALL(*tmock, outputProc(_));
// Method under test will, for each fan PID, call setpt, input, and output.
- zone->process_fans();
+ zone->processFans();
}
TEST_F(PidZoneTest, ManualModeDbusTest_VerifySetManualBehavesAsExpected)
diff --git a/test/sensor_host_unittest.cpp b/test/sensor_host_unittest.cpp
index 1c69a20..6851732 100644
--- a/test/sensor_host_unittest.cpp
+++ b/test/sensor_host_unittest.cpp
@@ -40,7 +40,7 @@
std::vector<std::string> properties = {"Scale"};
int i;
- // The CreateTemp updates all the properties, however, only Scale is set
+ // The createTemp updates all the properties, however, only Scale is set
// to non-default.
SetupDbusObject(&sdbus_mock, defer, objPath, interface, properties, &i);
@@ -50,7 +50,7 @@
.WillOnce(Return(0));
std::unique_ptr<Sensor> s =
- HostSensor::CreateTemp(name, timeout, bus_mock, objPath, defer);
+ HostSensor::createTemp(name, timeout, bus_mock, objPath, defer);
}
TEST(HostSensorTest, VerifyWriteThenReadMatches)
@@ -80,7 +80,7 @@
.WillOnce(Return(0));
std::unique_ptr<Sensor> s =
- HostSensor::CreateTemp(name, timeout, bus_mock, objPath, defer);
+ HostSensor::createTemp(name, timeout, bus_mock, objPath, defer);
// Value is updated from dbus calls only (normally).
HostSensor* hs = static_cast<HostSensor*>(s.get());