clang-format: update latest spec and reformat
Copy the latest format file from the docs repository and apply.
Change-Id: Ic2bc1d98d8ad469a3477f9059ec890fc8339907d
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/tests/src/dbus_environment.cpp b/tests/src/dbus_environment.cpp
index bfe347c..03eec50 100644
--- a/tests/src/dbus_environment.cpp
+++ b/tests/src/dbus_environment.cpp
@@ -72,9 +72,9 @@
Milliseconds timeout)
{
auto& data = futures[std::string(name)];
- auto ret = waitForFutures(std::move(data), true, [](auto sum, auto val) {
- return sum && val;
- }, timeout);
+ auto ret = waitForFutures(
+ std::move(data), true, [](auto sum, auto val) { return sum && val; },
+ timeout);
data = std::vector<std::future<bool>>{};
return ret;
}
diff --git a/tests/src/dbus_environment.hpp b/tests/src/dbus_environment.hpp
index 8519b29..068fa3e 100644
--- a/tests/src/dbus_environment.hpp
+++ b/tests/src/dbus_environment.hpp
@@ -81,9 +81,9 @@
std::vector<std::future<T>> futures;
futures.emplace_back(std::move(future));
- return waitForFutures(std::move(futures), T{},
- [](auto, const auto& value) { return value; },
- timeout);
+ return waitForFutures(
+ std::move(futures), T{},
+ [](auto, const auto& value) { return value; }, timeout);
}
static bool waitForFuture(std::string_view name,
@@ -103,20 +103,20 @@
*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));
}
template <class T>
- static boost::system::error_code
- setProperty(const std::string& path, const std::string& interfaceName,
- const std::string& property, const T& newValue)
+ static boost::system::error_code setProperty(
+ const std::string& path, const std::string& interfaceName,
+ const std::string& property, const T& newValue)
{
auto promise = std::promise<boost::system::error_code>();
auto future = promise.get_future();
@@ -125,23 +125,23 @@
interfaceName, property, std::move(newValue),
[promise = std::move(promise)](
boost::system::error_code ec) mutable {
- promise.set_value(ec);
- });
+ promise.set_value(ec);
+ });
return DbusEnvironment::waitForFuture(std::move(future));
}
template <class... Args>
- static boost::system::error_code
- callMethod(const std::string& path, const std::string& interface,
- const std::string& method, Args&&... args)
+ static boost::system::error_code callMethod(
+ const std::string& path, const std::string& interface,
+ const std::string& method, Args&&... args)
{
auto promise = std::promise<boost::system::error_code>();
auto future = promise.get_future();
DbusEnvironment::getBus()->async_method_call(
[promise = std::move(promise)](
boost::system::error_code ec) mutable {
- promise.set_value(ec);
- },
+ promise.set_value(ec);
+ },
DbusEnvironment::serviceName(), path, interface, method,
std::forward<Args>(args)...);
return DbusEnvironment::waitForFuture(std::move(future));
diff --git a/tests/src/helpers/labeled_tuple_helpers.hpp b/tests/src/helpers/labeled_tuple_helpers.hpp
index 4ee70c1..a5b92bc 100644
--- a/tests/src/helpers/labeled_tuple_helpers.hpp
+++ b/tests/src/helpers/labeled_tuple_helpers.hpp
@@ -8,9 +8,9 @@
{
template <class... Args, class... Labels>
-inline void
- PrintTo(const LabeledTuple<std::tuple<Args...>, Labels...>& labeledTuple,
- std::ostream* os)
+inline void PrintTo(
+ const LabeledTuple<std::tuple<Args...>, Labels...>& labeledTuple,
+ std::ostream* os)
{
nlohmann::json json;
to_json(json, labeledTuple);
diff --git a/tests/src/mocks/report_factory_mock.hpp b/tests/src/mocks/report_factory_mock.hpp
index 7cf4489..71709df 100644
--- a/tests/src/mocks/report_factory_mock.hpp
+++ b/tests/src/mocks/report_factory_mock.hpp
@@ -9,16 +9,17 @@
class ReportFactoryMock : public interfaces::ReportFactory
{
- static std::vector<LabeledMetricParameters>
- convertToLabeled(const ReadingParameters& readingParams)
+ static std::vector<LabeledMetricParameters> convertToLabeled(
+ const ReadingParameters& readingParams)
{
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),
+ return LabeledSensorInfo(
+ "Service", std::get<0>(sensorData),
std::get<1>(sensorData));
- }),
+ }),
utils::toOperationType(std::get<1>(params)),
utils::toCollectionTimeScope(std::get<2>(params)),
CollectionDuration(Milliseconds(std::get<3>(params))));
@@ -41,8 +42,8 @@
ON_CALL(*this,
make(A<const std::string&>(), _, _, _, _, _, _, _, _, _, _, _))
.WillByDefault(WithArgs<0>(Invoke([](const std::string& id) {
- return std::make_unique<NiceMock<ReportMock>>(id);
- })));
+ return std::make_unique<NiceMock<ReportMock>>(id);
+ })));
}
MOCK_METHOD(std::vector<LabeledMetricParameters>, convertMetricParams,
diff --git a/tests/src/mocks/sensor_mock.hpp b/tests/src/mocks/sensor_mock.hpp
index 9b7f28b..eb3a75d 100644
--- a/tests/src/mocks/sensor_mock.hpp
+++ b/tests/src/mocks/sensor_mock.hpp
@@ -24,8 +24,8 @@
return Id("SensorMock", service, path);
}
- static std::vector<std::shared_ptr<interfaces::Sensor>>
- makeSensorMocks(const std::vector<LabeledSensorInfo>& sensorsInfo)
+ static std::vector<std::shared_ptr<interfaces::Sensor>> makeSensorMocks(
+ const std::vector<LabeledSensorInfo>& sensorsInfo)
{
using namespace testing;
std::vector<std::shared_ptr<NiceMock<SensorMock>>> result;
diff --git a/tests/src/mocks/threshold_mock.hpp b/tests/src/mocks/threshold_mock.hpp
index 2f81b60..f1eab00 100644
--- a/tests/src/mocks/threshold_mock.hpp
+++ b/tests/src/mocks/threshold_mock.hpp
@@ -20,8 +20,8 @@
MOCK_METHOD(void, updateSensors, (Sensors newSensors), (override));
- static std::vector<std::shared_ptr<interfaces::Threshold>>
- makeThresholds(const LabeledTriggerThresholdParams& params)
+ static std::vector<std::shared_ptr<interfaces::Threshold>> makeThresholds(
+ const LabeledTriggerThresholdParams& params)
{
using namespace testing;
std::vector<std::shared_ptr<NiceMock<ThresholdMock>>> result;
diff --git a/tests/src/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
index a733ca4..d3d83e5 100644
--- a/tests/src/mocks/trigger_factory_mock.hpp
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -18,8 +18,8 @@
ON_CALL(*this, make(A<const std::string&>(), _, _, _, _, _, _, _))
.WillByDefault(WithArgs<0>(Invoke([](const std::string& id) {
- return std::make_unique<NiceMock<TriggerMock>>(id);
- })));
+ return std::make_unique<NiceMock<TriggerMock>>(id);
+ })));
}
MOCK_METHOD(std::unique_ptr<interfaces::Trigger>, make,
@@ -75,8 +75,8 @@
*this, make(params.id(), params.name(),
utils::transform(params.triggerActions(),
[](const auto& action) {
- return actionToString(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 ae97732..cd968a4 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;
}
@@ -99,8 +99,8 @@
return labeledThresholdsProperty;
}
- const std::vector<numeric::LabeledThresholdParam>
- numericThresholdParams() const
+ const std::vector<numeric::LabeledThresholdParam> numericThresholdParams()
+ const
{
const auto* num = std::get_if<0>(&labeledThresholdsProperty);
if (num == nullptr)
@@ -110,8 +110,8 @@
return *num;
}
- const std::vector<discrete::LabeledThresholdParam>
- discreteThresholdParams() const
+ const std::vector<discrete::LabeledThresholdParam> discreteThresholdParams()
+ const
{
const auto* num = std::get_if<1>(&labeledThresholdsProperty);
if (num == nullptr)
diff --git a/tests/src/stubs/dbus_sensor_object.cpp b/tests/src/stubs/dbus_sensor_object.cpp
index 224e1de..e4f402e 100644
--- a/tests/src/stubs/dbus_sensor_object.cpp
+++ b/tests/src/stubs/dbus_sensor_object.cpp
@@ -16,12 +16,13 @@
const std::shared_ptr<sdbusplus::asio::object_server>& objServer) :
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_detached_timer.cpp b/tests/src/test_detached_timer.cpp
index a9dd6c0..90bc877 100644
--- a/tests/src/test_detached_timer.cpp
+++ b/tests/src/test_detached_timer.cpp
@@ -25,8 +25,9 @@
setPromise();
});
- auto elapsed = DbusEnvironment::measureTime(
- [] { DbusEnvironment::waitForFuture("timer"); });
+ auto elapsed = DbusEnvironment::measureTime([] {
+ DbusEnvironment::waitForFuture("timer");
+ });
EXPECT_THAT(elapsed, AllOf(Ge(100ms), Lt(200ms)));
EXPECT_THAT(value, Eq(1u));
diff --git a/tests/src/test_discrete_threshold.cpp b/tests/src/test_discrete_threshold.cpp
index 36d3a29..9003d49 100644
--- a/tests/src/test_discrete_threshold.cpp
+++ b/tests/src/test_discrete_threshold.cpp
@@ -27,10 +27,10 @@
std::unique_ptr<NiceMock<ClockMock>> clockMockPtr =
std::make_unique<NiceMock<ClockMock>>();
- std::shared_ptr<DiscreteThreshold>
- makeThreshold(Milliseconds dwellTime, std::string thresholdValue,
- discrete::Severity severity = discrete::Severity::ok,
- std::string thresholdName = "treshold name")
+ std::shared_ptr<DiscreteThreshold> makeThreshold(
+ Milliseconds dwellTime, std::string thresholdValue,
+ discrete::Severity severity = discrete::Severity::ok,
+ std::string thresholdName = "treshold name")
{
std::vector<std::unique_ptr<interfaces::TriggerAction>> actions;
actions.push_back(std::move(actionMockPtr));
@@ -61,8 +61,8 @@
{
EXPECT_CALL(*sensor,
registerForUpdates(Truly([sut = sut.get()](const auto& x) {
- return x.lock().get() == sut;
- })));
+ return x.lock().get() == sut;
+ })));
}
sut->initialize();
@@ -230,8 +230,9 @@
TriggerValue(GetParam().thresholdValue)))
.WillOnce(DoAll(
InvokeWithoutArgs([idx = index, ×tamps] {
- timestamps[idx] = std::chrono::high_resolution_clock::now();
- }),
+ timestamps[idx] =
+ std::chrono::high_resolution_clock::now();
+ }),
InvokeWithoutArgs(DbusEnvironment::setPromise("commit"))));
}
diff --git a/tests/src/test_metric.cpp b/tests/src/test_metric.cpp
index f042c9e..85cd9c9 100644
--- a/tests/src/test_metric.cpp
+++ b/tests/src/test_metric.cpp
@@ -26,8 +26,8 @@
clockFake.system.set(systemTimestamp);
}
- static std::vector<std::shared_ptr<SensorMock>>
- makeSensorMocks(size_t amount)
+ static std::vector<std::shared_ptr<SensorMock>> makeSensorMocks(
+ size_t amount)
{
std::vector<std::shared_ptr<SensorMock>> result;
for (size_t i = 0; i < amount; ++i)
@@ -66,8 +66,8 @@
EXPECT_CALL(*sensorMocks.front(),
registerForUpdates(Truly([sut = sut.get()](const auto& a0) {
- return a0.lock().get() == sut;
- })));
+ return a0.lock().get() == sut;
+ })));
sut->initialize();
}
@@ -78,8 +78,8 @@
EXPECT_CALL(*sensorMocks.front(),
unregisterFromUpdates(Truly([sut = sut.get()](const auto& a0) {
- return a0.lock().get() == sut;
- })));
+ return a0.lock().get() == sut;
+ })));
sut->deinitialize();
}
@@ -351,8 +351,8 @@
clockFake.advance(timestamp);
}
- const auto [expectedTimestamp,
- expectedReading] = GetParam().expectedReading();
+ const auto [expectedTimestamp, expectedReading] =
+ GetParam().expectedReading();
const auto readings = sut->getUpdatedReadings();
EXPECT_THAT(readings, ElementsAre(MetricValue{"metadata0", expectedReading,
@@ -370,8 +370,8 @@
sut->getUpdatedReadings();
}
- const auto [expectedTimestamp,
- expectedReading] = GetParam().expectedReading();
+ const auto [expectedTimestamp, expectedReading] =
+ GetParam().expectedReading();
const auto readings = sut->getUpdatedReadings();
EXPECT_THAT(readings, ElementsAre(MetricValue{"metadata0", expectedReading,
diff --git a/tests/src/test_numeric_threshold.cpp b/tests/src/test_numeric_threshold.cpp
index 587a1bb..2bcbfac 100644
--- a/tests/src/test_numeric_threshold.cpp
+++ b/tests/src/test_numeric_threshold.cpp
@@ -60,8 +60,8 @@
{
EXPECT_CALL(*sensor,
registerForUpdates(Truly([sut = sut.get()](const auto& x) {
- return x.lock().get() == sut;
- })));
+ return x.lock().get() == sut;
+ })));
}
sut->initialize();
@@ -205,8 +205,9 @@
_, TriggerValue(value)))
.WillOnce(DoAll(
InvokeWithoutArgs([idx = index, ×tamps] {
- timestamps[idx] = std::chrono::high_resolution_clock::now();
- }),
+ timestamps[idx] =
+ std::chrono::high_resolution_clock::now();
+ }),
InvokeWithoutArgs(DbusEnvironment::setPromise("commit"))));
}
@@ -251,109 +252,111 @@
}
};
-INSTANTIATE_TEST_SUITE_P(_, TestNumericThresholdNoDwellTime,
- Values(NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 89.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 91.0}})
- .Expected({{0, 91.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 99.0}, {0, 80.0}, {0, 98.0}})
- .Expected({{0, 99.0}, {0, 98.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0, 100.0})
- .Updates({{0, 99.0}, {1, 98.0}})
- .Expected({{0, 99.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 91.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0}})
- .Expected({{0, 80.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0}, {0, 99.0}, {0, 85.0}})
- .Expected({{0, 80.0}, {0, 85.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0, 99.0})
- .Updates({{0, 80.0}, {1, 88.0}})
- .Expected({{0, 80.0}, {1, 88.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({98.0})
- .Updates({{0, 91.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0})
- .Updates({{0, 80.0}, {0, 85.0}, {0, 91.0}})
- .Expected({{0, 80.0}, {0, 91.0}}),
- NumericParams()
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0, 80.0})
- .Updates({{0, 85.0}, {1, 91.0}})
- .Expected({{0, 85.0}, {1, 91.0}}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({40.0})
- .Updates({{0, 30.0}, {0, 20.0}})
- .Expected({{0, 20.0}}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({20.0})
- .Updates({{0, 30.0}, {0, 20.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::either)
- .InitialValues({20.0})
- .Updates({{0, 30.0}, {0, 20.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({20.0})
- .Updates({{0, 30.0}, {0, 40.0}})
- .Expected({{0, 40.0}}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({40.0})
- .Updates({{0, 30.0}, {0, 40.0}})
- .Expected({}),
- NumericParams()
- .ThresholdValue(30.0)
- .Direction(numeric::Direction::either)
- .InitialValues({40.0})
- .Updates({{0, 30.0}, {0, 40.0}})
- .Expected({})));
+INSTANTIATE_TEST_SUITE_P(
+ _, TestNumericThresholdNoDwellTime,
+ Values(
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 89.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 91.0}})
+ .Expected({{0, 91.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 99.0}, {0, 80.0}, {0, 98.0}})
+ .Expected({{0, 99.0}, {0, 98.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0, 100.0})
+ .Updates({{0, 99.0}, {1, 98.0}})
+ .Expected({{0, 99.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 91.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0}})
+ .Expected({{0, 80.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0}, {0, 99.0}, {0, 85.0}})
+ .Expected({{0, 80.0}, {0, 85.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0, 99.0})
+ .Updates({{0, 80.0}, {1, 88.0}})
+ .Expected({{0, 80.0}, {1, 88.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({98.0})
+ .Updates({{0, 91.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0}, {0, 85.0}, {0, 91.0}})
+ .Expected({{0, 80.0}, {0, 91.0}}),
+ NumericParams()
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0, 80.0})
+ .Updates({{0, 85.0}, {1, 91.0}})
+ .Expected({{0, 85.0}, {1, 91.0}}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({40.0})
+ .Updates({{0, 30.0}, {0, 20.0}})
+ .Expected({{0, 20.0}}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({20.0})
+ .Updates({{0, 30.0}, {0, 20.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({20.0})
+ .Updates({{0, 30.0}, {0, 20.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({20.0})
+ .Updates({{0, 30.0}, {0, 40.0}})
+ .Expected({{0, 40.0}}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({40.0})
+ .Updates({{0, 30.0}, {0, 40.0}})
+ .Expected({}),
+ NumericParams()
+ .ThresholdValue(30.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({40.0})
+ .Updates({{0, 30.0}, {0, 40.0}})
+ .Expected({})));
TEST_P(TestNumericThresholdNoDwellTime, senorsIsUpdatedMultipleTimes)
{
@@ -378,163 +381,165 @@
INSTANTIATE_TEST_SUITE_P(
SleepAfterEveryUpdate, TestNumericThresholdWithDwellTime,
- Values(NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 89.0, 200ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 91.0, 200ms}})
- .Expected({{0, 91.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 99.0, 200ms}, {0, 80.0, 100ms}, {0, 98.0, 200ms}})
- .Expected({{0, 99.0, 200ms}, {0, 98.0, 500ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0, 99.0})
- .Updates({{0, 100.0, 100ms}, {1, 86.0, 100ms}})
- .Expected({{0, 100.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 91.0, 200ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0, 200ms}})
- .Expected({{0, 80.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0, 200ms}, {0, 99.0, 100ms}, {0, 85.0, 200ms}})
- .Expected({{0, 80.0, 200ms}, {0, 85.0, 500ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0, 99.0})
- .Updates({{0, 80.0, 200ms}, {1, 88.0, 200ms}})
- .Expected({{0, 80.0, 200ms}, {1, 88.0, 400ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({98.0})
- .Updates({{0, 91.0, 200ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0})
- .Updates({{0, 80.0, 100ms}, {0, 85.0, 100ms}, {0, 91.0, 200ms}})
- .Expected({{0, 80.0, 200ms}, {0, 91.0, 400ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0, 80.0})
- .Updates({{0, 85.0, 100ms}, {1, 91.0, 200ms}})
- .Expected({{0, 85.0, 200ms}, {1, 91.0, 300ms}})));
+ Values(
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 89.0, 200ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 91.0, 200ms}})
+ .Expected({{0, 91.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 99.0, 200ms}, {0, 80.0, 100ms}, {0, 98.0, 200ms}})
+ .Expected({{0, 99.0, 200ms}, {0, 98.0, 500ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0, 99.0})
+ .Updates({{0, 100.0, 100ms}, {1, 86.0, 100ms}})
+ .Expected({{0, 100.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 91.0, 200ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0, 200ms}})
+ .Expected({{0, 80.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0, 200ms}, {0, 99.0, 100ms}, {0, 85.0, 200ms}})
+ .Expected({{0, 80.0, 200ms}, {0, 85.0, 500ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0, 99.0})
+ .Updates({{0, 80.0, 200ms}, {1, 88.0, 200ms}})
+ .Expected({{0, 80.0, 200ms}, {1, 88.0, 400ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({98.0})
+ .Updates({{0, 91.0, 200ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0, 100ms}, {0, 85.0, 100ms}, {0, 91.0, 200ms}})
+ .Expected({{0, 80.0, 200ms}, {0, 91.0, 400ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0, 80.0})
+ .Updates({{0, 85.0, 100ms}, {1, 91.0, 200ms}})
+ .Expected({{0, 85.0, 200ms}, {1, 91.0, 300ms}})));
INSTANTIATE_TEST_SUITE_P(
SleepAfterLastUpdate, TestNumericThresholdWithDwellTime,
- Values(NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 89.0, 300ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 91.0, 300ms}})
- .Expected({{0, 91.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0})
- .Updates({{0, 99.0}, {0, 80.0}, {0, 98.0, 300ms}})
- .Expected({{0, 98.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::increasing)
- .InitialValues({80.0, 99.0})
- .Updates({{0, 100.0}, {1, 98.0, 300ms}})
- .Expected({{0, 100.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 91.0, 300ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0, 300ms}})
- .Expected({{0, 80.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0})
- .Updates({{0, 80.0}, {0, 99.0}, {0, 85.0, 300ms}})
- .Expected({{0, 85.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::decreasing)
- .InitialValues({100.0, 99.0})
- .Updates({{0, 80.0}, {1, 88.0, 300ms}})
- .Expected({{0, 80.0, 200ms}, {1, 88.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({98.0})
- .Updates({{0, 91.0, 300ms}})
- .Expected({}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0})
- .Updates({{0, 80.0}, {0, 85.0}, {0, 91.0, 300ms}})
- .Expected({{0, 91.0, 200ms}}),
- NumericParams()
- .DwellTime(200ms)
- .ThresholdValue(90.0)
- .Direction(numeric::Direction::either)
- .InitialValues({100.0, 80.0})
- .Updates({{0, 85.0}, {1, 91.0, 300ms}})
- .Expected({{0, 85.0, 200ms}, {1, 91.0, 200ms}})));
+ Values(
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 89.0, 300ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 91.0, 300ms}})
+ .Expected({{0, 91.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0})
+ .Updates({{0, 99.0}, {0, 80.0}, {0, 98.0, 300ms}})
+ .Expected({{0, 98.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::increasing)
+ .InitialValues({80.0, 99.0})
+ .Updates({{0, 100.0}, {1, 98.0, 300ms}})
+ .Expected({{0, 100.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 91.0, 300ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0, 300ms}})
+ .Expected({{0, 80.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0}, {0, 99.0}, {0, 85.0, 300ms}})
+ .Expected({{0, 85.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::decreasing)
+ .InitialValues({100.0, 99.0})
+ .Updates({{0, 80.0}, {1, 88.0, 300ms}})
+ .Expected({{0, 80.0, 200ms}, {1, 88.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({98.0})
+ .Updates({{0, 91.0, 300ms}})
+ .Expected({}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0})
+ .Updates({{0, 80.0}, {0, 85.0}, {0, 91.0, 300ms}})
+ .Expected({{0, 91.0, 200ms}}),
+ NumericParams()
+ .DwellTime(200ms)
+ .ThresholdValue(90.0)
+ .Direction(numeric::Direction::either)
+ .InitialValues({100.0, 80.0})
+ .Updates({{0, 85.0}, {1, 91.0, 300ms}})
+ .Expected({{0, 85.0, 200ms}, {1, 91.0, 200ms}})));
TEST_P(TestNumericThresholdWithDwellTime, senorsIsUpdatedMultipleTimes)
{
diff --git a/tests/src/test_on_change_threshold.cpp b/tests/src/test_on_change_threshold.cpp
index 0623a10..b4a6fd3 100644
--- a/tests/src/test_on_change_threshold.cpp
+++ b/tests/src/test_on_change_threshold.cpp
@@ -51,8 +51,8 @@
{
EXPECT_CALL(*sensor,
registerForUpdates(Truly([sut = sut.get()](const auto& x) {
- return x.lock().get() == sut;
- })));
+ return x.lock().get() == sut;
+ })));
}
sut->initialize();
diff --git a/tests/src/test_persistent_json_storage.cpp b/tests/src/test_persistent_json_storage.cpp
index cec0019..c83d5f1 100644
--- a/tests/src/test_persistent_json_storage.cpp
+++ b/tests/src/test_persistent_json_storage.cpp
@@ -116,14 +116,14 @@
struct TestFileSymlink
{
- static interfaces::JsonStorage::FilePath
- setupSymlinks(const std::filesystem::path& originalFile,
- const interfaces::JsonStorage::DirectoryPath& directory)
+ static interfaces::JsonStorage::FilePath setupSymlinks(
+ const std::filesystem::path& originalFile,
+ const interfaces::JsonStorage::DirectoryPath& directory)
{
- auto linkPath = std::filesystem::path(directory) /
- "report/symlink.json";
- std::filesystem::create_directories(std::filesystem::path(directory) /
- "report");
+ auto linkPath =
+ std::filesystem::path(directory) / "report/symlink.json";
+ std::filesystem::create_directories(
+ std::filesystem::path(directory) / "report");
std::filesystem::create_symlink(originalFile, linkPath);
return interfaces::JsonStorage::FilePath(linkPath);
}
@@ -131,17 +131,17 @@
struct TestDirectorySymlink
{
- static interfaces::JsonStorage::FilePath
- setupSymlinks(const std::filesystem::path& originalFile,
- const interfaces::JsonStorage::DirectoryPath& directory)
+ static interfaces::JsonStorage::FilePath setupSymlinks(
+ const std::filesystem::path& originalFile,
+ const interfaces::JsonStorage::DirectoryPath& directory)
{
auto linkPath = std::filesystem::path(directory) / "reportLink";
- std::filesystem::create_directories(std::filesystem::path(directory) /
- "report");
+ std::filesystem::create_directories(
+ std::filesystem::path(directory) / "report");
std::filesystem::create_directory_symlink(originalFile.parent_path(),
linkPath);
- return interfaces::JsonStorage::FilePath(linkPath /
- originalFile.filename());
+ return interfaces::JsonStorage::FilePath(
+ linkPath / originalFile.filename());
}
};
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index 709efdd..4e5e7ae 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -153,18 +153,16 @@
}
template <class T>
- static boost::system::error_code setProperty(const std::string& path,
- const std::string& property,
- const T& newValue)
+ static boost::system::error_code setProperty(
+ const std::string& path, const std::string& property, const T& newValue)
{
return DbusEnvironment::setProperty<T>(path, Report::reportIfaceName,
property, newValue);
}
template <class... Args>
- static boost::system::error_code callMethod(const std::string& path,
- const std::string& method,
- Args&&... args)
+ static boost::system::error_code callMethod(
+ const std::string& path, const std::string& method, Args&&... args)
{
return DbusEnvironment::callMethod(path, Report::reportIfaceName,
"SetReportingProperties",
@@ -198,8 +196,9 @@
std::promise<boost::system::error_code> methodPromise;
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
- methodPromise.set_value(ec);
- }, DbusEnvironment::serviceName(), path, interface, method);
+ methodPromise.set_value(ec);
+ },
+ DbusEnvironment::serviceName(), path, interface, method);
return DbusEnvironment::waitForFuture(methodPromise.get_future());
}
@@ -213,9 +212,8 @@
return call(path, Report::deleteIfaceName, "Delete");
}
- static std::pair<std::string, std::vector<std::string>>
- makeStateDetail(const std::string& detailType,
- std::vector<std::string> detailArgs)
+ static std::pair<std::string, std::vector<std::string>> makeStateDetail(
+ const std::string& detailType, std::vector<std::string> detailArgs)
{
return make_pair(detailType, detailArgs);
}
@@ -236,8 +234,8 @@
EXPECT_THAT(
getProperty<std::vector<std::string>>(sut->getPath(), "ReportActions"),
Eq(utils::transform(defaultParams().reportActions(), [](const auto v) {
- return utils::enumToString(v);
- })));
+ return utils::enumToString(v);
+ })));
EXPECT_THAT(getProperty<bool>(sut->getPath(), "EmitsReadingsUpdate"),
Eq(utils::contains(defaultParams().reportActions(),
ReportAction::emitsReadingsUpdate)));
@@ -381,8 +379,8 @@
EXPECT_THAT(
getProperty<std::vector<std::string>>(sut->getPath(), "ReportActions"),
Eq(utils::transform(defaultParams().reportActions(), [](const auto v) {
- return utils::enumToString(v);
- })));
+ return utils::enumToString(v);
+ })));
}
TEST_F(TestReport, createReportWithEmptyActions)
@@ -409,8 +407,8 @@
ReportParams()
.reportId("TestId_1")
.reportActions(utils::transform(newActions, [](const auto& action) {
- return utils::toReportAction(action);
- })));
+ return utils::toReportAction(action);
+ })));
EXPECT_THAT(
getProperty<std::vector<std::string>>(sut->getPath(), "ReportActions"),
Eq(expectedActions));
@@ -439,9 +437,9 @@
{
uint64_t newValue = ReportManager::minInterval.count() - 1;
- EXPECT_THAT(
- callMethod(sut->getPath(), "SetReportingProperties", "", newValue),
- Eq(boost::system::errc::invalid_argument));
+ EXPECT_THAT(callMethod(sut->getPath(), "SetReportingProperties", "",
+ newValue),
+ Eq(boost::system::errc::invalid_argument));
EXPECT_THAT(getProperty<uint64_t>(sut->getPath(), "Interval"),
Eq(defaultParams().interval().count()));
@@ -456,9 +454,9 @@
uint64_t newValue = ReportManager::minInterval.count();
- EXPECT_THAT(
- callMethod(report->getPath(), "SetReportingProperties", "", newValue),
- Eq(boost::system::errc::invalid_argument));
+ EXPECT_THAT(callMethod(report->getPath(), "SetReportingProperties", "",
+ newValue),
+ Eq(boost::system::errc::invalid_argument));
EXPECT_THAT(getProperty<uint64_t>(report->getPath(), "Interval"),
Eq(defaultParams().interval().count()));
@@ -728,12 +726,12 @@
void SetUp() override {}
};
-INSTANTIATE_TEST_SUITE_P(InvalidNames, TestReportInvalidIds,
- Values(defaultParams().reportId("/"),
- defaultParams().reportId("/Invalid"),
- defaultParams().reportId("Invalid/"),
- defaultParams().reportId("Invalid/Invalid/"),
- defaultParams().reportId("Invalid?")));
+INSTANTIATE_TEST_SUITE_P(
+ InvalidNames, TestReportInvalidIds,
+ Values(defaultParams().reportId("/"), defaultParams().reportId("/Invalid"),
+ defaultParams().reportId("Invalid/"),
+ defaultParams().reportId("Invalid/Invalid/"),
+ defaultParams().reportId("Invalid?")));
TEST_P(TestReportInvalidIds, failsToCreateReportWithInvalidName)
{
@@ -773,8 +771,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));
}
@@ -785,8 +783,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));
}
@@ -796,8 +794,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));
}
@@ -817,8 +815,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));
}
@@ -827,8 +825,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("b"s, 17.1, 114u),
std::make_tuple("bb"s, 42.0, 74u)));
@@ -900,8 +898,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));
}
@@ -910,8 +908,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("b"s, 17.1, 114u),
std::make_tuple("bb"s, 42.0, 74u)));
@@ -949,8 +947,8 @@
auto readings()
{
- auto [timestamp, readings] = getProperty<Readings>(sut->getPath(),
- "Readings");
+ auto [timestamp,
+ readings] = getProperty<Readings>(sut->getPath(), "Readings");
return readings;
}
@@ -1150,8 +1148,8 @@
{
EXPECT_CALL(*metric, registerForUpdates(_))
.WillOnce(Invoke([&args](const interfaces::MetricListener& report) {
- args.emplace_back(&report);
- }));
+ args.emplace_back(&report);
+ }));
;
}
@@ -1238,8 +1236,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 be199c7..53eac37 100644
--- a/tests/src/test_report_manager.cpp
+++ b/tests/src/test_report_manager.cpp
@@ -46,9 +46,9 @@
EXPECT_CALL(reportFactoryMock, convertMetricParams(_, _))
.Times(AnyNumber());
- sut = std::make_unique<ReportManager>(std::move(reportFactoryMockPtr),
- std::move(storageMockPtr),
- DbusEnvironment::getObjServer());
+ sut = std::make_unique<ReportManager>(
+ std::move(reportFactoryMockPtr), std::move(storageMockPtr),
+ DbusEnvironment::getObjServer());
}
void TearDown() override
@@ -65,8 +65,8 @@
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, "AddReport",
std::forward<Args>(args)...);
@@ -79,9 +79,10 @@
params.reportId(), params.reportName(),
utils::enumToString(params.reportingType()),
utils::enumToString(params.reportUpdates()), params.appendLimit(),
- utils::transform(
- params.reportActions(),
- [](const auto v) { return utils::enumToString(v); }),
+ utils::transform(params.reportActions(),
+ [](const auto v) {
+ return utils::enumToString(v);
+ }),
params.interval().count(),
toReadingParameters(params.metricParameters()), params.enabled());
}
@@ -389,11 +390,11 @@
for (size_t i = 0; i < ReportManager::maxNumberMetrics + 1; i++)
{
- metricParams.emplace_back(
- LabeledMetricParameters{{},
- OperationType::avg,
- CollectionTimeScope::point,
- CollectionDuration(Milliseconds(0u))});
+ metricParams.emplace_back(LabeledMetricParameters{
+ {},
+ OperationType::avg,
+ CollectionTimeScope::point,
+ CollectionDuration(Milliseconds(0u))});
}
reportParams.metricParameters(std::move(metricParams));
@@ -444,8 +445,8 @@
EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
}
- reportParams.reportId(reportParams.reportName() +
- std::to_string(ReportManager::maxReports));
+ reportParams.reportId(
+ reportParams.reportName() + std::to_string(ReportManager::maxReports));
auto [ec, path] = addReport(reportParams);
EXPECT_THAT(ec.value(), Eq(boost::system::errc::too_many_files_open));
@@ -548,9 +549,9 @@
void makeReportManager()
{
- sut = std::make_unique<ReportManager>(std::move(reportFactoryMockPtr),
- std::move(storageMockPtr),
- DbusEnvironment::getObjServer());
+ sut = std::make_unique<ReportManager>(
+ std::move(reportFactoryMockPtr), std::move(storageMockPtr),
+ DbusEnvironment::getObjServer());
}
nlohmann::json data = nlohmann::json{
diff --git a/tests/src/test_sensor.cpp b/tests/src/test_sensor.cpp
index 8738bde..3a3bcc9 100644
--- a/tests/src/test_sensor.cpp
+++ b/tests/src/test_sensor.cpp
@@ -28,8 +28,8 @@
DbusEnvironment::synchronizeIoc();
}
- void
- registerForUpdates(std::shared_ptr<interfaces::SensorListener> listener)
+ void registerForUpdates(
+ std::shared_ptr<interfaces::SensorListener> listener)
{
sut->registerForUpdates(listener);
DbusEnvironment::synchronizeIoc();
@@ -107,18 +107,18 @@
TEST_F(TestSensor, getNameReturnsPathWhenMetadataIsNotSet)
{
static const char* path = "/telemetry/ut/DbusSensorObject2";
- sut = sensorCache.makeSensor<Sensor>(DbusEnvironment::serviceName(), path,
- "", DbusEnvironment::getIoc(),
- DbusEnvironment::getBus());
+ sut = sensorCache.makeSensor<Sensor>(
+ DbusEnvironment::serviceName(), path, "", DbusEnvironment::getIoc(),
+ DbusEnvironment::getBus());
EXPECT_EQ(sut->getName(), path);
}
TEST_F(TestSensor, getNameReturnsMetadataWhenMetadataIsSet)
{
static const char* path = "/telemetry/ut/DbusSensorObject2";
- sut = sensorCache.makeSensor<Sensor>(DbusEnvironment::serviceName(), path,
- "metadata2", DbusEnvironment::getIoc(),
- DbusEnvironment::getBus());
+ sut = sensorCache.makeSensor<Sensor>(
+ DbusEnvironment::serviceName(), path, "metadata2",
+ DbusEnvironment::getIoc(), DbusEnvironment::getBus());
EXPECT_EQ(sut->getName(), "metadata2");
}
diff --git a/tests/src/test_sensor_cache.cpp b/tests/src/test_sensor_cache.cpp
index 3d12563..8c3295d 100644
--- a/tests/src/test_sensor_cache.cpp
+++ b/tests/src/test_sensor_cache.cpp
@@ -64,10 +64,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)));
@@ -75,10 +75,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));
@@ -86,21 +86,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 98162ca..c2f7774 100644
--- a/tests/src/test_trigger.cpp
+++ b/tests/src/test_trigger.cpp
@@ -67,8 +67,8 @@
sut = makeTrigger(triggerParams);
}
- static std::vector<LabeledSensorInfo>
- convertToLabeledSensor(const SensorsInfo& sensorsInfo)
+ static std::vector<LabeledSensorInfo> convertToLabeledSensor(
+ const SensorsInfo& sensorsInfo)
{
return utils::transform(sensorsInfo, [](const auto& sensorInfo) {
const auto& [sensorPath, sensorMetadata] = sensorInfo;
@@ -107,9 +107,8 @@
}
template <class T>
- static boost::system::error_code setProperty(const std::string& path,
- const std::string& property,
- const T& newValue)
+ static boost::system::error_code setProperty(
+ const std::string& path, const std::string& property, const T& newValue)
{
return DbusEnvironment::setProperty<T>(path, Trigger::triggerIfaceName,
property, newValue);
@@ -140,8 +139,9 @@
std::promise<boost::system::error_code> methodPromise;
DbusEnvironment::getBus()->async_method_call(
[&methodPromise](boost::system::error_code ec) {
- methodPromise.set_value(ec);
- }, DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
+ methodPromise.set_value(ec);
+ },
+ DbusEnvironment::serviceName(), path, Trigger::deleteIfaceName,
"Delete");
return DbusEnvironment::waitForFuture(methodPromise.get_future());
}
@@ -519,8 +519,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_manager.cpp b/tests/src/test_trigger_manager.cpp
index 3204b19..f425350 100644
--- a/tests/src/test_trigger_manager.cpp
+++ b/tests/src/test_trigger_manager.cpp
@@ -19,8 +19,8 @@
{
public:
TriggerParams triggerParams;
- std::pair<boost::system::error_code, std::string>
- addTrigger(const TriggerParams& params)
+ std::pair<boost::system::error_code, std::string> addTrigger(
+ const TriggerParams& params)
{
const auto sensorInfos =
utils::fromLabeledSensorsInfo(params.sensors());
@@ -38,14 +38,15 @@
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(),
params.name(),
- utils::transform(
- params.triggerActions(),
- [](const auto& action) { return actionToString(action); }),
+ utils::transform(params.triggerActions(),
+ [](const auto& action) {
+ return actionToString(action);
+ }),
sensorInfos, params.reports(), numThresh2, discThresh2);
return DbusEnvironment::waitForFuture(addTriggerPromise.get_future());
}
@@ -393,8 +394,8 @@
EXPECT_THAT(ec.value(), Eq(boost::system::errc::success));
}
- triggerParams.id(TriggerParams().id() +
- std::to_string(TriggerManager::maxTriggers));
+ triggerParams.id(
+ TriggerParams().id() + std::to_string(TriggerManager::maxTriggers));
auto [ec, path] = addTrigger(triggerParams);
EXPECT_THAT(ec.value(), Eq(boost::system::errc::too_many_files_open));
EXPECT_THAT(path, Eq(std::string()));
@@ -473,8 +474,8 @@
TriggerParams().thresholdParams().index()},
{"TriggerActions", utils::transform(TriggerParams().triggerActions(),
[](const auto& action) {
- return actionToString(action);
- })},
+ return actionToString(action);
+ })},
{"ThresholdParams", utils::labeledThresholdParamsToJson(
TriggerParams().thresholdParams())},
{"ReportIds", TriggerParams().reportIds()},