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/dbus/dbusactiveread.cpp b/dbus/dbusactiveread.cpp
index 37a1f93..c444ad2 100644
--- a/dbus/dbusactiveread.cpp
+++ b/dbus/dbusactiveread.cpp
@@ -27,7 +27,7 @@
struct SensorProperties settings;
double value;
- _helper->GetProperties(_bus, _service, _path, &settings);
+ _helper->getProperties(_bus, _service, _path, &settings);
value = settings.value * pow(10, settings.scale);
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index a43b024..375960f 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -24,7 +24,7 @@
#include <sdbusplus/bus.hpp>
#include <string>
-std::unique_ptr<ReadInterface> DbusPassive::CreateDbusPassive(
+std::unique_ptr<ReadInterface> DbusPassive::createDbusPassive(
sdbusplus::bus::bus& bus, const std::string& type, const std::string& id,
DbusHelperInterface* helper)
{
@@ -50,15 +50,15 @@
auto tempBus = sdbusplus::bus::new_default();
/* service == busname */
std::string path = GetSensorPath(type, id);
- std::string service = _helper->GetService(tempBus, sensorintf, path);
+ std::string service = _helper->getService(tempBus, sensorintf, path);
struct SensorProperties settings;
- _helper->GetProperties(tempBus, service, path, &settings);
+ _helper->getProperties(tempBus, service, path, &settings);
_scale = settings.scale;
_value = settings.value * pow(10, _scale);
_updated = std::chrono::high_resolution_clock::now();
- _failed = _helper->ThresholdsAsserted(tempBus, service, path);
+ _failed = _helper->thresholdsAsserted(tempBus, service, path);
}
ReadReturn DbusPassive::read(void)
@@ -93,7 +93,7 @@
return _scale;
}
-std::string DbusPassive::getId(void)
+std::string DbusPassive::getID(void)
{
return _id;
}
diff --git a/dbus/dbuspassive.hpp b/dbus/dbuspassive.hpp
index 71ef339..801722d 100644
--- a/dbus/dbuspassive.hpp
+++ b/dbus/dbuspassive.hpp
@@ -34,7 +34,7 @@
{
public:
static std::unique_ptr<ReadInterface>
- CreateDbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
+ createDbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
const std::string& id, DbusHelperInterface* helper);
DbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
@@ -46,7 +46,7 @@
void setValue(double value);
void setFailed(bool value);
int64_t getScale(void);
- std::string getId(void);
+ std::string getID(void);
private:
sdbusplus::bus::bus& _bus;
diff --git a/dbus/dbuswrite.hpp b/dbus/dbuswrite.hpp
index 6a70fe9..4c5bc29 100644
--- a/dbus/dbuswrite.hpp
+++ b/dbus/dbuswrite.hpp
@@ -33,7 +33,7 @@
path(path)
{
auto tempBus = sdbusplus::bus::new_default();
- connectionName = helper.GetService(tempBus, pwmInterface, path);
+ connectionName = helper.getService(tempBus, pwmInterface, path);
}
void write(double value) override;
@@ -53,7 +53,7 @@
path(path)
{
auto tempBus = sdbusplus::bus::new_default();
- connectionName = helper.GetService(tempBus, pwmInterface, path);
+ connectionName = helper.getService(tempBus, pwmInterface, path);
}
void write(double value) override;
diff --git a/dbus/util.cpp b/dbus/util.cpp
index cdc4bb9..d39f176 100644
--- a/dbus/util.cpp
+++ b/dbus/util.cpp
@@ -11,7 +11,7 @@
/* TODO(venture): Basically all phosphor apps need this, maybe it should be a
* part of sdbusplus. There is an old version in libmapper.
*/
-std::string DbusHelper::GetService(sdbusplus::bus::bus& bus,
+std::string DbusHelper::getService(sdbusplus::bus::bus& bus,
const std::string& intf,
const std::string& path)
{
@@ -40,7 +40,7 @@
return response.begin()->first;
}
-void DbusHelper::GetProperties(sdbusplus::bus::bus& bus,
+void DbusHelper::getProperties(sdbusplus::bus::bus& bus,
const std::string& service,
const std::string& path,
struct SensorProperties* prop)
@@ -90,7 +90,7 @@
return;
}
-bool DbusHelper::ThresholdsAsserted(sdbusplus::bus::bus& bus,
+bool DbusHelper::thresholdsAsserted(sdbusplus::bus::bus& bus,
const std::string& service,
const std::string& path)
{
diff --git a/dbus/util.hpp b/dbus/util.hpp
index ed7a411..41a0af1 100644
--- a/dbus/util.hpp
+++ b/dbus/util.hpp
@@ -28,7 +28,7 @@
/** @brief Get the service providing the interface for the path.
*/
- virtual std::string GetService(sdbusplus::bus::bus& bus,
+ virtual std::string getService(sdbusplus::bus::bus& bus,
const std::string& intf,
const std::string& path) = 0;
@@ -39,7 +39,7 @@
* @param[in] path - The dbus path.
* @param[out] prop - A pointer to a properties struct to fill out.
*/
- virtual void GetProperties(sdbusplus::bus::bus& bus,
+ virtual void getProperties(sdbusplus::bus::bus& bus,
const std::string& service,
const std::string& path,
struct SensorProperties* prop) = 0;
@@ -50,7 +50,7 @@
* @param[in] service - The service providing the interface.
* @param[in] path - The dbus path.
*/
- virtual bool ThresholdsAsserted(sdbusplus::bus::bus& bus,
+ virtual bool thresholdsAsserted(sdbusplus::bus::bus& bus,
const std::string& service,
const std::string& path) = 0;
};
@@ -65,14 +65,14 @@
DbusHelper(DbusHelper&&) = default;
DbusHelper& operator=(DbusHelper&&) = default;
- std::string GetService(sdbusplus::bus::bus& bus, const std::string& intf,
+ std::string getService(sdbusplus::bus::bus& bus, const std::string& intf,
const std::string& path) override;
- void GetProperties(sdbusplus::bus::bus& bus, const std::string& service,
+ void getProperties(sdbusplus::bus::bus& bus, const std::string& service,
const std::string& path,
struct SensorProperties* prop) override;
- bool ThresholdsAsserted(sdbusplus::bus::bus& bus,
+ bool thresholdsAsserted(sdbusplus::bus::bus& bus,
const std::string& service,
const std::string& path) override;
};
diff --git a/pid/builder.cpp b/pid/builder.cpp
index fece41b..7b67795 100644
--- a/pid/builder.cpp
+++ b/pid/builder.cpp
@@ -90,7 +90,7 @@
zone->addFanInput(i);
}
- auto pid = FanController::CreateFanPid(zone.get(), name, inputs,
+ auto pid = FanController::createFanPid(zone.get(), name, inputs,
info->pidInfo);
zone->addFanPID(std::move(pid));
}
@@ -102,7 +102,7 @@
zone->addThermalInput(i);
}
- auto pid = ThermalController::CreateThermalPid(
+ auto pid = ThermalController::createThermalPid(
zone.get(), name, inputs, info->setpoint, info->pidInfo);
zone->addThermalPID(std::move(pid));
@@ -114,7 +114,7 @@
inputs.push_back(i);
zone->addThermalInput(i);
}
- auto stepwise = StepwiseController::CreateStepwiseController(
+ auto stepwise = StepwiseController::createStepwiseController(
zone.get(), name, inputs, info->stepwiseInfo);
zone->addThermalPID(std::move(stepwise));
}
diff --git a/pid/controller.hpp b/pid/controller.hpp
index f52c412..bf79937 100644
--- a/pid/controller.hpp
+++ b/pid/controller.hpp
@@ -7,7 +7,7 @@
/*
* Base class for controllers. Each controller that implements this needs to
- * provide an input_proc, process, and output_proc.
+ * provide an inputProc, process, and outputProc.
*/
class ZoneInterface;
@@ -15,11 +15,11 @@
{
virtual ~Controller() = default;
- virtual float input_proc(void) = 0;
+ virtual float inputProc(void) = 0;
- virtual void output_proc(float value) = 0;
+ virtual void outputProc(float value) = 0;
virtual void process(void) = 0;
- virtual std::string get_id(void) = 0;
+ virtual std::string getID(void) = 0;
};
diff --git a/pid/fancontroller.cpp b/pid/fancontroller.cpp
index f622698..3a56f95 100644
--- a/pid/fancontroller.cpp
+++ b/pid/fancontroller.cpp
@@ -23,7 +23,7 @@
#include <iostream>
std::unique_ptr<PIDController>
- FanController::CreateFanPid(ZoneInterface* owner, const std::string& id,
+ FanController::createFanPid(ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs,
const ec::pidinfo& initial)
{
@@ -32,14 +32,14 @@
return nullptr;
}
auto fan = std::make_unique<FanController>(id, inputs, owner);
- ec::pid_info_t* info = fan->get_pid_info();
+ ec::pid_info_t* info = fan->getPIDInfo();
InitializePIDStruct(info, initial);
return fan;
}
-float FanController::input_proc(void)
+float FanController::inputProc(void)
{
double value = 0;
std::vector<int64_t> values;
@@ -66,7 +66,7 @@
}
catch (const std::exception& e)
{
- std::cerr << "exception on input_proc.\n";
+ std::cerr << "exception on inputProc.\n";
throw;
}
@@ -85,12 +85,12 @@
return static_cast<float>(value);
}
-float FanController::setpt_proc(void)
+float FanController::setptProc(void)
{
float maxRPM = _owner->getMaxRPMRequest();
// store for reference, and check if more or less.
- float prev = get_setpoint();
+ float prev = getSetpoint();
if (maxRPM > prev)
{
@@ -105,12 +105,12 @@
setFanDirection(FanSpeedDirection::NEUTRAL);
}
- set_setpoint(maxRPM);
+ setSetpoint(maxRPM);
return (maxRPM);
}
-void FanController::output_proc(float value)
+void FanController::outputProc(float value)
{
float percent = value;
diff --git a/pid/fancontroller.hpp b/pid/fancontroller.hpp
index e0e79e7..821c900 100644
--- a/pid/fancontroller.hpp
+++ b/pid/fancontroller.hpp
@@ -17,7 +17,7 @@
{
public:
static std::unique_ptr<PIDController>
- CreateFanPid(ZoneInterface* owner, const std::string& id,
+ createFanPid(ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs,
const ec::pidinfo& initial);
@@ -28,9 +28,9 @@
{
}
- float input_proc(void) override;
- float setpt_proc(void) override;
- void output_proc(float value) override;
+ float inputProc(void) override;
+ float setptProc(void) override;
+ void outputProc(float value) override;
FanSpeedDirection getFanDirection(void) const
{
diff --git a/pid/pidcontroller.cpp b/pid/pidcontroller.cpp
index 524b0ef..cbe2452 100644
--- a/pid/pidcontroller.cpp
+++ b/pid/pidcontroller.cpp
@@ -33,16 +33,16 @@
float output;
// Get setpt value
- setpt = setpt_proc();
+ setpt = setptProc();
// Get input value
- input = input_proc();
+ input = inputProc();
// Calculate new output
- output = ec::pid(get_pid_info(), input, setpt);
+ output = ec::pid(getPIDInfo(), input, setpt);
// Output new value
- output_proc(output);
+ outputProc(output);
return;
}
diff --git a/pid/pidcontroller.hpp b/pid/pidcontroller.hpp
index 18a448e..9c3ee7f 100644
--- a/pid/pidcontroller.hpp
+++ b/pid/pidcontroller.hpp
@@ -11,7 +11,7 @@
/*
* Base class for PID controllers. Each PID that implements this needs to
- * provide an input_proc, setpt_proc, and output_proc.
+ * provide an inputProc, setptProc, and outputProc.
*/
class PIDController : public Controller
{
@@ -25,26 +25,26 @@
{
}
- virtual float input_proc(void) = 0;
- virtual float setpt_proc(void) = 0;
- virtual void output_proc(float value) = 0;
+ virtual float inputProc(void) = 0;
+ virtual float setptProc(void) = 0;
+ virtual void outputProc(float value) = 0;
void process(void);
- std::string get_id(void)
+ std::string getID(void)
{
return _id;
}
- float get_setpoint(void)
+ float getSetpoint(void)
{
return _setpoint;
}
- void set_setpoint(float setpoint)
+ void setSetpoint(float setpoint)
{
_setpoint = setpoint;
}
- ec::pid_info_t* get_pid_info(void)
+ ec::pid_info_t* getPIDInfo(void)
{
return &_pid_info;
}
diff --git a/pid/pidthread.cpp b/pid/pidthread.cpp
index 4dfc22a..dc53bdb 100644
--- a/pid/pidthread.cpp
+++ b/pid/pidthread.cpp
@@ -32,7 +32,7 @@
// Zero out the RPM set point goals.
zone->clearRPMSetPoints();
// Run the margin PIDs.
- zone->process_thermals();
+ zone->processThermals();
// Get the maximum RPM set-point.
zone->determineMaxRPMRequest();
}
@@ -60,7 +60,7 @@
* will happen.
*
* TODO(venture): If the fan value is 0 should that loop just be skipped?
- * Right now, a 0 value is ignored in FanController::input_proc()
+ * Right now, a 0 value is ignored in FanController::inputProc()
*/
#ifdef __TUNING_LOGGING__
zone->initializeLog();
@@ -90,7 +90,7 @@
}
// Run the fan PIDs every iteration.
- zone->process_fans();
+ zone->processFans();
#ifdef __TUNING_LOGGING__
zone->getLogHandle() << "," << zone->getFailSafeMode();
diff --git a/pid/stepwisecontroller.cpp b/pid/stepwisecontroller.cpp
index 1e6c301..875a470 100644
--- a/pid/stepwisecontroller.cpp
+++ b/pid/stepwisecontroller.cpp
@@ -32,7 +32,7 @@
void StepwiseController::process(void)
{
// Get input value
- float input = input_proc();
+ float input = inputProc();
ec::StepwiseInfo info = get_stepwise_info();
@@ -57,12 +57,12 @@
lastOutput = output;
// Output new value
- output_proc(output);
+ outputProc(output);
return;
}
-std::unique_ptr<Controller> StepwiseController::CreateStepwiseController(
+std::unique_ptr<Controller> StepwiseController::createStepwiseController(
ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs, const ec::StepwiseInfo& initial)
{
@@ -81,13 +81,13 @@
return thermal;
}
-float StepwiseController::input_proc(void)
+float StepwiseController::inputProc(void)
{
double value = _owner->getCachedValue(_inputs.at(0));
return static_cast<float>(value);
}
-void StepwiseController::output_proc(float value)
+void StepwiseController::outputProc(float value)
{
_owner->addRPMSetPoint(value);
diff --git a/pid/stepwisecontroller.hpp b/pid/stepwisecontroller.hpp
index a6b7816..f369397 100644
--- a/pid/stepwisecontroller.hpp
+++ b/pid/stepwisecontroller.hpp
@@ -14,7 +14,7 @@
{
public:
static std::unique_ptr<Controller>
- CreateStepwiseController(ZoneInterface* owner, const std::string& id,
+ createStepwiseController(ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs,
const ec::StepwiseInfo& initial);
@@ -26,13 +26,13 @@
{
}
- float input_proc(void) override;
+ float inputProc(void) override;
- void output_proc(float value) override;
+ void outputProc(float value) override;
void process(void) override;
- std::string get_id(void)
+ std::string getID(void)
{
return _id;
}
diff --git a/pid/thermalcontroller.cpp b/pid/thermalcontroller.cpp
index f9d1e11..cc6c1f9 100644
--- a/pid/thermalcontroller.cpp
+++ b/pid/thermalcontroller.cpp
@@ -19,7 +19,7 @@
#include "util.hpp"
#include "zone.hpp"
-std::unique_ptr<PIDController> ThermalController::CreateThermalPid(
+std::unique_ptr<PIDController> ThermalController::createThermalPid(
ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs, float setpoint,
const ec::pidinfo& initial)
@@ -32,8 +32,8 @@
auto thermal = std::make_unique<ThermalController>(id, inputs, owner);
- ec::pid_info_t* info = thermal->get_pid_info();
- thermal->set_setpoint(setpoint);
+ ec::pid_info_t* info = thermal->getPIDInfo();
+ thermal->setSetpoint(setpoint);
InitializePIDStruct(info, initial);
@@ -41,7 +41,7 @@
}
// bmc_host_sensor_value_float
-float ThermalController::input_proc(void)
+float ThermalController::inputProc(void)
{
/*
* This only supports one thermal input because it doesn't yet know how to
@@ -52,9 +52,9 @@
}
// bmc_get_setpt
-float ThermalController::setpt_proc(void)
+float ThermalController::setptProc(void)
{
- float setpoint = get_setpoint();
+ float setpoint = getSetpoint();
/* TODO(venture): Thermal setpoint invalid? */
#if 0
@@ -71,7 +71,7 @@
}
// bmc_set_pid_output
-void ThermalController::output_proc(float value)
+void ThermalController::outputProc(float value)
{
_owner->addRPMSetPoint(value);
diff --git a/pid/thermalcontroller.hpp b/pid/thermalcontroller.hpp
index 9b2da71..040b222 100644
--- a/pid/thermalcontroller.hpp
+++ b/pid/thermalcontroller.hpp
@@ -15,7 +15,7 @@
{
public:
static std::unique_ptr<PIDController>
- CreateThermalPid(ZoneInterface* owner, const std::string& id,
+ createThermalPid(ZoneInterface* owner, const std::string& id,
const std::vector<std::string>& inputs, float setpoint,
const ec::pidinfo& initial);
@@ -27,9 +27,9 @@
{
}
- float input_proc(void) override;
- float setpt_proc(void) override;
- void output_proc(float value) override;
+ float inputProc(void) override;
+ float setptProc(void) override;
+ void outputProc(float value) override;
private:
std::vector<std::string> _inputs;
diff --git a/pid/zone.cpp b/pid/zone.cpp
index ab5cc8c..2af3307 100644
--- a/pid/zone.cpp
+++ b/pid/zone.cpp
@@ -246,7 +246,7 @@
{
auto sensor = _mgr.getSensor(t);
ReadReturn r = sensor->read();
- int64_t timeout = sensor->GetTimeout();
+ int64_t timeout = sensor->getTimeout();
_cachedValuesByName[t] = r.value;
tstamp then = r.updated;
@@ -308,7 +308,7 @@
}
}
-void PIDZone::process_fans(void)
+void PIDZone::processFans(void)
{
for (auto& p : _fans)
{
@@ -316,7 +316,7 @@
}
}
-void PIDZone::process_thermals(void)
+void PIDZone::processThermals(void)
{
for (auto& p : _thermals)
{
diff --git a/pid/zone.hpp b/pid/zone.hpp
index 6d5f6cc..d2da92c 100644
--- a/pid/zone.hpp
+++ b/pid/zone.hpp
@@ -74,8 +74,8 @@
void updateSensors(void);
void initializeCache(void);
void dumpCache(void);
- void process_fans(void);
- void process_thermals(void);
+ void processFans(void);
+ void processThermals(void);
void addFanPID(std::unique_ptr<Controller> pid);
void addThermalPID(std::unique_ptr<Controller> pid);
diff --git a/sensors/builder.cpp b/sensors/builder.cpp
index a43a731..2d8154a 100644
--- a/sensors/builder.cpp
+++ b/sensors/builder.cpp
@@ -66,7 +66,7 @@
switch (rtype)
{
case IOInterfaceType::DBUSPASSIVE:
- ri = DbusPassive::CreateDbusPassive(PassiveListeningBus,
+ ri = DbusPassive::createDbusPassive(PassiveListeningBus,
info->type, name, &helper);
/* TODO(venture): if this returns nullptr */
break;
@@ -135,7 +135,7 @@
* The reason we handle this as a HostSensor is because it's
* not quite pluggable; but maybe it could be.
*/
- auto sensor = HostSensor::CreateTemp(
+ auto sensor = HostSensor::createTemp(
name, info->timeout, HostSensorBus, info->readpath.c_str(),
deferSignals);
mgmr.addSensor(info->type, name, std::move(sensor));
diff --git a/sensors/host.cpp b/sensors/host.cpp
index 30addd5..951c0ca 100644
--- a/sensors/host.cpp
+++ b/sensors/host.cpp
@@ -21,7 +21,7 @@
#include <memory>
#include <mutex>
-std::unique_ptr<Sensor> HostSensor::CreateTemp(const std::string& name,
+std::unique_ptr<Sensor> HostSensor::createTemp(const std::string& name,
int64_t timeout,
sdbusplus::bus::bus& bus,
const char* objPath, bool defer)
diff --git a/sensors/host.hpp b/sensors/host.hpp
index ad3f834..e940469 100644
--- a/sensors/host.hpp
+++ b/sensors/host.hpp
@@ -21,7 +21,7 @@
class HostSensor : public Sensor, public ValueObject
{
public:
- static std::unique_ptr<Sensor> CreateTemp(const std::string& name,
+ static std::unique_ptr<Sensor> createTemp(const std::string& name,
int64_t timeout,
sdbusplus::bus::bus& bus,
const char* objPath, bool defer);
diff --git a/sensors/sensor.hpp b/sensors/sensor.hpp
index 1f13e3a..6df5aa2 100644
--- a/sensors/sensor.hpp
+++ b/sensors/sensor.hpp
@@ -27,7 +27,7 @@
return false;
};
- std::string GetName(void) const
+ std::string getName(void) const
{
return _name;
}
@@ -35,7 +35,7 @@
/* Returns the configurable timeout period
* for this sensor in seconds (undecorated).
*/
- int64_t GetTimeout(void) const
+ int64_t getTimeout(void) const
{
return _timeout;
}
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());