clang-tidy: Improve const-correctness
Updated member functions to better reflect const-correctness,
enhancing code clarity and maintainability.
Change-Id: Ib3fdbd2164cb76ad7f0c454d37dd5c08652f78fc
Signed-off-by: Jayanth Othayoth <ojayanth@gmail.com>
diff --git a/tests/src/mocks/report_factory_mock.hpp b/tests/src/mocks/report_factory_mock.hpp
index 71709df..24ac28c 100644
--- a/tests/src/mocks/report_factory_mock.hpp
+++ b/tests/src/mocks/report_factory_mock.hpp
@@ -69,7 +69,7 @@
auto& expectMake(
std::optional<std::reference_wrapper<const ReportParams>> paramsRef,
const testing::Matcher<interfaces::ReportManager&>& rm,
- const testing::Matcher<interfaces::JsonStorage&>& js)
+ const testing::Matcher<interfaces::JsonStorage&>& js) const
{
using testing::_;
if (paramsRef)
diff --git a/tests/src/mocks/trigger_factory_mock.hpp b/tests/src/mocks/trigger_factory_mock.hpp
index d3d83e5..a42747c 100644
--- a/tests/src/mocks/trigger_factory_mock.hpp
+++ b/tests/src/mocks/trigger_factory_mock.hpp
@@ -57,7 +57,7 @@
auto& expectMake(
std::optional<TriggerParams> paramsOpt,
const testing::Matcher<interfaces::TriggerManager&>& tm,
- const testing::Matcher<interfaces::JsonStorage&>& triggerStorage)
+ const testing::Matcher<interfaces::JsonStorage&>& triggerStorage) const
{
using namespace testing;
diff --git a/tests/src/test_report.cpp b/tests/src/test_report.cpp
index 4e5e7ae..28ad3b6 100644
--- a/tests/src/test_report.cpp
+++ b/tests/src/test_report.cpp
@@ -98,7 +98,7 @@
}
std::vector<std::shared_ptr<interfaces::Metric>>
- getMetricsFromReadingParams(const ReadingParameters& params)
+ getMetricsFromReadingParams(const ReadingParameters& params) const
{
const auto metricParameters =
reportFactoryMock->convertMetricParams(params);
diff --git a/tests/src/test_trigger_actions.cpp b/tests/src/test_trigger_actions.cpp
index 8e8274f..e1a2a1c 100644
--- a/tests/src/test_trigger_actions.cpp
+++ b/tests/src/test_trigger_actions.cpp
@@ -150,7 +150,7 @@
commitValue = value;
}
- void commit()
+ void commit() const
{
std::string thresholdName = "MyThreshold";
sut->commit("MyTrigger", std::cref(thresholdName), "MySensor",
@@ -188,7 +188,7 @@
sut = std::make_unique<LogToRedfishEventLog>();
}
- void commit(TriggerValue value)
+ void commit(TriggerValue value) const
{
std::string thresholdName = "MyThreshold";
sut->commit("MyTrigger", std::cref(thresholdName), "MySensor",
@@ -276,7 +276,7 @@
std::make_shared<std::vector<std::string>>(std::move(names)));
}
- void commit(TriggerValue value)
+ void commit(TriggerValue value) const
{
sut->commit(triggerId, std::nullopt, "MySensor", Milliseconds{100'000},
value);