Merge remote-tracking branch 'origin/math-roundupdown' into clipping-2.5d-kring

This commit is contained in:
Kevin Ring 2021-08-23 20:54:41 +10:00
commit 2d86c1d559
2 changed files with 21 additions and 0 deletions

View File

@ -11,6 +11,7 @@
- Added `Future<T>::isReady`.
- Added `Future<T>::share`, which returns a `SharedFuture<T>` and allows multiple continuations to be attached.
- Added `Rectangle::computeUnion`.
- Added `Math::roundUp` and `Math::roundDown`.
### v0.6.0 - 2021-08-02

View File

@ -50,3 +50,23 @@ TEST_CASE("Math::convertLongitudeRange example") {
//! [convertLongitudeRange]
CHECK(longitude == CesiumUtility::Math::degreesToRadians(-90.0));
}
TEST_CASE("Math::roundUp and roundDown") {
CHECK(Math::roundUp(1.0, 0.01) == 1.0);
CHECK(Math::roundDown(1.0, 0.01) == 1.0);
CHECK(Math::roundUp(1.01, 0.01) == 2.0);
CHECK(Math::roundDown(1.99, 0.01) == 1.0);
CHECK(Math::roundUp(1.005, 0.01) == 1.0);
CHECK(Math::roundDown(1.995, 0.01) == 2.0);
CHECK(Math::roundUp(-1.0, 0.01) == -1.0);
CHECK(Math::roundDown(-1.0, 0.01) == -1.0);
CHECK(Math::roundUp(-1.99, 0.01) == -1.0);
CHECK(Math::roundDown(-1.01, 0.01) == -2.0);
CHECK(Math::roundUp(-1.995, 0.01) == -2.0);
CHECK(Math::roundDown(-1.005, 0.01) == -1.0);
}