|
@ -6,6 +6,11 @@ |
|
|
|
|
|
|
|
|
num carry[1]; |
|
|
num carry[1]; |
|
|
|
|
|
|
|
|
|
|
|
union { |
|
|
|
|
|
float f; |
|
|
|
|
|
unsigned int i; |
|
|
|
|
|
} a[5]; |
|
|
|
|
|
|
|
|
void setUp(void) |
|
|
void setUp(void) |
|
|
{ |
|
|
{ |
|
|
} |
|
|
} |
|
@ -151,6 +156,24 @@ void test_addition_signnumber(void) { |
|
|
TEST_ASSERT_EQUAL_UINT(expected[1], result[1]); |
|
|
TEST_ASSERT_EQUAL_UINT(expected[1], result[1]); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void test_addition_precisionfloatingnumber(void) { |
|
|
|
|
|
unsigned int result[5]; |
|
|
|
|
|
a[0].f = 0, a[1].f = -34753168, a[2].f = 75613594, a[3].f = -0.00000044568721, a[4].f = 0.0000004796123; |
|
|
|
|
|
unsigned int expected[5] = { ( a[0].i << 9) >> 9 , ( a[1].i << 9) >> 9, ( a[2].i << 9) >> 9, ( a[3].i << 9) >> 9, ( a[4].i << 9) >> 9}; |
|
|
|
|
|
|
|
|
|
|
|
result[0] = m( a[0].i ); |
|
|
|
|
|
result[1] = m( a[1].i ); |
|
|
|
|
|
result[2] = m( a[2].i ); |
|
|
|
|
|
result[3] = m( a[3].i ); |
|
|
|
|
|
result[4] = m( a[4].i ); |
|
|
|
|
|
|
|
|
|
|
|
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) { |
|
|
void test_addition_addition_float_0plus0gleich0(void) { |
|
|
float result; |
|
|
float result; |
|
|
float expected = 0.0; |
|
|
float expected = 0.0; |
|
|