|
|
@ -13,6 +13,11 @@ union { |
|
|
|
unsigned int integer; |
|
|
|
} number[6]; |
|
|
|
|
|
|
|
union { |
|
|
|
double dnum; |
|
|
|
unsigned long lnum; |
|
|
|
} numberd[6]; |
|
|
|
|
|
|
|
void setUp(void) |
|
|
|
{ |
|
|
|
} |
|
|
@ -279,4 +284,17 @@ void test_addition_addition_float_sumofpositivnumbers(void) |
|
|
|
TEST_ASSERT_EQUAL_FLOAT(expected[2], result[2]); |
|
|
|
} |
|
|
|
|
|
|
|
void test_addition_sign_double_numbers(void) |
|
|
|
{ |
|
|
|
unsigned long result[2]; |
|
|
|
unsigned long expected[2] = { 1, 0 }; |
|
|
|
numberd[0].dnum = -3004683105640520235, numberd[1].dnum = 0.05313546453135; |
|
|
|
|
|
|
|
result[0] = sign_double(numberd[0].lnum); |
|
|
|
result[1] = sign_double(numberd[1].lnum); |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[0], result[0]); |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |