From ae349462c609e7987f24b63208a9c50104e8529f Mon Sep 17 00:00:00 2001 From: Alexander Borsuk Date: Tue, 15 Jul 2025 00:48:19 +0300 Subject: [PATCH] Smoke test for std::round and std::lround Signed-off-by: Alexander Borsuk --- base/base_tests/math_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/base/base_tests/math_test.cpp b/base/base_tests/math_test.cpp index 9109e659b..0e44bef15 100644 --- a/base/base_tests/math_test.cpp +++ b/base/base_tests/math_test.cpp @@ -45,6 +45,19 @@ void TestMaxULPs() } } // namespace +UNIT_TEST(round_lround_smoke) +{ + TEST_EQUAL(std::round(0.4), 0.0, ()); + TEST_EQUAL(std::round(0.6), 1.0, ()); + TEST_EQUAL(std::round(-0.4), 0.0, ()); + TEST_EQUAL(std::round(-0.6), -1.0, ()); + + TEST_EQUAL(std::lround(0.4), 0l, ()); + TEST_EQUAL(std::lround(0.6), 1l, ()); + TEST_EQUAL(std::lround(-0.4), 0l, ()); + TEST_EQUAL(std::lround(-0.6), -1l, ()); +} + UNIT_TEST(PowUInt) { TEST_EQUAL(PowUint(3, 10), 59049, ());