threshold: use absolute value for D-Bus

Use the absolute value for threshold rather than percentage value.
This involves passing the total value from the metric collection so it
can be used in percentage calculation within health metric logic.

Change-Id: I46240aee54117c70637f9fbf882018f0eac520b2
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/test/test_health_metric.cpp b/test/test_health_metric.cpp
index 1fd0b15..ad93c24 100644
--- a/test/test_health_metric.cpp
+++ b/test/test_health_metric.cpp
@@ -88,9 +88,9 @@
     auto metric = std::make_unique<HealthMetric>(bus, Type::cpu, config,
                                                  paths_t());
     // Exceed the critical threshold
-    metric->update(MValue(1200, 95.0));
+    metric->update(MValue(1351, 1500));
     // Go below critical threshold but above warning threshold
-    metric->update(MValue(1200, 85.0));
+    metric->update(MValue(1399, 1500));
     // Go below warning threshold
-    metric->update(MValue(1200, 75.0));
+    metric->update(MValue(1199, 1500));
 }
diff --git a/test/test_health_metric_collection.cpp b/test/test_health_metric_collection.cpp
index dc15f07..19c2d49 100644
--- a/test/test_health_metric_collection.cpp
+++ b/test/test_health_metric_collection.cpp
@@ -116,10 +116,10 @@
         .WillRepeatedly(Invoke(
             [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
                 [[maybe_unused]] const char* interface, const char** names) {
-        // Test no signal generation for threshold init properties
-        const std::set<std::string> thresholdProperties = {"Value", "Asserted"};
-        EXPECT_THAT(thresholdProperties,
-                    testing::Not(testing::Contains(names[0])));
+        // Test signal generated for Value property set
+        EXPECT_STREQ("Value", names[0]);
+        // Test no signal generation for threshold asserted
+        EXPECT_STRNE("Asserted", names[0]);
         return 0;
     }));
 
@@ -150,7 +150,9 @@
         .WillRepeatedly(Invoke(
             [&]([[maybe_unused]] sd_bus* bus, [[maybe_unused]] const char* path,
                 [[maybe_unused]] const char* interface, const char** names) {
-        EXPECT_THAT("Asserted", StrEq(names[0]));
+        // Test signal generation for threshold properties set
+        const std::set<std::string> thresholdProperties = {"Value", "Asserted"};
+        EXPECT_THAT(thresholdProperties, testing::Contains(names[0]));
         return 0;
     }));