diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-24 18:54:49 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-24 18:54:49 +0100 |
commit | 4a8b725bc9ba3126b8e318dd19d49b2472267fc2 (patch) | |
tree | 59816ba86429090f390a10e7985eec278b1783df /tests | |
parent | 5e2bb98eee283aa06b424a53e9b10fa1b32f10cf (diff) | |
parent | e26f0906f229f237ad22d5b1986c1669b354b791 (diff) |
Merge pull request #68386 from MewPurPur/snappedi-snappedf
Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/math/test_vector2i.h | 8 | ||||
-rw-r--r-- | tests/core/math/test_vector3i.h | 8 | ||||
-rw-r--r-- | tests/core/math/test_vector4i.h | 8 |
3 files changed, 22 insertions, 2 deletions
diff --git a/tests/core/math/test_vector2i.h b/tests/core/math/test_vector2i.h index c7a0dccdcc..9ee844ffa8 100644 --- a/tests/core/math/test_vector2i.h +++ b/tests/core/math/test_vector2i.h @@ -131,12 +131,16 @@ TEST_CASE("[Vector2i] Other methods") { "Vector2i aspect should work as expected."); CHECK_MESSAGE( - Vector2i(1, 2) == vector.min(Vector2i(3, 2)), + vector.min(Vector2i(3, 2)) == Vector2i(1, 2), "Vector2i min should return expected value."); CHECK_MESSAGE( - Vector2i(5, 3) == vector.max(Vector2i(5, 2)), + vector.max(Vector2i(5, 2)) == Vector2i(5, 3), "Vector2i max should return expected value."); + + CHECK_MESSAGE( + vector.snapped(Vector2i(4, 2)) == Vector2i(0, 4), + "Vector2i snapped should work as expected."); } TEST_CASE("[Vector2i] Abs and sign methods") { diff --git a/tests/core/math/test_vector3i.h b/tests/core/math/test_vector3i.h index 56578f99eb..45240bd2ff 100644 --- a/tests/core/math/test_vector3i.h +++ b/tests/core/math/test_vector3i.h @@ -127,6 +127,14 @@ TEST_CASE("[Vector3i] Operators") { "Vector3i constructed from Vector3 should work as expected."); } +TEST_CASE("[Vector3i] Other methods") { + const Vector3i vector = Vector3i(1, 3, -7); + + CHECK_MESSAGE( + vector.snapped(Vector3i(4, 2, 5)) == Vector3i(0, 4, -5), + "Vector3i snapped should work as expected."); +} + TEST_CASE("[Vector3i] Abs and sign methods") { const Vector3i vector1 = Vector3i(1, 3, 5); const Vector3i vector2 = Vector3i(1, -3, -5); diff --git a/tests/core/math/test_vector4i.h b/tests/core/math/test_vector4i.h index 30d38607dd..8a9522f9cc 100644 --- a/tests/core/math/test_vector4i.h +++ b/tests/core/math/test_vector4i.h @@ -130,6 +130,14 @@ TEST_CASE("[Vector4i] Operators") { "Vector4i constructed from Vector4 should work as expected."); } +TEST_CASE("[Vector3i] Other methods") { + const Vector4i vector = Vector4i(1, 3, -7, 13); + + CHECK_MESSAGE( + vector.snapped(Vector4i(4, 2, 5, 8)) == Vector4i(0, 4, -5, 16), + "Vector4i snapped should work as expected."); +} + TEST_CASE("[Vector4i] Abs and sign methods") { const Vector4i vector1 = Vector4i(1, 3, 5, 7); const Vector4i vector2 = Vector4i(1, -3, -5, 7); |