From 619fbe293486256493bc029bc101ebf94a537240 Mon Sep 17 00:00:00 2001 From: Dennis Sperzel Date: Thu, 8 Feb 2024 09:05:33 +0100 Subject: [PATCH] testing: addition sum of two positiv double numbers --- test/test_addition.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/test/test_addition.c b/test/test_addition.c index bbe2788..f3d9f4e 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -381,4 +381,19 @@ void test_addition_addition_precision_double_positivnumberlowerthan2tothepowerof TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); } -#endif // TEST +void test_addition_addition_double_sumofpositivnumbers(void) +{ + double result[3]; + numberd[0].dnum = 93415405440107.45515, numberd[1].dnum = 78634100530331.45341, numberd[2].dnum = 0.00043419445734139434, numberd[3].dnum = 940313051379341035.3739, numberd[4].dnum = 0.000007936136439442513434, numberd[5].dnum = 0.0000000093953351384343102; + double expected[3] = { numberd[0].dnum + numberd[1].dnum, numberd[2].dnum + numberd[3].dnum, numberd[4].dnum + numberd[5].dnum }; + + result[0] = addition_double(numberd[0].dnum, numberd[1].dnum); + result[1] = addition_double(numberd[2].dnum, numberd[3].dnum); + result[2] = addition_double(numberd[4].dnum, numberd[5].dnum); + + TEST_ASSERT_EQUAL_DOUBLE(expected[0], result[0]); + TEST_ASSERT_EQUAL_DOUBLE(expected[1], result[1]); + TEST_ASSERT_EQUAL_DOUBLE(expected[2], result[2]); +} + +#endif // TEST \ No newline at end of file