add health_metric implementation

Add the interface and implementation for the health_metric to be used
in the rewrite for phosphor-health-monitor.
This change is in relation to following design and D-Bus interface
update -
https://gerrit.openbmc.org/c/openbmc/docs/+/64917
https://gerrit.openbmc.org/c/openbmc/phosphor-dbus-interfaces/+/64914

gtest added for UT.

Change-Id: Iffcc52f9dff712890377b1222fd7e7d5d6661eaf
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/health_metric_config.cpp b/health_metric_config.cpp
index 8320f25..2c0c78c 100644
--- a/health_metric_config.cpp
+++ b/health_metric_config.cpp
@@ -5,6 +5,7 @@
 #include <nlohmann/json.hpp>
 #include <phosphor-logging/lg2.hpp>
 
+#include <cmath>
 #include <fstream>
 #include <unordered_map>
 #include <utility>
@@ -79,6 +80,10 @@
         }
 
         auto config = value.template get<Threshold>();
+        if (!std::isfinite(config.value))
+        {
+            throw std::invalid_argument("Invalid threshold value");
+        }
 
         // ThresholdIntf::Bound::Upper is the only use case for
         // ThresholdIntf::Bound