summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Ellur <vivek.ellur@samsung.com>2015-10-30 04:00:33 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-10-31 02:12:06 +0100
commitdc391da42430624e1ee91bfba8fc326a9c77ed83 (patch)
tree7556e06b5c286f96cd4109f21754794c1e54b5a7
parent6090073dee6b8a283a2d404efde8ec9205e485d9 (diff)
eina_quaternion: add test case for rotation function
Summary: Added test case for eina_quaternion_rotate function Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com> Reviewers: cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3246 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
-rw-r--r--src/tests/eina/eina_test_quaternion.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tests/eina/eina_test_quaternion.c b/src/tests/eina/eina_test_quaternion.c
index e1b876b595..2401dcbf69 100644
--- a/src/tests/eina/eina_test_quaternion.c
+++ b/src/tests/eina/eina_test_quaternion.c
@@ -453,6 +453,26 @@ START_TEST(eina_test_quaternion_f16p16_rotate_matrix)
453} 453}
454END_TEST 454END_TEST
455 455
456START_TEST(eina_test_quaternion_rotate)
457{
458 Eina_Point_3D r = { 3, 3, 3 };
459 Eina_Point_3D c = { 0, 0, 0}, res = {3.0, 3.0, 3.0};
460 Eina_Point_3D res1 = {3.0, 3.0, -9.0};
461 Eina_Quaternion q = {1, 1, 1, 0};
462
463 eina_init();
464
465 eina_quaternion_rotate(&r, &c, &q);
466 fail_if(!eina_point_3d_cmp(&r, &res));
467
468 eina_quaternion_set(&q, 1, 1, 0, 0);
469 eina_quaternion_rotate(&r, &c, &q);
470 fail_if(!eina_point_3d_cmp(&r, &res1));
471
472 eina_shutdown();
473}
474END_TEST
475
456void 476void
457eina_test_quaternion(TCase *tc) 477eina_test_quaternion(TCase *tc)
458{ 478{
@@ -471,4 +491,5 @@ eina_test_quaternion(TCase *tc)
471 tcase_add_test(tc, eina_test_quaternion_f16p16_lerp); 491 tcase_add_test(tc, eina_test_quaternion_f16p16_lerp);
472 tcase_add_test(tc, eina_test_quaternion_lerp); 492 tcase_add_test(tc, eina_test_quaternion_lerp);
473 tcase_add_test(tc, eina_test_quaternion_f16p16_rotate_matrix); 493 tcase_add_test(tc, eina_test_quaternion_f16p16_rotate_matrix);
494 tcase_add_test(tc, eina_test_quaternion_rotate);
474} 495}