clang-format: copy latest and re-format
clang-format-16 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: I1ac255c58971ac5cc4697b8bb1069067aad02d18
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tests/src/dbus_environment.hpp b/tests/src/dbus_environment.hpp
index eabb53a..558445e 100644
--- a/tests/src/dbus_environment.hpp
+++ b/tests/src/dbus_environment.hpp
@@ -104,12 +104,12 @@
*DbusEnvironment::getBus(), DbusEnvironment::serviceName(), path,
interfaceName, property,
[&propertyPromise](const boost::system::error_code& ec, T t) {
- if (ec)
- {
- utils::setException(propertyPromise, "GetProperty failed");
- return;
- }
- propertyPromise.set_value(t);
+ if (ec)
+ {
+ utils::setException(propertyPromise, "GetProperty failed");
+ return;
+ }
+ propertyPromise.set_value(t);
});
return DbusEnvironment::waitForFuture(std::move(propertyFuture));
}
@@ -124,9 +124,9 @@
sdbusplus::asio::setProperty(
*DbusEnvironment::getBus(), DbusEnvironment::serviceName(), path,
interfaceName, property, std::move(newValue),
- [promise =
- std::move(promise)](boost::system::error_code ec) mutable {
- promise.set_value(ec);
+ [promise = std::move(promise)](
+ boost::system::error_code ec) mutable {
+ promise.set_value(ec);
});
return DbusEnvironment::waitForFuture(std::move(future));
}
diff --git a/tests/src/helpers/interfaces/json_storage_helpers.hpp b/tests/src/helpers/interfaces/json_storage_helpers.hpp
index b5d4004..f339381 100644
--- a/tests/src/helpers/interfaces/json_storage_helpers.hpp
+++ b/tests/src/helpers/interfaces/json_storage_helpers.hpp
@@ -16,4 +16,4 @@
(*os) << static_cast<std::filesystem::path>(o);
}
-} // namespace interfaces
\ No newline at end of file
+} // namespace interfaces
diff --git a/tests/src/helpers/interfaces/sensor_id_helpers.hpp b/tests/src/helpers/interfaces/sensor_id_helpers.hpp
index 9b59d22..3268e07 100644
--- a/tests/src/helpers/interfaces/sensor_id_helpers.hpp
+++ b/tests/src/helpers/interfaces/sensor_id_helpers.hpp
@@ -19,4 +19,4 @@
std::tie(right.type, right.service, right.path);
}
-} // namespace interfaces
\ No newline at end of file
+} // namespace interfaces
diff --git a/tests/src/helpers/metric_value_helpers.hpp b/tests/src/helpers/metric_value_helpers.hpp
index f21d42a..9634de3 100644
--- a/tests/src/helpers/metric_value_helpers.hpp
+++ b/tests/src/helpers/metric_value_helpers.hpp
@@ -14,4 +14,4 @@
{
return std::tie(left.id, left.metadata, left.value, left.timestamp) ==
std::tie(right.id, right.metadata, right.value, right.timestamp);
-}
\ No newline at end of file
+}
diff --git a/tests/src/mocks/report_factory_mock.hpp b/tests/src/mocks/report_factory_mock.hpp
index a043c09..8af6d5c 100644
--- a/tests/src/mocks/report_factory_mock.hpp
+++ b/tests/src/mocks/report_factory_mock.hpp
@@ -14,12 +14,12 @@
{
return utils::transform(readingParams, [](const auto& params) {
return LabeledMetricParameters(
- utils::transform(std::get<0>(params),
- [](const auto& sensorData) {
- return LabeledSensorInfo(
- "Service", std::get<0>(sensorData),
+ utils::transform(
+ std::get<0>(params),
+ [](const auto& sensorData) {
+ return LabeledSensorInfo("Service", std::get<0>(sensorData),
std::get<1>(sensorData));
- }),
+ }),
utils::toOperationType(std::get<1>(params)),
std::get<2>(params),
utils::toCollectionTimeScope(std::get<3>(params)),
diff --git a/tests/src/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
index d3d83e5..f1dfa1f 100644
--- a/tests/src/mocks/trigger_factory_mock.hpp
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -73,10 +73,11 @@
return EXPECT_CALL(
*this, make(params.id(), params.name(),
- utils::transform(params.triggerActions(),
- [](const auto& action) {
- return actionToString(action);
- }),
+ utils::transform(
+ params.triggerActions(),
+ [](const auto& action) {
+ return actionToString(action);
+ }),
params.reportIds(), tm, triggerStorage,
params.thresholdParams(), params.sensors()));
}
diff --git a/tests/src/params/trigger_params.hpp b/tests/src/params/trigger_params.hpp
index 9f633b8..b39941c 100644
--- a/tests/src/params/trigger_params.hpp
+++ b/tests/src/params/trigger_params.hpp
@@ -18,10 +18,10 @@
public:
TriggerParams()
{
- reportsProperty =
- utils::transform(reportIdsProperty, [](const auto& id) {
- return utils::pathAppend(utils::constants::reportDirPath, id);
- });
+ reportsProperty = utils::transform(reportIdsProperty,
+ [](const auto& id) {
+ return utils::pathAppend(utils::constants::reportDirPath, id);
+ });
}
TriggerParams& id(std::string_view val)
@@ -70,10 +70,10 @@
TriggerParams& reportIds(std::vector<std::string> val)
{
reportIdsProperty = std::move(val);
- reportsProperty = utils::transform<std::vector>(
- reportIdsProperty, [](const auto& id) {
- return utils::pathAppend(utils::constants::reportDirPath, id);
- });
+ reportsProperty = utils::transform<std::vector>(reportIdsProperty,
+ [](const auto& id) {
+ return utils::pathAppend(utils::constants::reportDirPath, id);
+ });
return *this;
}
diff --git a/tests/src/stubs/dbus_sensor_object.cpp b/tests/src/stubs/dbus_sensor_object.cpp
index b73478e..dbe95ca 100644
--- a/tests/src/stubs/dbus_sensor_object.cpp
+++ b/tests/src/stubs/dbus_sensor_object.cpp
@@ -17,13 +17,12 @@
ioc(ioc),
bus(bus), objServer(objServer)
{
- sensorIface = objServer->add_unique_interface(
- path(), interface(), [this](auto& iface) {
- iface.register_property_r(
- property.value(), value,
- sdbusplus::vtable::property_::emits_change,
- [this](const auto&) { return value; });
- });
+ sensorIface = objServer->add_unique_interface(path(), interface(),
+ [this](auto& iface) {
+ iface.register_property_r(property.value(), value,
+ sdbusplus::vtable::property_::emits_change,
+ [this](const auto&) { return value; });
+ });
}
void DbusSensorObject::setValue(double v)
diff --git a/tests/src/test_discrete_threshold.cpp b/tests/src/test_discrete_threshold.cpp
index 953ddd5..8b9168b 100644
--- a/tests/src/test_discrete_threshold.cpp
+++ b/tests/src/test_discrete_threshold.cpp
@@ -104,8 +104,7 @@
class TestDiscreteThresholdInit : public TestDiscreteThreshold
{
- void SetUp() override
- {}
+ void SetUp() override {}
};
TEST_F(TestDiscreteThresholdInit, nonEmptyNameIsNotChanged)
diff --git a/tests/src/test_metric.cpp b/tests/src/test_metric.cpp
index cd6a6ec..952651c 100644
--- a/tests/src/test_metric.cpp
+++ b/tests/src/test_metric.cpp
@@ -353,8 +353,8 @@
clockFake.advance(timestamp);
}
- const auto [expectedTimestamp, expectedReading] =
- GetParam().expectedReading();
+ const auto [expectedTimestamp,
+ expectedReading] = GetParam().expectedReading();
const auto readings = sut->getUpdatedReadings();
EXPECT_THAT(readings,
@@ -373,8 +373,8 @@
sut->getUpdatedReadings();
}
- const auto [expectedTimestamp, expectedReading] =
- GetParam().expectedReading();
+ const auto [expectedTimestamp,
+ expectedReading] = GetParam().expectedReading();
const auto readings = sut->getUpdatedReadings();
EXPECT_THAT(readings,
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index 875bd4b..1d0f0bb 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -188,7 +188,7 @@
std::promise<boost::system::error_code> methodPromise;
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
- methodPromise.set_value(ec);
+ methodPromise.set_value(ec);
},
DbusEnvironment::serviceName(), path, interface, method);
return DbusEnvironment::waitForFuture(methodPromise.get_future());
@@ -671,8 +671,7 @@
public TestReport,
public WithParamInterface<std::pair<std::string, nlohmann::json>>
{
- void SetUp() override
- {}
+ void SetUp() override {}
};
INSTANTIATE_TEST_SUITE_P(
@@ -687,7 +686,7 @@
std::make_pair("ReportActions", nlohmann::json(utils::transform(
defaultParams().reportActions(),
[](const auto v) {
- return utils::toUnderlying(v);
+ return utils::toUnderlying(v);
}))),
std::make_pair("Interval",
nlohmann::json(defaultParams().interval().count())),
@@ -754,8 +753,7 @@
public WithParamInterface<ReportParams>
{
public:
- void SetUp() override
- {}
+ void SetUp() override {}
};
INSTANTIATE_TEST_SUITE_P(
@@ -774,8 +772,7 @@
public WithParamInterface<ReportParams>
{
public:
- void SetUp() override
- {}
+ void SetUp() override {}
};
INSTANTIATE_TEST_SUITE_P(InvalidNames, TestReportInvalidIds,
@@ -823,8 +820,8 @@
clockFake.system.advance(10ms);
messanger.send(messages::UpdateReportInd{{sut->getId()}});
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
}
@@ -835,8 +832,8 @@
setProperty(sut->getPath(), "Enabled", false);
messanger.send(messages::UpdateReportInd{{sut->getId()}});
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(Milliseconds{timestamp}, Eq(0ms));
}
@@ -846,8 +843,8 @@
clockFake.system.advance(10ms);
messanger.send(messages::UpdateReportInd{{sut->getId() + "x"s}});
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(Milliseconds{timestamp}, Eq(0ms));
}
@@ -867,8 +864,8 @@
ASSERT_THAT(update(sut->getPath()), Eq(boost::system::errc::success));
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
}
@@ -877,8 +874,8 @@
{
ASSERT_THAT(update(sut->getPath()), Eq(boost::system::errc::success));
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(readings,
ElementsAre(std::make_tuple("a"s, "b"s, 17.1, 114u),
@@ -948,8 +945,8 @@
clockFake.system.advance(10ms);
DbusEnvironment::sleepFor(ReportManager::minInterval + 1ms);
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(Milliseconds{timestamp}, Eq(systemTimestamp + 10ms));
}
@@ -958,8 +955,8 @@
{
DbusEnvironment::sleepFor(ReportManager::minInterval + 1ms);
- const auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ const auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
EXPECT_THAT(readings,
ElementsAre(std::make_tuple("a"s, "b"s, 17.1, 114u),
@@ -978,8 +975,7 @@
public WithParamInterface<ReportUpdatesReportParams>
{
public:
- void SetUp() override
- {}
+ void SetUp() override {}
void changeReport(ReportingType rt, Milliseconds interval)
{
@@ -990,8 +986,8 @@
auto readings()
{
- auto [timestamp, readings] =
- getProperty<Readings>(sut->getPath(), "Readings");
+ auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
+ "Readings");
return readings;
}
@@ -1285,8 +1281,8 @@
{
messanger.on_receive<messages::CollectTriggerIdReq>(
[this, triggerId](const auto& msg) {
- messanger.send(messages::CollectTriggerIdResp{triggerId});
- });
+ messanger.send(messages::CollectTriggerIdResp{triggerId});
+ });
}
sut = makeReport(ReportParams());
diff --git a/tests/src/test_report_manager.cpp b/tests/src/test_report_manager.cpp
index 51140b7..fc394ae 100644
--- a/tests/src/test_report_manager.cpp
+++ b/tests/src/test_report_manager.cpp
@@ -67,7 +67,7 @@
DbusEnvironment::getBus()->async_method_call(
[&addReportPromise](boost::system::error_code ec,
const std::string& path) {
- addReportPromise.set_value({ec, path});
+ addReportPromise.set_value({ec, path});
},
DbusEnvironment::serviceName(), ReportManager::reportManagerPath,
ReportManager::reportManagerIfaceName, "AddReportFutureVersion",
@@ -88,11 +88,11 @@
utils::enumToString(params.reportUpdates()));
properties.emplace_back("AppendLimit", params.appendLimit());
properties.emplace_back("Enabled", params.enabled());
- properties.emplace_back(
- "ReportActions",
- utils::transform(params.reportActions(), [](const auto v) {
- return utils::enumToString(v);
- }));
+ properties.emplace_back("ReportActions",
+ utils::transform(params.reportActions(),
+ [](const auto v) {
+ return utils::enumToString(v);
+ }));
properties.emplace_back("Interval", params.interval().count());
properties.emplace_back("ReadingParameters",
toReadingParameters(params.metricParameters()));
diff --git a/tests/src/test_sensor_cache.cpp b/tests/src/test_sensor_cache.cpp
index b59a062..218e160 100644
--- a/tests/src/test_sensor_cache.cpp
+++ b/tests/src/test_sensor_cache.cpp
@@ -59,10 +59,10 @@
TEST_P(TestSensorCacheP, shouldReturnDifferentSensorWhenIdsAreDifferent)
{
- auto sensor1 =
- sut.makeSensor<NiceMock<SensorMock>>(id<0>().service, id<0>().path);
- auto sensor2 =
- sut.makeSensor<NiceMock<SensorMock>>(id<1>().service, id<1>().path);
+ auto sensor1 = sut.makeSensor<NiceMock<SensorMock>>(id<0>().service,
+ id<0>().path);
+ auto sensor2 = sut.makeSensor<NiceMock<SensorMock>>(id<1>().service,
+ id<1>().path);
ASSERT_THAT(sensor1.get(), Not(Eq(sensor2.get())));
ASSERT_THAT(sensor1->mockId, Not(Eq(sensor2->mockId)));
@@ -70,10 +70,10 @@
TEST_F(TestSensorCache, shouldReturnSameSensorWhenSensorWithSameIdStillExists)
{
- auto sensor1 =
- sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path");
- auto sensor2 =
- sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path");
+ auto sensor1 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+ "sensor-path");
+ auto sensor2 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+ "sensor-path");
ASSERT_THAT(sensor1.get(), Eq(sensor2.get()));
ASSERT_THAT(sensor1->mockId, Eq(sensor2->mockId));
@@ -81,21 +81,21 @@
TEST_F(TestSensorCache, shouldReturnDifferentSensorWhenPreviousSensorExpired)
{
- auto mockId1 =
- sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
- ->mockId;
- auto mockId2 =
- sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
- ->mockId;
+ auto mockId1 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+ "sensor-path")
+ ->mockId;
+ auto mockId2 = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+ "sensor-path")
+ ->mockId;
ASSERT_THAT(mockId2, Not(Eq(mockId1)));
}
TEST_F(TestSensorCache, shouldCreateSensorWithCorrespondingId)
{
- auto id =
- sut.makeSensor<NiceMock<SensorMock>>("sensor-service", "sensor-path")
- ->id();
+ auto id = sut.makeSensor<NiceMock<SensorMock>>("sensor-service",
+ "sensor-path")
+ ->id();
auto expected = SensorMock::makeId("sensor-service", "sensor-path");
diff --git a/tests/src/test_trigger.cpp b/tests/src/test_trigger.cpp
index 9db2632..f55dec1 100644
--- a/tests/src/test_trigger.cpp
+++ b/tests/src/test_trigger.cpp
@@ -140,7 +140,7 @@
std::promise<boost::system::error_code> methodPromise;
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
- methodPromise.set_value(ec);
+ methodPromise.set_value(ec);
},
DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
"Delete");
@@ -155,9 +155,10 @@
EXPECT_THAT(getProperty<bool>(sut->getPath(), "Persistent"), Eq(true));
EXPECT_THAT(
getProperty<std::vector<std::string>>(sut->getPath(), "TriggerActions"),
- Eq(utils::transform(
- triggerParams.triggerActions(),
- [](const auto& action) { return actionToString(action); })));
+ Eq(utils::transform(triggerParams.triggerActions(),
+ [](const auto& action) {
+ return actionToString(action);
+ })));
EXPECT_THAT((getProperty<SensorsInfo>(sut->getPath(), "Sensors")),
Eq(utils::fromLabeledSensorsInfo(triggerParams.sensors())));
EXPECT_THAT(
@@ -442,8 +443,7 @@
class TestTriggerInitialization : public TestTrigger
{
public:
- void SetUp() override
- {}
+ void SetUp() override {}
nlohmann::json storedConfiguration;
};
@@ -516,8 +516,8 @@
ASSERT_THAT(storedConfiguration.at("TriggerActions"),
Eq(utils::transform(triggerParams.triggerActions(),
[](const auto& action) {
- return actionToString(action);
- })));
+ return actionToString(action);
+ })));
}
TEST_F(TestTriggerStore, settingPersistencyToTrueStoresTriggerReportIds)
diff --git a/tests/src/test_trigger_actions.cpp b/tests/src/test_trigger_actions.cpp
index 42488aa..8711378 100644
--- a/tests/src/test_trigger_actions.cpp
+++ b/tests/src/test_trigger_actions.cpp
@@ -249,8 +249,7 @@
class TestUpdateReport : public Test
{
public:
- TestUpdateReport() : messanger(DbusEnvironment::getIoc())
- {}
+ TestUpdateReport() : messanger(DbusEnvironment::getIoc()) {}
void make(std::vector<std::string> names)
{
diff --git a/tests/src/test_trigger_manager.cpp b/tests/src/test_trigger_manager.cpp
index 48c76ea..03ec5ce 100644
--- a/tests/src/test_trigger_manager.cpp
+++ b/tests/src/test_trigger_manager.cpp
@@ -30,7 +30,7 @@
DbusEnvironment::getBus()->async_method_call(
[&addTriggerPromise](boost::system::error_code ec,
const std::string& path) {
- addTriggerPromise.set_value({ec, path});
+ addTriggerPromise.set_value({ec, path});
},
DbusEnvironment::serviceName(), TriggerManager::triggerManagerPath,
TriggerManager::triggerManagerIfaceName, "AddTrigger", params.id(),
@@ -465,10 +465,10 @@
{"Name", TriggerParams().name()},
{"ThresholdParamsDiscriminator",
TriggerParams().thresholdParams().index()},
- {"TriggerActions", utils::transform(TriggerParams().triggerActions(),
- [](const auto& action) {
- return actionToString(action);
- })},
+ {"TriggerActions",
+ utils::transform(
+ TriggerParams().triggerActions(),
+ [](const auto& action) { return actionToString(action); })},
{"ThresholdParams", utils::labeledThresholdParamsToJson(
TriggerParams().thresholdParams())},
{"ReportIds", TriggerParams().reportIds()},
diff --git a/tests/src/utils/string_utils.cpp b/tests/src/utils/string_utils.cpp
index a39afca..f85f441 100644
--- a/tests/src/utils/string_utils.cpp
+++ b/tests/src/utils/string_utils.cpp
@@ -71,4 +71,4 @@
{
return details::getStringWithSpaces(constants::maxIdNameLength + 1);
}
-} // namespace utils::string_utils
\ No newline at end of file
+} // namespace utils::string_utils
diff --git a/tests/src/utils/string_utils.hpp b/tests/src/utils/string_utils.hpp
index 90f802c..8dcf9dc 100644
--- a/tests/src/utils/string_utils.hpp
+++ b/tests/src/utils/string_utils.hpp
@@ -10,4 +10,4 @@
std::string getTooLongPrefix();
std::string getTooLongId();
std::string getTooLongName();
-} // namespace utils::string_utils
\ No newline at end of file
+} // namespace utils::string_utils