diff --git a/test/test_addition.c b/test/test_addition.c index 876c32f..225882a 100644 --- a/test/test_addition.c +++ b/test/test_addition.c @@ -335,4 +335,28 @@ void test_addition_exponent_double_numbers(void) TEST_ASSERT_EQUAL_UINT64(expected[4], result[4]); } +void test_addition_output_double_numberwithsignexponentprecision(void) +{ + unsigned long long result[5]; + numberd[0].dnum = 7, numberd[1].dnum = -0.0000000006432154846123454, numberd[2].dnum = 731202035312050934, numberd[3].dnum = 0.0000009341213541974341, numberd[4].dnum = -9443345434194197313103.1136; + unsigned long long expected[5] = { numberd[0].lnum, numberd[1].lnum, numberd[2].lnum, numberd[3].lnum, numberd[4].lnum }; + + unsigned long long s0, s1, s2, s3, s4, e0, e1, e2, e3, e4, p0, p1, p2, p3, p4; + + s0 = sign_double(numberd[0].lnum), s1 = sign_double(numberd[1].lnum), s2 = sign_double(numberd[2].lnum), s3 = sign_double(numberd[3].lnum), s4 = sign_double(numberd[4].lnum); + e0 = exponent_double(numberd[0].lnum), e1 = exponent_double(numberd[1].lnum), e2 = exponent_double(numberd[2].lnum), e3 = exponent_double(numberd[3].lnum), e4 = exponent_double(numberd[4].lnum); + p0 = precision_double(numberd[0].lnum), p1 = precision_double(numberd[1].lnum), p2 = precision_double(numberd[2].lnum), p3 = precision_double(numberd[3].lnum), p4 = precision_double(numberd[4].lnum); + result[0] = output_double(s0, e0, p0); + result[1] = output_double(s1, e1, p1); + result[2] = output_double(s2, e2, p2); + result[3] = output_double(s3, e3, p3); + result[4] = output_double(s4, e4, p4); + + 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