diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-26 10:19:37 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-05-26 11:12:07 +0200 |
commit | 0978386d9938a7d3f205ec4419bd5213d5f0a579 (patch) | |
tree | b949cf33108e9d55ae32d0a50a404b80a9f1847f /test | |
parent | 67bec06c00b10f57d0d4701a357f29efe7520e3b (diff) |
w a
Diffstat (limited to 'test')
-rw-r--r-- | test/hole.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/test/hole.cpp b/test/hole.cpp index 4ad3c21a..6cc39af1 100644 --- a/test/hole.cpp +++ b/test/hole.cpp @@ -1,7 +1,7 @@ #include "app.hpp" #include "src/hole.hpp" -namespace floormat::Hole { +namespace floormat { namespace { using bbox = cut_rectangle_result::bbox; @@ -10,7 +10,8 @@ template<Int x, Int y> void test1() { static constexpr auto vec = Vector2i{x, y}; - constexpr auto rect = bbox{{}, {50, 50}}; + static constexpr auto rect = bbox{{}, {50, 50}}; + constexpr auto cutʹ = [](bbox rect, bbox hole) { auto rectʹ = bbox { rect.position + vec, rect.bbox_size }; auto holeʹ = bbox { hole.position + vec, hole.bbox_size }; @@ -32,13 +33,13 @@ void test1() fm_assert_equal(0, cutʹ(rect, {{50, 50}, {50, 50}})); #endif #if 1 - fm_assert_equal(9, cutʹ(rect, {{ 9, 9}, {70, 70}})); - fm_assert_equal(9, cutʹ(rect, {{10, 10}, {70, 70}})); + fm_assert_equal(1, cutʹ(rect, {{ 9, 9}, {70, 70}})); + fm_assert_equal(1, cutʹ(rect, {{10, 10}, {70, 70}})); #endif #if 1 - fm_assert_equal(12, cutʹ(rect, {{1, 0}, {50, 50}})); - fm_assert_equal(12, cutʹ(rect, {{0, 1}, {50, 50}})); - fm_assert_equal(11, cutʹ(rect, {{1, 1}, {50, 50}})); + fm_assert_equal(1, cutʹ(rect, {{1, 0}, {50, 50}})); + fm_assert_equal(1, cutʹ(rect, {{0, 1}, {50, 50}})); + fm_assert_equal(2, cutʹ(rect, {{1, 1}, {50, 50}})); #endif #if 1 // todo! coverage @@ -46,16 +47,14 @@ void test1() } } // namespace -} // namespace floormat::Hole -namespace floormat { void Test::test_hole() { - Hole::test1< 0, 0 >(); - Hole::test1< 110, 105 >(); - Hole::test1< 15, 110 >(); - Hole::test1< - 15, -110 >(); - Hole::test1< -110, -15 >(); + test1< 0, 0 >(); + test1< 110, 105 >(); + test1< 15, 110 >(); + test1< - 15, -110 >(); + test1< -110, -15 >(); } } // namespace floormat |