fix false value if analog + dighybrid on last digit if previous >=9.5

This commit is contained in:
Frank Haverland
2022-07-16 19:37:30 +02:00
parent ebd8fe0e4f
commit eab8a6d96b
2 changed files with 22 additions and 6 deletions

View File

@@ -41,6 +41,9 @@ void test_ZeigerEval()
// the 4.4 (digital100) is not above 5 and the previous digit (analog) too (9.3)
TEST_ASSERT_EQUAL(4, undertest.ZeigerEval(4.4, 9));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) too (9.6)
TEST_ASSERT_EQUAL(4, undertest.ZeigerEval(4.5, 0));
}
/**
@@ -77,5 +80,13 @@ void test_ZeigerEvalHybrid() {
// the 5.7 with previous and the previous >=9.5 should trunc to 5
TEST_ASSERT_EQUAL(5, undertest.ZeigerEvalHybrid(5.7, 9.6, 9));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybrid(4.5, 9.6, 0));
// the 4.5 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.6)
TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybrid(4.5, 9.6, 9));
// the 4.4 (digital100) is not above 5 and the previous digit (analog) not over Zero (9.5)
TEST_ASSERT_EQUAL(4, undertest.ZeigerEvalHybrid(4.5, 9.5, 9));
}