Created metric class
Metric collects updates from sensor. Report displays metric readings
depending on reportingType.
Tested:
- Added new units tests for Metric class
- All other unit tests are passing
Change-Id: I19f4831fab163a4f9540cef7bb23e903ae90fddf
Signed-off-by: Krzysztof Grobelny <krzysztof.grobelny@intel.com>
diff --git a/tests/src/mocks/sensor_mock.hpp b/tests/src/mocks/sensor_mock.hpp
index 0dcb2b5..d71d77e 100644
--- a/tests/src/mocks/sensor_mock.hpp
+++ b/tests/src/mocks/sensor_mock.hpp
@@ -8,11 +8,14 @@
class SensorMock : public interfaces::Sensor
{
public:
+ explicit SensorMock()
+ {
+ initialize();
+ }
+
explicit SensorMock(Id sensorId) : mockSensorId(sensorId)
{
- ON_CALL(*this, id()).WillByDefault(testing::Invoke([this] {
- return this->mockSensorId;
- }));
+ initialize();
}
static Id makeId(std::string_view service, std::string_view path)
@@ -27,4 +30,12 @@
const uint64_t mockId = generateUniqueMockId();
Id mockSensorId = Id("SensorMock", "", "");
+
+ private:
+ void initialize()
+ {
+ ON_CALL(*this, id()).WillByDefault(testing::Invoke([this] {
+ return this->mockSensorId;
+ }));
+ }
};