Browse Source

testing: addition sum of two positiv double numbers

master
Dennis Sperzel 11 months ago
parent
commit
619fbe2934
  1. 17
      test/test_addition.c

17
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
Loading…
Cancel
Save