Browse Source

add test for logarithmic function to base 10

master
fdai7848 11 months ago
parent
commit
18a4d38367
  1. 18
      test/test_logarithmus.c

18
test/test_logarithmus.c

@ -79,5 +79,23 @@ void test_logarithmic_function_with_decimals(void){
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.070919, r4);
}
void test_logarithmic_function_to_base_10(void){
double r1, r2, r3, r4, r5, r6;
r1 = logDec(100.0);
r2 = logDec(100.6479);
r3 = logDec(10.587);
r4 = logDec(4.341);
r5 = logDec(0.34979);
r6 = logDec(1.0);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.0, r1);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 2.002804, r2);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 1.024772, r3);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.637589, r4);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, -0.456192, r5);
TEST_ASSERT_DOUBLE_WITHIN(0.000001, 0.0, r6);
}
#endif // TEST
Loading…
Cancel
Save