summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-09-04 12:30:27 -0700
committerPatrick Venture <venture@google.com>2018-09-04 12:34:16 -0700
commite2ec0f618a9b3b6809a98516abe63d5d833e7fe7 (patch)
treee2edf6757d57726ad5478e12fdc9f66755fa7fff /test
parent991cf8757b1fec8bf7187ed445fa6ab33a9c5b4f (diff)
downloadphosphor-pid-control-e2ec0f618a9b3b6809a98516abe63d5d833e7fe7.tar.gz
phosphor-pid-control-e2ec0f618a9b3b6809a98516abe63d5d833e7fe7.zip
clang-format: fix pointer alignment, sort using
Change-Id: Id433d0ecc10c62807594b3a637e591045223faa6 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/dbus_passive_unittest.cpp44
-rw-r--r--test/helpers.hpp10
-rw-r--r--test/pid_fancontroller_unittest.cpp12
-rw-r--r--test/pid_zone_unittest.cpp30
-rw-r--r--test/sensor_host_unittest.cpp10
-rw-r--r--test/sensor_manager_unittest.cpp2
-rw-r--r--test/sensor_pluggable_unittest.cpp4
7 files changed, 56 insertions, 56 deletions
diff --git a/test/dbus_passive_unittest.cpp b/test/dbus_passive_unittest.cpp
index 6b8cc8e..961b380 100644
--- a/test/dbus_passive_unittest.cpp
+++ b/test/dbus_passive_unittest.cpp
@@ -51,8 +51,8 @@ TEST(DbusPassiveTest, BoringConstructorTest)
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) {
+ Invoke([&](sdbusplus::bus::bus& bus, const std::string& service,
+ const std::string& path, struct SensorProperties* prop) {
prop->scale = -3;
prop->value = 10;
prop->unit = "x";
@@ -75,15 +75,15 @@ class DbusPassiveTestObj : public ::testing::Test
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) {
+ [&](sdbusplus::bus::bus& bus, const std::string& service,
+ const std::string& path, struct SensorProperties* prop) {
prop->scale = _scale;
prop->value = _value;
prop->unit = "x";
}));
ri = DbusPassive::CreateDbusPassive(bus_mock, type, id, &helper);
- passive = reinterpret_cast<DbusPassive *>(ri.get());
+ passive = reinterpret_cast<DbusPassive*>(ri.get());
EXPECT_FALSE(passive == nullptr);
}
@@ -97,7 +97,7 @@ class DbusPassiveTestObj : public ::testing::Test
int64_t _value = 10;
std::unique_ptr<ReadInterface> ri;
- DbusPassive *passive;
+ DbusPassive* passive;
};
TEST_F(DbusPassiveTestObj, ReadReturnsExpectedValues)
@@ -144,21 +144,21 @@ TEST_F(DbusPassiveTestObj, VerifyHandlesDbusSignal)
.WillOnce(Return(nullptr));
sdbusplus::message::message msg(nullptr, &sdbus_mock);
- const char *Value = "Value";
+ const char* Value = "Value";
int64_t xValue = 10000;
- const char *intf = "xyz.openbmc_project.Sensor.Value";
+ const char* intf = "xyz.openbmc_project.Sensor.Value";
// string, std::map<std::string, sdbusplus::message::variant<int64_t>>
// msg.read(msgSensor, msgData);
EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull()))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- const char **s = static_cast<const char **>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ const char** s = static_cast<const char**>(p);
// Read the first parameter, the string.
*s = intf;
return 0;
}))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- const char **s = static_cast<const char **>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ const char** s = static_cast<const char**>(p);
*s = Value;
// Read the string in the pair (dictionary).
return 0;
@@ -187,8 +187,8 @@ TEST_F(DbusPassiveTestObj, VerifyHandlesDbusSignal)
.WillOnce(Return(0));
EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'x', NotNull()))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- int64_t *s = static_cast<int64_t *>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ int64_t* s = static_cast<int64_t*>(p);
*s = xValue;
return 0;
}));
@@ -214,21 +214,21 @@ TEST_F(DbusPassiveTestObj, VerifyIgnoresOtherPropertySignal)
.WillOnce(Return(nullptr));
sdbusplus::message::message msg(nullptr, &sdbus_mock);
- const char *Scale = "Scale";
+ const char* Scale = "Scale";
int64_t xScale = -6;
- const char *intf = "xyz.openbmc_project.Sensor.Value";
+ const char* intf = "xyz.openbmc_project.Sensor.Value";
// string, std::map<std::string, sdbusplus::message::variant<int64_t>>
// msg.read(msgSensor, msgData);
EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 's', NotNull()))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- const char **s = static_cast<const char **>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ const char** s = static_cast<const char**>(p);
// Read the first parameter, the string.
*s = intf;
return 0;
}))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- const char **s = static_cast<const char **>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ const char** s = static_cast<const char**>(p);
*s = Scale;
// Read the string in the pair (dictionary).
return 0;
@@ -257,8 +257,8 @@ TEST_F(DbusPassiveTestObj, VerifyIgnoresOtherPropertySignal)
.WillOnce(Return(0));
EXPECT_CALL(sdbus_mock, sd_bus_message_read_basic(IsNull(), 'x', NotNull()))
- .WillOnce(Invoke([&](sd_bus_message *m, char type, void *p) {
- int64_t *s = static_cast<int64_t *>(p);
+ .WillOnce(Invoke([&](sd_bus_message* m, char type, void* p) {
+ int64_t* s = static_cast<int64_t*>(p);
*s = xScale;
return 0;
}));
diff --git a/test/helpers.hpp b/test/helpers.hpp
index a06eb2e..6952c52 100644
--- a/test/helpers.hpp
+++ b/test/helpers.hpp
@@ -34,9 +34,9 @@ using ::testing::StrEq;
* @param[in] properties - an ordered list of expected property updates.
* @param[in] index - a pointer to a valid integer in a surviving scope.
*/
-void SetupDbusObject(sdbusplus::SdBusMock *sdbus_mock, bool defer,
- const std::string &path, const std::string &intf,
- const std::vector<std::string> &properties, int *index)
+void SetupDbusObject(sdbusplus::SdBusMock* sdbus_mock, bool defer,
+ const std::string& path, const std::string& intf,
+ const std::vector<std::string>& properties, int* index)
{
EXPECT_CALL(*sdbus_mock,
sd_bus_add_object_vtable(IsNull(), NotNull(), StrEq(path),
@@ -57,8 +57,8 @@ void SetupDbusObject(sdbusplus::SdBusMock *sdbus_mock, bool defer,
sd_bus_emit_properties_changed_strv(IsNull(), StrEq(path),
StrEq(intf), NotNull()))
.Times(properties.size())
- .WillRepeatedly(Invoke([=](sd_bus *bus, const char *path,
- const char *interface, char **names) {
+ .WillRepeatedly(Invoke([=](sd_bus* bus, const char* path,
+ const char* interface, char** names) {
EXPECT_STREQ(properties[(*index)++].c_str(), names[0]);
return 0;
}));
diff --git a/test/pid_fancontroller_unittest.cpp b/test/pid_fancontroller_unittest.cpp
index c7b7bc7..17291f9 100644
--- a/test/pid_fancontroller_unittest.cpp
+++ b/test/pid_fancontroller_unittest.cpp
@@ -117,7 +117,7 @@ TEST(FanControllerTest, SetPtProc_SpeedChanges_VerifyDirection)
FanController::CreateFanPid(&z, "fan1", inputs, initial);
EXPECT_FALSE(p == nullptr);
// Grab pointer for mocking.
- FanController *fp = reinterpret_cast<FanController *>(p.get());
+ FanController* fp = reinterpret_cast<FanController*>(p.get());
// Fanspeed starts are Neutral.
EXPECT_EQ(FanSpeedDirection::NEUTRAL, fp->getFanDirection());
@@ -163,8 +163,8 @@ TEST(FanControllerTest, OutputProc_VerifiesIfFailsafeEnabledInputIsIgnored)
std::unique_ptr<Sensor> s1 = std::make_unique<SensorMock>("fan0", timeout);
std::unique_ptr<Sensor> s2 = std::make_unique<SensorMock>("fan1", timeout);
// Grab pointers for mocking.
- SensorMock *sm1 = reinterpret_cast<SensorMock *>(s1.get());
- SensorMock *sm2 = reinterpret_cast<SensorMock *>(s2.get());
+ SensorMock* sm1 = reinterpret_cast<SensorMock*>(s1.get());
+ SensorMock* sm2 = reinterpret_cast<SensorMock*>(s2.get());
EXPECT_CALL(z, getSensor(StrEq("fan0"))).WillOnce(Return(s1.get()));
EXPECT_CALL(*sm1, write(0.75));
@@ -199,8 +199,8 @@ TEST(FanControllerTest, OutputProc_BehavesAsExpected)
std::unique_ptr<Sensor> s1 = std::make_unique<SensorMock>("fan0", timeout);
std::unique_ptr<Sensor> s2 = std::make_unique<SensorMock>("fan1", timeout);
// Grab pointers for mocking.
- SensorMock *sm1 = reinterpret_cast<SensorMock *>(s1.get());
- SensorMock *sm2 = reinterpret_cast<SensorMock *>(s2.get());
+ SensorMock* sm1 = reinterpret_cast<SensorMock*>(s1.get());
+ SensorMock* sm2 = reinterpret_cast<SensorMock*>(s2.get());
EXPECT_CALL(z, getSensor(StrEq("fan0"))).WillOnce(Return(s1.get()));
EXPECT_CALL(*sm1, write(0.5));
@@ -232,7 +232,7 @@ TEST(FanControllerTest, OutputProc_VerifyFailSafeIgnoredIfInputHigher)
int64_t timeout = 0;
std::unique_ptr<Sensor> s1 = std::make_unique<SensorMock>("fan0", timeout);
// Grab pointer for mocking.
- SensorMock *sm1 = reinterpret_cast<SensorMock *>(s1.get());
+ SensorMock* sm1 = reinterpret_cast<SensorMock*>(s1.get());
// Converting from float to double for expectation.
float percent = 80;
diff --git a/test/pid_zone_unittest.cpp b/test/pid_zone_unittest.cpp
index a8e03a0..44df7b1 100644
--- a/test/pid_zone_unittest.cpp
+++ b/test/pid_zone_unittest.cpp
@@ -40,7 +40,7 @@ TEST(PidZoneConstructorTest, BoringConstructorTest)
SensorManager m(std::move(bus_mock_passive), std::move(bus_mock_host));
bool defer = true;
- const char *objPath = "/path/";
+ const char* objPath = "/path/";
int64_t zone = 1;
float minThermalRpm = 1000.0;
float failSafePercent = 0.75;
@@ -95,7 +95,7 @@ class PidZoneTest : public ::testing::Test
float minThermalRpm = 1000.0;
float failSafePercent = 0.75;
bool defer = true;
- const char *objPath = "/path/";
+ const char* objPath = "/path/";
SensorManager mgr;
std::unique_ptr<PIDZone> zone;
@@ -177,12 +177,12 @@ TEST_F(PidZoneTest, ThermalInputs_FailsafeToValid_ReadsSensors)
std::unique_ptr<Sensor> sensor1 =
std::make_unique<SensorMock>(name1, timeout);
- SensorMock *sensor_ptr1 = reinterpret_cast<SensorMock *>(sensor1.get());
+ SensorMock* sensor_ptr1 = reinterpret_cast<SensorMock*>(sensor1.get());
std::string name2 = "temp2";
std::unique_ptr<Sensor> sensor2 =
std::make_unique<SensorMock>(name2, timeout);
- SensorMock *sensor_ptr2 = reinterpret_cast<SensorMock *>(sensor2.get());
+ SensorMock* sensor_ptr2 = reinterpret_cast<SensorMock*>(sensor2.get());
std::string type = "unchecked";
mgr.addSensor(type, name1, std::move(sensor1));
@@ -229,12 +229,12 @@ TEST_F(PidZoneTest, FanInputTest_VerifiesFanValuesCached)
std::unique_ptr<Sensor> sensor1 =
std::make_unique<SensorMock>(name1, timeout);
- SensorMock *sensor_ptr1 = reinterpret_cast<SensorMock *>(sensor1.get());
+ SensorMock* sensor_ptr1 = reinterpret_cast<SensorMock*>(sensor1.get());
std::string name2 = "fan2";
std::unique_ptr<Sensor> sensor2 =
std::make_unique<SensorMock>(name2, timeout);
- SensorMock *sensor_ptr2 = reinterpret_cast<SensorMock *>(sensor2.get());
+ SensorMock* sensor_ptr2 = reinterpret_cast<SensorMock*>(sensor2.get());
std::string type = "unchecked";
mgr.addSensor(type, name1, std::move(sensor1));
@@ -277,12 +277,12 @@ TEST_F(PidZoneTest, ThermalInput_ValueTimeoutEntersFailSafeMode)
std::string name1 = "temp1";
std::unique_ptr<Sensor> sensor1 =
std::make_unique<SensorMock>(name1, timeout);
- SensorMock *sensor_ptr1 = reinterpret_cast<SensorMock *>(sensor1.get());
+ SensorMock* sensor_ptr1 = reinterpret_cast<SensorMock*>(sensor1.get());
std::string name2 = "temp2";
std::unique_ptr<Sensor> sensor2 =
std::make_unique<SensorMock>(name2, timeout);
- SensorMock *sensor_ptr2 = reinterpret_cast<SensorMock *>(sensor2.get());
+ SensorMock* sensor_ptr2 = reinterpret_cast<SensorMock*>(sensor2.get());
std::string type = "unchecked";
mgr.addSensor(type, name1, std::move(sensor1));
@@ -336,7 +336,7 @@ TEST_F(PidZoneTest, GetSensorTest_ReturnsExpected)
std::string name1 = "temp1";
std::unique_ptr<Sensor> sensor1 =
std::make_unique<SensorMock>(name1, timeout);
- SensorMock *sensor_ptr1 = reinterpret_cast<SensorMock *>(sensor1.get());
+ SensorMock* sensor_ptr1 = reinterpret_cast<SensorMock*>(sensor1.get());
std::string type = "unchecked";
mgr.addSensor(type, name1, std::move(sensor1));
@@ -355,11 +355,11 @@ TEST_F(PidZoneTest, AddThermalPIDTest_VerifiesThermalPIDsProcessed)
std::unique_ptr<PIDController> tpid =
std::make_unique<ControllerMock>("thermal1", zone.get());
- ControllerMock *tmock = reinterpret_cast<ControllerMock *>(tpid.get());
+ ControllerMock* tmock = reinterpret_cast<ControllerMock*>(tpid.get());
// 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->get_pid_info();
std::memset(info, 0x00, sizeof(ec::pid_info_t));
zone->addThermalPID(std::move(tpid));
@@ -380,11 +380,11 @@ TEST_F(PidZoneTest, AddFanPIDTest_VerifiesFanPIDsProcessed)
std::unique_ptr<PIDController> tpid =
std::make_unique<ControllerMock>("fan1", zone.get());
- ControllerMock *tmock = reinterpret_cast<ControllerMock *>(tpid.get());
+ ControllerMock* tmock = reinterpret_cast<ControllerMock*>(tpid.get());
// 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->get_pid_info();
std::memset(info, 0x00, sizeof(ec::pid_info_t));
zone->addFanPID(std::move(tpid));
@@ -406,8 +406,8 @@ TEST_F(PidZoneTest, ManualModeDbusTest_VerifySetManualBehavesAsExpected)
EXPECT_CALL(sdbus_mock_mode,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(objPath), StrEq(modeInterface), NotNull()))
- .WillOnce(Invoke([&](sd_bus *bus, const char *path,
- const char *interface, char **names) {
+ .WillOnce(Invoke([&](sd_bus* bus, const char* path,
+ const char* interface, char** names) {
EXPECT_STREQ("Manual", names[0]);
return 0;
}));
diff --git a/test/sensor_host_unittest.cpp b/test/sensor_host_unittest.cpp
index 99d4924..1c69a20 100644
--- a/test/sensor_host_unittest.cpp
+++ b/test/sensor_host_unittest.cpp
@@ -29,7 +29,7 @@ TEST(HostSensorTest, CreateHostTempSensorTest)
auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
std::string name = "fleeting0";
int64_t timeout = 1;
- const char *objPath = "/asdf/asdf0";
+ const char* objPath = "/asdf/asdf0";
bool defer = false;
std::string interface = "xyz.openbmc_project.Sensor.Value";
@@ -62,7 +62,7 @@ TEST(HostSensorTest, VerifyWriteThenReadMatches)
auto bus_mock = sdbusplus::get_mocked_new(&sdbus_mock);
std::string name = "fleeting0";
int64_t timeout = 1;
- const char *objPath = "/asdf/asdf0";
+ const char* objPath = "/asdf/asdf0";
bool defer = false;
std::string interface = "xyz.openbmc_project.Sensor.Value";
@@ -83,7 +83,7 @@ TEST(HostSensorTest, VerifyWriteThenReadMatches)
HostSensor::CreateTemp(name, timeout, bus_mock, objPath, defer);
// Value is updated from dbus calls only (normally).
- HostSensor *hs = static_cast<HostSensor *>(s.get());
+ HostSensor* hs = static_cast<HostSensor*>(s.get());
int64_t new_value = 2;
ReadReturn r = hs->read();
@@ -92,8 +92,8 @@ TEST(HostSensorTest, VerifyWriteThenReadMatches)
EXPECT_CALL(sdbus_mock,
sd_bus_emit_properties_changed_strv(
IsNull(), StrEq(objPath), StrEq(interface), NotNull()))
- .WillOnce(Invoke([=](sd_bus *bus, const char *path,
- const char *interface, char **names) {
+ .WillOnce(Invoke([=](sd_bus* bus, const char* path,
+ const char* interface, char** names) {
EXPECT_STREQ("Value", names[0]);
return 0;
}));
diff --git a/test/sensor_manager_unittest.cpp b/test/sensor_manager_unittest.cpp
index 54253ac..8a89628 100644
--- a/test/sensor_manager_unittest.cpp
+++ b/test/sensor_manager_unittest.cpp
@@ -50,7 +50,7 @@ TEST(SensorManagerTest, AddSensorInvalidTypeTest)
int64_t timeout = 1;
std::unique_ptr<Sensor> sensor =
std::make_unique<SensorMock>(name, timeout);
- Sensor *sensor_ptr = sensor.get();
+ Sensor* sensor_ptr = sensor.get();
s.addSensor(type, name, std::move(sensor));
EXPECT_EQ(s.getSensor(name), sensor_ptr);
diff --git a/test/sensor_pluggable_unittest.cpp b/test/sensor_pluggable_unittest.cpp
index 015b911..a15f06c 100644
--- a/test/sensor_pluggable_unittest.cpp
+++ b/test/sensor_pluggable_unittest.cpp
@@ -41,7 +41,7 @@ TEST(PluggableSensorTest, TryReadingTest)
std::string name = "name";
int64_t timeout = 1;
- ReadInterfaceMock *rip = reinterpret_cast<ReadInterfaceMock *>(ri.get());
+ ReadInterfaceMock* rip = reinterpret_cast<ReadInterfaceMock*>(ri.get());
PluggableSensor p(name, timeout, std::move(ri), std::move(wi));
@@ -71,7 +71,7 @@ TEST(PluggableSensorTest, TryWritingTest)
std::string name = "name";
int64_t timeout = 1;
- WriteInterfaceMock *wip = reinterpret_cast<WriteInterfaceMock *>(wi.get());
+ WriteInterfaceMock* wip = reinterpret_cast<WriteInterfaceMock*>(wi.get());
PluggableSensor p(name, timeout, std::move(ri), std::move(wi));
OpenPOWER on IntegriCloud