diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/app.hpp | 1 | ||||
-rw-r--r-- | test/coords.cpp | 28 | ||||
-rw-r--r-- | test/main.cpp | 1 |
3 files changed, 30 insertions, 0 deletions
diff --git a/test/app.hpp b/test/app.hpp index ef98a8b4..3544ed1b 100644 --- a/test/app.hpp +++ b/test/app.hpp @@ -44,6 +44,7 @@ struct test_app final : private FM_APPLICATION static void test_hash(); static void test_path_search_node_pool(); static void test_dijkstra(); + static void test_coords(); static void zzz_test_misc(); }; } // namespace floormat diff --git a/test/coords.cpp b/test/coords.cpp new file mode 100644 index 00000000..f673e7cd --- /dev/null +++ b/test/coords.cpp @@ -0,0 +1,28 @@ +#include "app.hpp" +#include "src/object.hpp" + +namespace floormat { + +namespace { + +constexpr auto norm = [](const point& pt, Vector2i delta) { return object::normalize_coords(pt, delta); }; + +void test_normalize_point() +{ + auto a = point{{{ 0, 0, 0}, { 0, 0}}, { 0, 0} }, + b = point{{{ 0, -1, 0}, {15, 15}}, { 0, 0} }, + c = point{{{-1, 1, 1}, { 0, 0}}, { 1, 31} }, + d = point{{{ 1, 0, 1}, {15, 15}}, {-31, 31} }, + e = point{{{ 1, 0, 1}, {15, 15}}, {-31, 31} }; + + fm_assert_equal(norm(a, {}), point{{{ 0, 0, 0}, { 0, 0}}, { 0, 0} }); +} + +} // namespace + +void test_app::test_coords() +{ + test_normalize_point(); +} + +} // namespace floormat diff --git a/test/main.cpp b/test/main.cpp index 57dd8fc5..7855a87a 100644 --- a/test/main.cpp +++ b/test/main.cpp @@ -34,6 +34,7 @@ int test_app::exec() test_hash(); test_path_search_node_pool(); test_dijkstra(); + test_coords(); zzz_test_misc(); return 0; |