Update min and max values to thresholds if needed

In an incorrect config, thresholds may be outside of
min and max, which would cause incorrect scaling. Correct
this by changing max and min to be the outliers of min/max
and thresholds. Also make it so that the max value will be
an acceptable value by scaling up the mvalue.

Tested: ipmi sensor list with bad scaled sensor works,
unit-test added to verfiy as well

Change-Id: I934efc87b09cd131e8b85a30697b3167437de4d4
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/include/sensorutils.hpp b/include/sensorutils.hpp
index 30fee66..4cb4c29 100644
--- a/include/sensorutils.hpp
+++ b/include/sensorutils.hpp
@@ -17,7 +17,6 @@
 #pragma once
 #include <cmath>
 #include <iostream>
-#include <ipmid/api.hpp>
 #include <phosphor-logging/log.hpp>
 
 namespace ipmi
@@ -132,7 +131,7 @@
         bExp -= 1;
     }
 
-    mValue = static_cast<int16_t>(mDouble) & maxInt10;
+    mValue = static_cast<int16_t>(std::round(mDouble)) & maxInt10;
     bValue = static_cast<int16_t>(bDouble) & maxInt10;
 
     return true;