diff --git a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp index 8eb93ed92..265a8425a 100644 --- a/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp +++ b/code/components/jomjol_flowcontroll/ClassFlowPostProcessing.cpp @@ -880,10 +880,7 @@ bool ClassFlowPostProcessing::doFlow(string zwtime) NUMBERS[j]->Value = NUMBERS[j]->PreValue; NUMBERS[j]->ReturnValue = to_string(NUMBERS[j]->PreValue); } - else if { - NUMBERS[j]->Value = NUMBERS[j]->PreValue; - NUMBERS[j]->ReturnValue = to_string(NUMBERS[j]->PreValue); - } else { + else { NUMBERS[j]->ErrorMessageText = NUMBERS[j]->ErrorMessageText + "Neg. Rate - Read: " + zwvalue + " - Raw: " + NUMBERS[j]->ReturnRawValue + " - Pre: " + RundeOutput(NUMBERS[j]->PreValue, NUMBERS[j]->Nachkomma) + " "; NUMBERS[j]->Value = NUMBERS[j]->PreValue; NUMBERS[j]->ReturnValue = ""; diff --git a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp index 5af4c7666..1e31c9cc2 100644 --- a/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flow_pp_negative.cpp @@ -51,21 +51,32 @@ void testNegative() { delete underTestPost; // extendResolution=false - // value < preValue - preValue = 16.99; // zu groß + // value < (preValue -.01) + preValue = 17.00; // zu groß underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); setAllowNegatives(underTestPost, false); - setPreValue(underTestPost, preValue_extended); + setPreValue(underTestPost, preValue); result = process_doFlow(underTestPost); - TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 16.98 - Pre: 16.99 ", underTestPost->getReadoutError().c_str()); + TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 16.98 - Pre: 17.00 ", underTestPost->getReadoutError().c_str()); TEST_ASSERT_EQUAL_STRING("", result.c_str()); delete underTestPost; + // extendResolution=false + // value > (preValue -.01) + // ist im Rahmen der Ungenauigkeit (-1 auf letzter Stelle) + preValue = 16.99; // zu groß + underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); + setAllowNegatives(underTestPost, false); + setPreValue(underTestPost, preValue); + result = process_doFlow(underTestPost); + TEST_ASSERT_EQUAL_STRING("no error", underTestPost->getReadoutError().c_str()); + TEST_ASSERT_EQUAL_STRING("16.99", result.c_str()); + delete underTestPost; // extendResolution=false // value < preValue // Aber Prüfung abgeschaltet => kein Fehler - preValue = 16.99; // zu groß + preValue = 17.99; // zu groß underTestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); setAllowNegatives(underTestPost, true); setPreValue(underTestPost, preValue_extended); @@ -84,8 +95,8 @@ void testNegative_Issues() { // Ohne decimal_shift std::vector digits = { 2.0, 2.0, 0.0, 1.0, 7.2, 9.0, 8.0}; std::vector analogs = { }; - double preValue_extended = 22018.080; - double preValue = 22018.08; + double preValue_extended = 22018.090; + double preValue = 22018.09; const char* expected = "22017.98"; @@ -93,13 +104,13 @@ void testNegative_Issues() { // extendResolution=false // value < preValue // Prüfung eingeschaltet => Fehler - preValue = 22018.08; // zu groß + preValue = 22018.09; // zu groß UnderTestPost* underTestPost = init_do_flow(analogs, digits, Digital100, false, false, -2); setAllowNegatives(underTestPost, false); setPreValue(underTestPost, preValue_extended); std::string result = process_doFlow(underTestPost); - TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 22017.98 - Pre: 22018.08 ", underTestPost->getReadoutError().c_str()); - TEST_ASSERT_EQUAL_STRING(expected, result.c_str()); + TEST_ASSERT_EQUAL_STRING("Neg. Rate - Read: - Raw: 22017.98 - Pre: 22018.09 ", underTestPost->getReadoutError().c_str()); + TEST_ASSERT_EQUAL_STRING("", result.c_str()); delete underTestPost; } \ No newline at end of file diff --git a/code/test/test_suite_flowcontroll.cpp b/code/test/test_suite_flowcontroll.cpp index 8c36cc1a7..cc7395157 100644 --- a/code/test/test_suite_flowcontroll.cpp +++ b/code/test/test_suite_flowcontroll.cpp @@ -109,8 +109,8 @@ extern "C" void app_main() UNITY_BEGIN(); RUN_TEST(testNegative_Issues); - /* RUN_TEST(testNegative); - + RUN_TEST(testNegative); + /* RUN_TEST(test_analogToDigit_Standard); RUN_TEST(test_analogToDigit_Transition); RUN_TEST(test_doFlowPP);