|
|
@@ -257,42 +257,45 @@ LOLUNIT_FIXTURE(RealTest) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
LOLUNIT_TEST(FloorCeil) |
|
|
|
LOLUNIT_TEST(FloorCeilEtc) |
|
|
|
{ |
|
|
|
double tests[] = |
|
|
|
{ |
|
|
|
-2.0, -2.0, -2.0, |
|
|
|
-1.5, -2.0, -1.0, |
|
|
|
-1.0, -1.0, -1.0, |
|
|
|
-0.0, -0.0, -0.0, |
|
|
|
0.0, 0.0, 0.0, |
|
|
|
0.25, 0.0, 1.0, |
|
|
|
0.375, 0.0, 1.0, |
|
|
|
0.5, 0.0, 1.0, |
|
|
|
1.0, 1.0, 1.0, |
|
|
|
1.5, 1.0, 2.0, |
|
|
|
2.0, 2.0, 2.0, |
|
|
|
2.5, 2.0, 3.0, |
|
|
|
3.0, 3.0, 3.0, |
|
|
|
8192.0, 8192.0, 8192.0, |
|
|
|
8192.03125, 8192.0, 8193.0, |
|
|
|
8192.5, 8192.0, 8193.0, |
|
|
|
8193.0, 8193.0, 8193.0, |
|
|
|
549755813888.0, 549755813888.0, 549755813888.0, |
|
|
|
549755813888.03125, 549755813888.0, 549755813889.0, |
|
|
|
549755813888.5, 549755813888.0, 549755813889.0, |
|
|
|
549755813889.0, 549755813889.0, 549755813889.0, |
|
|
|
-2.0, -2.0, -2.0, -2.0, |
|
|
|
-1.5, -2.0, -1.0, -2.0, |
|
|
|
-1.0, -1.0, -1.0, -1.0, |
|
|
|
-0.0, -0.0, -0.0, -0.0, |
|
|
|
0.0, 0.0, 0.0, 0.0, |
|
|
|
0.25, 0.0, 1.0, 0.0, |
|
|
|
0.375, 0.0, 1.0, 0.0, |
|
|
|
0.5, 0.0, 1.0, 1.0, |
|
|
|
1.0, 1.0, 1.0, 1.0, |
|
|
|
1.5, 1.0, 2.0, 2.0, |
|
|
|
2.0, 2.0, 2.0, 2.0, |
|
|
|
2.5, 2.0, 3.0, 3.0, |
|
|
|
3.0, 3.0, 3.0, 3.0, |
|
|
|
8192.0, 8192.0, 8192.0, 8192.0, |
|
|
|
8192.03125, 8192.0, 8193.0, 8192.0, |
|
|
|
8192.5, 8192.0, 8193.0, 8193.0, |
|
|
|
8193.0, 8193.0, 8193.0, 8193.0, |
|
|
|
549755813888.0, 549755813888.0, 549755813888.0, 549755813888.0, |
|
|
|
549755813888.03125, 549755813888.0, 549755813889.0, 549755813888.0, |
|
|
|
549755813888.5, 549755813888.0, 549755813889.0, 549755813889.0, |
|
|
|
549755813889.0, 549755813889.0, 549755813889.0, 549755813889.0, |
|
|
|
}; |
|
|
|
|
|
|
|
for (unsigned int n = 0; n < sizeof(tests) / sizeof(*tests); n += 3) |
|
|
|
for (unsigned int n = 0; n < sizeof(tests) / sizeof(*tests); n += 4) |
|
|
|
{ |
|
|
|
double a0 = floor((real)tests[n]); |
|
|
|
double b0 = tests[n + 1]; |
|
|
|
double a1 = ceil((real)tests[n]); |
|
|
|
double b1 = tests[n + 2]; |
|
|
|
double a2 = round((real)tests[n]); |
|
|
|
double b2 = tests[n + 3]; |
|
|
|
|
|
|
|
LOLUNIT_ASSERT_EQUAL(b0, a0); |
|
|
|
LOLUNIT_ASSERT_EQUAL(b1, a1); |
|
|
|
LOLUNIT_ASSERT_EQUAL(b2, a2); |
|
|
|
} |
|
|
|
} |
|
|
|
}; |
|
|
|