mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-11 22:16:56 +03:00
test fixes from haverland
This commit is contained in:
@@ -46,7 +46,7 @@ void test_analogToDigit_Standard() {
|
||||
// Default: dig=6.8, ana=8.6 => erg=7
|
||||
// Transition = no
|
||||
// Offset = no
|
||||
TEST_ASSERT_EQUAL_INT(7, undertest->PointerEvalAnalogToDigitNew( 6.8, 8.6, 6, 9.2));
|
||||
TEST_ASSERT_EQUAL_INT(7, undertest->PointerEvalAnalogToDigitNew( 6.8, 8.6, 8, 9.2));
|
||||
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/1143#issuecomment-1274434805
|
||||
// Also hanging digit () with small pointer after 0 pass.
|
||||
|
||||
@@ -41,6 +41,22 @@ void test_ZeigerEval()
|
||||
/**
|
||||
* @brief test if all combinations of digit
|
||||
* evaluation are running correctly
|
||||
*
|
||||
* Desciption on call undertest.PointerEvalHybridNew(float number, float number_of_predecessors, int eval_predecessors, bool Analog_Predecessors, float digitalAnalogTransitionStart)
|
||||
* @param number: is the current ROI as float value from recognition
|
||||
* @param number_of_predecessors: is the last (lower) ROI as float from recognition
|
||||
* @param eval_predecessors: is the evaluated number. Sometimes a much lower value can change higer values
|
||||
* example: 9.8, 9.9, 0.1
|
||||
* 0.1 => 0 (eval_predecessors)
|
||||
* The 0 makes a 9.9 to 0 (eval_predecessors)
|
||||
* The 0 makes a 9.8 to 0
|
||||
* @param Analog_Predecessors false/true if the last ROI is an analog or digital ROI (default=false)
|
||||
* runs in special handling because analog is much less precise
|
||||
* @param digitalAnalogTransitionStart start of the transitionlogic begins on number_of_predecessor (default=9.2)
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
void test_ZeigerEvalHybrid() {
|
||||
UnderTestCNN undertest = UnderTestCNN(nullptr, Digital100);
|
||||
@@ -55,11 +71,11 @@ void test_ZeigerEvalHybrid() {
|
||||
|
||||
printf("PointerEvalHybridNew(5.7, 0, -1)\n");
|
||||
// the 5.7 and no previous should trunc to 5
|
||||
TEST_ASSERT_EQUAL(6, undertest.PointerEvalHybridNew(5.7, 0, -1));
|
||||
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.7, 0, -1, false, 9.2));
|
||||
|
||||
// the 5.8 and no previous should round up to 6
|
||||
printf("PointerEvalHybridNew(5.8, 0, -1)\n");
|
||||
TEST_ASSERT_EQUAL(6, undertest.PointerEvalHybridNew(5.8, 0, -1));
|
||||
TEST_ASSERT_EQUAL(6, undertest.PointerEvalHybridNew(5.8, 8.0, 8, false, 8.0));
|
||||
|
||||
// the 5.7 with previous and the previous between 0.3-0.5 should round up to 6
|
||||
TEST_ASSERT_EQUAL(6, undertest.PointerEvalHybridNew(5.7, 0.4, 1));
|
||||
@@ -70,8 +86,9 @@ void test_ZeigerEvalHybrid() {
|
||||
// the 5.3 with previous and the previous <=0.5 should trunc to 5
|
||||
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.3, 0.1, 1));
|
||||
|
||||
// the 5.3 with previous and the previous >=9.5 should reduce to 4
|
||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(5.3, 9.6, 9));
|
||||
// the 5.2 with previous and the previous >=9.8 should reduce to 4
|
||||
// the digit is already over transistion, but a analog pointer runs behind
|
||||
TEST_ASSERT_EQUAL(4, undertest.PointerEvalHybridNew(5.2, 9.8, 9, false, 9.0));
|
||||
|
||||
// the 5.7 with previous and the previous >=9.5 should trunc to 5
|
||||
TEST_ASSERT_EQUAL(5, undertest.PointerEvalHybridNew(5.7, 9.6, 9));
|
||||
@@ -104,4 +121,3 @@ void test_ZeigerEvalHybrid() {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#include "test_flow_postrocess_helper.h"
|
||||
|
||||
|
||||
|
||||
#include <memory>
|
||||
|
||||
/**
|
||||
* ACHTUNG! Die Test laufen aktuell nur mit ausgeschaltetem Debug in ClassFlowCNNGeneral
|
||||
@@ -114,28 +113,28 @@ void test_doFlowPP1() {
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/942#issuecomment-1226966346
|
||||
std::vector<float> digits = { 0.0, 2.9, 3.0, 2.9, 3.5, 9.5};
|
||||
std::vector<float> analogs = { };
|
||||
const char* expected = "33330";
|
||||
const char* expected = "33339";
|
||||
std::string result = process_doFlow(analogs, digits);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/942#issuecomment-1226966346
|
||||
digits = { 9.9, 2.8, 2.9, 2.9, 3.7, 9.7};
|
||||
analogs = { };
|
||||
expected = "33340";
|
||||
expected = "33339";
|
||||
result = process_doFlow(analogs, digits);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/942
|
||||
digits = { 0.0, 9.9, 6.8, 9.9, 3.7, 0.8, 6.9, 8.7};
|
||||
analogs = { };
|
||||
expected = "704179";
|
||||
expected = "704178";
|
||||
result = process_doFlow(analogs, digits);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/942#issuecomment-1228343319
|
||||
digits = { 9.9, 6.8, 1.1, 4.7, 2.7, 6.0, 9.0, 2.8}; // changed 3.7 --> 2.7 (see picture in issue)
|
||||
analogs = { };
|
||||
expected = "7153693";
|
||||
expected = "7153692";
|
||||
result = process_doFlow(analogs, digits);
|
||||
TEST_ASSERT_EQUAL_STRING(expected, result.c_str());
|
||||
|
||||
@@ -185,7 +184,7 @@ void test_doFlowPP2() {
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/921#issuecomment-1242730397
|
||||
digits = { 3.0, 2.0, 2.0, 8.0, 9.0, 4.0, 1.7, 9.8}; // falscher Wert 32290.420
|
||||
analogs = { };
|
||||
expected = "32289.420";
|
||||
expected = "32289.419";
|
||||
const char* expected_extended= "32289.4198";
|
||||
// FALSCH! wegen ungenügender Präzision von NUMBERS->Value
|
||||
// expected_extended= "32289.4198";
|
||||
@@ -230,7 +229,7 @@ void test_doFlowPP2() {
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/994#issue-1368570945
|
||||
digits = { 0.0, 0.0, 1.0, 2.0, 2.8, 1.9, 2.8, 5.6}; // 123245.6 als falsches Ergebnis
|
||||
analogs = { };
|
||||
expected = "123236";
|
||||
expected = "123235";
|
||||
expected_extended= "123235.6";
|
||||
|
||||
// checkConsistency=true
|
||||
@@ -543,3 +542,26 @@ void test_doFlowPP4() {
|
||||
}
|
||||
|
||||
|
||||
void test_doFlowPP_rainman110() {
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/issues/2743
|
||||
// --> Extreme early digit transition. AnanlogDigitTransition needs to set to 3.5 (was limited to 6)
|
||||
std::vector<float> digits = {4.0, 1.0, 1.8}; // wrong result: 412.3983
|
||||
std::vector<float> analogs = {3.6, 9.9, 8.1, 3.5};
|
||||
|
||||
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("411.3983", result.c_str());
|
||||
delete undertestPost;
|
||||
|
||||
// https://github.com/jomjol/AI-on-the-edge-device/pull/2887
|
||||
// --> Extreme early digit transition. AnanlogDigitTransition needs to set to 3.5 (was limited to 6)
|
||||
digits = {4.0, 1.0, 7.9}; // wrong result: 417.2579
|
||||
analogs = {2.5, 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.2579", result.c_str());
|
||||
delete undertestPost;
|
||||
}
|
||||
|
||||
@@ -138,6 +138,8 @@ void task_UnityTesting(void *pvParameter)
|
||||
RUN_TEST(test_doFlowPP3);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP4);
|
||||
printf("---------------------------------------------------------------------------\n");
|
||||
RUN_TEST(test_doFlowPP_rainman110);
|
||||
UNITY_END();
|
||||
|
||||
while(1);
|
||||
@@ -149,24 +151,11 @@ void task_UnityTesting(void *pvParameter)
|
||||
*/
|
||||
extern "C" void app_main()
|
||||
{
|
||||
initGPIO();
|
||||
Init_NVS_SDCard();
|
||||
esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to ERROR level
|
||||
initGPIO();
|
||||
Init_NVS_SDCard();
|
||||
esp_log_level_set("*", ESP_LOG_DEBUG); // set all components to DEBUG level
|
||||
|
||||
UNITY_BEGIN();
|
||||
RUN_TEST(testNegative_Issues);
|
||||
RUN_TEST(testNegative);
|
||||
/*
|
||||
RUN_TEST(test_analogToDigit_Standard);
|
||||
RUN_TEST(test_analogToDigit_Transition);
|
||||
RUN_TEST(test_doFlowPP);
|
||||
RUN_TEST(test_doFlowPP1);
|
||||
RUN_TEST(test_doFlowPP2);
|
||||
RUN_TEST(test_doFlowPP3);
|
||||
RUN_TEST(test_doFlowPP4);
|
||||
|
||||
// getReadoutRawString test
|
||||
RUN_TEST(test_getReadoutRawString);
|
||||
*/
|
||||
UNITY_END();
|
||||
// Create dedicated testing task (heap size can be configured - large enough to handle a lot of testing cases)
|
||||
// ********************************************
|
||||
xTaskCreate(&task_UnityTesting, "task_UnityTesting", 12 * 1024, NULL, tskIDLE_PRIORITY+2, NULL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user