Browse Source

testing: addition read exponent of a floating number

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

18
test/test_addition.c

@ -168,6 +168,24 @@ void test_addition_precisionfloatingnumber(void) {
TEST_ASSERT_EQUAL_UINT(expected[4], result[4]);
}
void test_addition_exponentfloatingnumber(void) {
unsigned int result[5];
number[0].floating = 0, number[1].floating = -762134982, number[2].floating = 47621349, number[3].floating = -0.0000078961354, number[4].floating = 0.00001568943;
unsigned int expected[5] = { ( number[0].integer << 1) >> 24 , ( number[1].integer << 1) >> 24, ( number[2].integer << 1) >> 24, ( number[3].integer << 1) >> 24, ( number[4].integer << 1) >> 24};
result[0] = e( number[0].integer );
result[1] = e( number[1].integer );
result[2] = e( number[2].integer );
result[3] = e( number[3].integer );
result[4] = e( number[4].integer );
TEST_ASSERT_EQUAL_UINT(expected[0], result[0]);
TEST_ASSERT_EQUAL_UINT(expected[1], result[1]);
TEST_ASSERT_EQUAL_UINT(expected[2], result[2]);
TEST_ASSERT_EQUAL_UINT(expected[3], result[3]);
TEST_ASSERT_EQUAL_UINT(expected[4], result[4]);
}
void test_addition_addition_float_0plus0gleich0(void) {
float result;
float expected = (float) 0.0;

Loading…
Cancel
Save