eina: add quaternion test in eina suite and fix the test case errors
authorVivek Ellur <vivek.ellur@samsung.com>
Mon, 29 Jun 2015 12:24:21 +0000 (14:24 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Mon, 29 Jun 2015 12:56:23 +0000 (14:56 +0200)
Summary:
Fixed eina_test_quaternion_conjugate and eina_test_quaternion_matrix which
were failing and also added the quaternion test in eina suite

Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
Reviewers: cedric

Reviewed By: cedric

Subscribers: cedric

Differential Revision: https://phab.enlightenment.org/D2775

Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
src/tests/eina/eina_suite.c
src/tests/eina/eina_suite.h
src/tests/eina/eina_test_quaternion.c

index 5383bb6..5caa536 100644 (file)
@@ -82,6 +82,7 @@ static const Eina_Test_Case etc[] = {
    { "Crc", eina_test_crc },
    { "Quad", eina_test_quad },
    { "Matrix", eina_test_matrix },
+   { "Quaternion", eina_test_quaternion },
    { NULL, NULL }
 };
 
index d39254d..845ec9d 100644 (file)
@@ -67,5 +67,6 @@ void eina_test_xattr(TCase *tc);
 void eina_test_crc(TCase *tc);
 void eina_test_quad(TCase *tc);
 void eina_test_matrix(TCase *tc);
+void eina_test_quaternion(TCase *tc);
 
 #endif /* EINA_SUITE_H_ */
index 55e1c9f..9ca60d4 100644 (file)
@@ -62,7 +62,7 @@ START_TEST(eina_test_quaternion_norm)
 
    eina_init();
 
-   fail_if(FLOAT_CMP(eina_quaternion_norm(&q), sqrt(51)));
+   fail_if(!FLOAT_CMP(eina_quaternion_norm(&q), sqrt(51)));
 
    eina_shutdown();
 }
@@ -71,7 +71,7 @@ END_TEST
 START_TEST(eina_test_quaternion_conjugate)
 {
    static const Eina_Quaternion q1 = { 1, -1, -1, 3 }, q2 = { 1, 3, 4, 3 };
-   static const Eina_Quaternion r1 = { 1, 1, 1, -3 }, r2 = { 1, -3, -4, -3 };
+   static const Eina_Quaternion r1 = { -1, 1, 1, 3 }, r2 = { -1, -3, -4, 3 };
    Eina_Quaternion t1, t2;
 
    eina_init();
@@ -90,9 +90,9 @@ START_TEST(eina_test_quaternion_matrix)
 {
    Eina_Quaternion q = { 7, 9, 5, 1 };
    Eina_Matrix3 m = {
-     104, 76, 8,
-     104, -8, -116,
-     -52, 136, -56
+     -211, 136, 52,
+     116, -147, 104,
+     88, 76, -259
    };
    Eina_Quaternion tq;
    Eina_Matrix3 tm;