diff --git a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp index 532cb091..e71c4acb 100644 --- a/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp +++ b/code/test/components/jomjol-flowcontroll/test_flowpostprocessing.cpp @@ -584,3 +584,52 @@ void test_doFlowPP_rainman110() { Digital100, false, false, 0).c_str()); delete undertestPost; } + + +void test_doFlowPP_rainman110_transition() { + + // https://github.com/jomjol/AI-on-the-edge-device/pull/2887 + // Edge cases + std::vector digits = {4.0, 1.0, 7.9}; + std::vector analogs = {1.4, 5.8, 7.7, 9.0}; + + UnderTestPost* undertestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); + setAnalogdigitTransistionStart(undertestPost, 3.5); + std::string result = process_doFlow(undertestPost); + TEST_ASSERT_EQUAL_STRING("418.1579", result.c_str()); + delete undertestPost; + + // https://github.com/jomjol/AI-on-the-edge-device/pull/2887 + // Edge cases + digits = {4.0, 1.0, 7.9}; + analogs = {3.4, 5.8, 7.7, 9.0}; + + undertestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); + setAnalogdigitTransistionStart(undertestPost, 3.5); + result = process_doFlow(undertestPost); + TEST_ASSERT_EQUAL_STRING("418.3579", result.c_str()); + delete undertestPost; + + // https://github.com/jomjol/AI-on-the-edge-device/pull/2887 + // Edge cases + digits = {4.0, 1.0, 8.5}; + analogs = {3.7, 5.8, 7.7, 9.0}; + + undertestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); + setAnalogdigitTransistionStart(undertestPost, 3.5); + result = process_doFlow(undertestPost); + TEST_ASSERT_EQUAL_STRING("418.3579", result.c_str()); + delete undertestPost; + + // https://github.com/jomjol/AI-on-the-edge-device/pull/2887 + // Edge cases + digits = {4.0, 1.0, 8.9}; + analogs = {4.0, 5.8, 7.7, 9.0}; + + undertestPost = init_do_flow(analogs, digits, Digital100, false, false, 0); + setAnalogdigitTransistionStart(undertestPost, 3.5); + result = process_doFlow(undertestPost); + TEST_ASSERT_EQUAL_STRING("418.4579", result.c_str()); + delete undertestPost; + +} diff --git a/code/test/test_suite_flowcontroll.cpp b/code/test/test_suite_flowcontroll.cpp index 73206d06..64b7aaf5 100644 --- a/code/test/test_suite_flowcontroll.cpp +++ b/code/test/test_suite_flowcontroll.cpp @@ -140,6 +140,8 @@ void task_UnityTesting(void *pvParameter) RUN_TEST(test_doFlowPP4); printf("---------------------------------------------------------------------------\n"); RUN_TEST(test_doFlowPP_rainman110); + printf("---------------------------------------------------------------------------\n"); + RUN_TEST(test_doFlowPP_rainman110_transition); UNITY_END(); while(1);