|
|
@ -297,4 +297,23 @@ void test_addition_sign_double_numbers(void) |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); |
|
|
|
} |
|
|
|
|
|
|
|
void test_addition_precision_double_numbers(void) |
|
|
|
{ |
|
|
|
unsigned long long result[5]; |
|
|
|
numberd[0].dnum = 3216752.2348648931012, numberd[1].dnum = -79865431546, numberd[2].dnum = 203, numberd[3].dnum = -0.00460023540056432002, numberd[4].dnum = 0.000000000791340265431213; |
|
|
|
unsigned long long expected[5] = { (numberd[0].lnum << 12) >> 12 , (numberd[1].lnum << 12) >> 12, (numberd[2].lnum << 12) >> 12, (numberd[3].lnum << 12) >> 12, (numberd[4].lnum << 12) >> 12}; |
|
|
|
|
|
|
|
result[0] = precision_double( numberd[0].lnum ); |
|
|
|
result[1] = precision_double( numberd[1].lnum ); |
|
|
|
result[2] = precision_double( numberd[2].lnum ); |
|
|
|
result[3] = precision_double( numberd[3].lnum ); |
|
|
|
result[4] = precision_double( numberd[4].lnum ); |
|
|
|
|
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[0], result[0]); |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[1], result[1]); |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[2], result[2]); |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[3], result[3]); |
|
|
|
TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); |
|
|
|
} |
|
|
|
|
|
|
|
#endif // TEST |