Browse Source

testing: addition addition_float sum of two positiv integer

master
Dennis Sperzel 11 months ago
parent
commit
826a0ec5df
  1. 15
      test/test_addition.c

15
test/test_addition.c

@ -264,4 +264,19 @@ void test_addition_addition_float_0plusnumbergleichnumber(void)
TEST_ASSERT_EQUAL_FLOAT(expected[4], result[4]); TEST_ASSERT_EQUAL_FLOAT(expected[4], result[4]);
} }
void test_addition_addition_float_sumofpositivnumbers(void)
{
float result[3];
number[0].floating = 31972543.42176, number[1].floating = 423576.006432054, number[2].floating = 1346.4546124016, number[3].floating = 75620056402.5431, number[4].floating = 0.5351401453104, number[5].floating = 0.469178612;
float expected[3] = { number[0].floating + number[1].floating, number[2].floating + number[3].floating, number[4].floating + number[5].floating };
result[0] = addition_float(number[0].floating, number[1].floating);
result[1] = addition_float(number[2].floating, number[3].floating);
result[2] = addition_float(number[4].floating, number[5].floating);
TEST_ASSERT_EQUAL_FLOAT(expected[0], result[0]);
TEST_ASSERT_EQUAL_FLOAT(expected[1], result[1]);
TEST_ASSERT_EQUAL_FLOAT(expected[2], result[2]);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save