Fix numeric threshold

There was an issue when sensor value reach threshold set by the user.
Example: given numeric threshold, set as increasing with value of 20.0,
and following sensor updates: 20 -> 30 -> 40, trigger action  would not
start, which is clearly a defect, as 30 is crossed.

Testing done:
- numeric threshold now works with example given above.
- UTs were updated and are passing.

Signed-off-by: Szymon Dompke <szymon.dompke@intel.com>
Change-Id: I955876e076f2286efd98d187cae775a7ab2f4e28
diff --git a/tests/src/test_numeric_threshold.cpp b/tests/src/test_numeric_threshold.cpp
index 69ad0de..902e72f 100644
--- a/tests/src/test_numeric_threshold.cpp
+++ b/tests/src/test_numeric_threshold.cpp
@@ -320,7 +320,43 @@
                                     .Direction(numeric::Direction::either)
                                     .InitialValues({100.0, 80.0})
                                     .Updates({{0, 85.0}, {1, 91.0}})
-                                    .Expected({{0, 85.0}, {1, 91.0}})));
+                                    .Expected({{0, 85.0}, {1, 91.0}}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::decreasing)
+                                    .InitialValues({40.0})
+                                    .Updates({{0, 30.0}, {0, 20.0}})
+                                    .Expected({{0, 20.0}}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::decreasing)
+                                    .InitialValues({20.0})
+                                    .Updates({{0, 30.0}, {0, 20.0}})
+                                    .Expected({}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::either)
+                                    .InitialValues({20.0})
+                                    .Updates({{0, 30.0}, {0, 20.0}})
+                                    .Expected({}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::increasing)
+                                    .InitialValues({20.0})
+                                    .Updates({{0, 30.0}, {0, 40.0}})
+                                    .Expected({{0, 40.0}}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::increasing)
+                                    .InitialValues({40.0})
+                                    .Updates({{0, 30.0}, {0, 40.0}})
+                                    .Expected({}),
+                                NumericParams()
+                                    .ThresholdValue(30.0)
+                                    .Direction(numeric::Direction::either)
+                                    .InitialValues({40.0})
+                                    .Updates({{0, 30.0}, {0, 40.0}})
+                                    .Expected({})));
 
 TEST_P(TestNumericThresholdNoDwellTime, senorsIsUpdatedMultipleTimes)
 {