From 18a4d3836797403bc189e8ba07374e25218dca74 Mon Sep 17 00:00:00 2001 From: fdai7848 Date: Fri, 2 Feb 2024 18:02:19 +0100 Subject: [PATCH] add test for logarithmic function to base 10 --- test/test_logarithmus.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/test_logarithmus.c b/test/test_logarithmus.c index e39c8c9..d606c97 100644 --- a/test/test_logarithmus.c +++ b/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 \ No newline at end of file