mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-23 22:53:43 +00:00
committed by
Konstantin Pastbin
parent
7781528263
commit
836c39ff64
@@ -209,4 +209,20 @@ UNIT_TEST(is_finite)
|
||||
TEST(is_finite(DBL_MIN / 2.0), ("As in cppreference example"));
|
||||
}
|
||||
|
||||
UNIT_TEST(iround)
|
||||
{
|
||||
TEST_EQUAL(iround(0.0), 0, ());
|
||||
TEST_EQUAL(iround(1.0), 1, ());
|
||||
TEST_EQUAL(iround(1.5), 2, ());
|
||||
TEST_EQUAL(iround(-1.5), -2, ());
|
||||
TEST_EQUAL(iround(2.5), 3, ());
|
||||
TEST_EQUAL(iround(-2.5), -3, ());
|
||||
|
||||
TEST_EQUAL(iround(2.5f), 3, ());
|
||||
TEST_EQUAL(iround(-2.5f), -3, ());
|
||||
|
||||
TEST_EQUAL(iround(double(std::numeric_limits<int>::max()) - 0.5), std::numeric_limits<int>::max(), ());
|
||||
TEST_EQUAL(iround(double(std::numeric_limits<int>::min()) + 0.5), std::numeric_limits<int>::min(), ());
|
||||
}
|
||||
|
||||
} // namespace math_test
|
||||
|
||||
Reference in New Issue
Block a user