math::iround

Signed-off-by: Alexander Borsuk <me@alex.bio>
This commit is contained in:
Alexander Borsuk
2025-08-14 22:54:56 +03:00
committed by Konstantin Pastbin
parent 7781528263
commit 836c39ff64
8 changed files with 42 additions and 20 deletions

View File

@@ -1,12 +1,10 @@
#include "geometry/geometry_tests/equality.hpp"
#include "base/math.hpp"
#include "geometry/screenbase.hpp"
#include "geometry/transformations.hpp"
#include "testing/testing.hpp"
#include <cmath>
namespace screen_test
{
using test::is_equal;
@@ -23,10 +21,10 @@ static void check_set_from_rect(ScreenBase & screen, int width, int height)
b2 = screen.GtoP(b2);
// check that we are in boundaries.
TEST(math::Between(0, width, static_cast<int>(std::lround(b1.x))), ());
TEST(math::Between(0, width, static_cast<int>(std::lround(b2.x))), ());
TEST(math::Between(0, height, static_cast<int>(std::lround(b1.y))), ());
TEST(math::Between(0, height, static_cast<int>(std::lround(b2.y))), ());
TEST(math::Between(0, width, math::iround(b1.x)), ());
TEST(math::Between(0, width, math::iround(b2.x)), ());
TEST(math::Between(0, height, math::iround(b1.y)), ());
TEST(math::Between(0, height, math::iround(b2.y)), ());
}
UNIT_TEST(ScreenBase_P2G2P)