summaryrefslogtreecommitdiffstats
path: root/tests/core/math/test_vector2.h
diff options
context:
space:
mode:
authornazarii <nazarii.yablonskyi.pp.2022@lpnu.ua>2024-03-17 20:06:17 +0200
committernazarii <nazarii.yablonskyi.pp.2022@lpnu.ua>2024-04-05 21:57:01 +0300
commitb8caf9b2247960b6bc019735c0cd5b11d1e7408c (patch)
tree9c65a33a235294f7ec059f4a83a70e5ea289ba1f /tests/core/math/test_vector2.h
parent655e93d5846b2ef8ebb7d22c8878f51b8f22b312 (diff)
downloadredot-engine-b8caf9b2247960b6bc019735c0cd5b11d1e7408c.tar.gz
Add unit test for Vector2 plane_project
Diffstat (limited to 'tests/core/math/test_vector2.h')
-rw-r--r--tests/core/math/test_vector2.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/core/math/test_vector2.h b/tests/core/math/test_vector2.h
index f23fffe5eb..fc3fd6a87d 100644
--- a/tests/core/math/test_vector2.h
+++ b/tests/core/math/test_vector2.h
@@ -354,6 +354,7 @@ TEST_CASE("[Vector2] Plane methods") {
const Vector2 vector_y = Vector2(0, 1);
const Vector2 vector_normal = Vector2(0.95879811270838721622267, 0.2840883296913739899919);
const Vector2 vector_non_normal = Vector2(5.4, 1.6);
+ const real_t p_d = 99.1;
CHECK_MESSAGE(
vector.bounce(vector_y) == Vector2(1.2, -3.4),
"Vector2 bounce on a plane with normal of the Y axis should.");
@@ -373,6 +374,9 @@ TEST_CASE("[Vector2] Plane methods") {
vector.project(vector_normal).is_equal_approx(Vector2(2.0292559899117276166, 0.60126103404791929382)),
"Vector2 projected on a normal should return expected value.");
CHECK_MESSAGE(
+ vector_normal.plane_project(p_d, vector).is_equal_approx(Vector2(94.187635516479631, 30.951892004882851)),
+ "Vector2 plane_project should return expected value.");
+ CHECK_MESSAGE(
vector.slide(vector_y) == Vector2(1.2, 0),
"Vector2 slide on a plane with normal of the Y axis should set the Y to zero.");
CHECK_MESSAGE(