summaryrefslogtreecommitdiff
path: root/tests/core
diff options
context:
space:
mode:
authorVolTer <mew.pur.pur@abv.bg>2022-09-24 14:20:06 +0200
committerVolTer <mew.pur.pur@abv.bg>2022-11-19 06:18:55 +0100
commite26f0906f229f237ad22d5b1986c1669b354b791 (patch)
tree81736e67b8393ef0f9fadce2eb29905c25125f32 /tests/core
parenta1bc636098c91ed47a8d9a23e07a4c85b64c1884 (diff)
Implement snappedi, snappedf, and Vector[2/3/4]i.snapped
Diffstat (limited to 'tests/core')
-rw-r--r--tests/core/math/test_vector2i.h8
-rw-r--r--tests/core/math/test_vector3i.h8
-rw-r--r--tests/core/math/test_vector4i.h8
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);