Browse Source

testing: addition addition_float base case 0+number=number

master
Dennis Sperzel 11 months ago
parent
commit
feeafc2a74
  1. 18
      test/test_addition.c

18
test/test_addition.c

@ -195,4 +195,22 @@ void test_addition_addition_float_0plus0gleich0(void) {
TEST_ASSERT_EQUAL_FLOAT(expected, result); TEST_ASSERT_EQUAL_FLOAT(expected, result);
} }
void test_addition_addition_float_0plusnumbergleichnumber(void) {
float result[5];
number[0].floating = 45672.56487, number[1].floating = -9531145672.467, number[2].floating = 91357634, number[3].floating = -0.0000000079533144, number[4].floating = 0.0756215698;
float expected[5] = { number[0].floating, number[1].floating, number[2].floating, number[3].floating, number[4].floating };
result[0] = addition_float(number[0].floating, (float) 0.0);
result[1] = addition_float((float) 0.0, number[1].floating);
result[2] = addition_float(number[2].floating, (float) 0.0);
result[3] = addition_float((float) 0.0, number[3].floating);
result[4] = addition_float((float) 0.0, number[4].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]);
TEST_ASSERT_EQUAL_FLOAT(expected[3], result[3]);
TEST_ASSERT_EQUAL_FLOAT(expected[4], result[4]);
}
#endif // TEST #endif // TEST
Loading…
Cancel
Save