Skip to content

Commit b8caf9b

Browse files
committedApr 5, 2024
Add unit test for Vector2 plane_project
1 parent 655e93d commit b8caf9b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed
 

‎tests/core/math/test_vector2.h

+4
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ TEST_CASE("[Vector2] Plane methods") {
354354
const Vector2 vector_y = Vector2(0, 1);
355355
const Vector2 vector_normal = Vector2(0.95879811270838721622267, 0.2840883296913739899919);
356356
const Vector2 vector_non_normal = Vector2(5.4, 1.6);
357+
const real_t p_d = 99.1;
357358
CHECK_MESSAGE(
358359
vector.bounce(vector_y) == Vector2(1.2, -3.4),
359360
"Vector2 bounce on a plane with normal of the Y axis should.");
@@ -372,6 +373,9 @@ TEST_CASE("[Vector2] Plane methods") {
372373
CHECK_MESSAGE(
373374
vector.project(vector_normal).is_equal_approx(Vector2(2.0292559899117276166, 0.60126103404791929382)),
374375
"Vector2 projected on a normal should return expected value.");
376+
CHECK_MESSAGE(
377+
vector_normal.plane_project(p_d, vector).is_equal_approx(Vector2(94.187635516479631, 30.951892004882851)),
378+
"Vector2 plane_project should return expected value.");
375379
CHECK_MESSAGE(
376380
vector.slide(vector_y) == Vector2(1.2, 0),
377381
"Vector2 slide on a plane with normal of the Y axis should set the Y to zero.");

0 commit comments

Comments
 (0)
Please sign in to comment.