eina: add test cases for eina_matrix3 APIs
authorVivek Ellur <vivek.ellur@samsung.com>
Thu, 4 Jun 2015 08:32:01 +0000 (10:32 +0200)
committerCedric BAIL <cedric@osg.samsung.com>
Thu, 4 Jun 2015 08:32:18 +0000 (10:32 +0200)
Summary:
Added test cases for eina_matrix3_values_get, eina_matrix3_values_set,
eina_matrix3_equal, eina_matrix3_type_get APIs

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

Reviewed By: cedric

Subscribers: cedric

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

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

index 046876d..28983e1 100644 (file)
@@ -92,9 +92,60 @@ START_TEST(eina_matrix4_2_3)
 }
 END_TEST
 
+START_TEST(eina_matrix3)
+{
+   Eina_Bool ret;
+   Eina_Matrix3 m, m1, m2;
+   double xx, xy, xz,
+          yx, yy, yz,
+          zx, zy, zz;
+
+          eina_init();
+
+   eina_matrix3_values_set(&m,
+                           1, 0, 0,
+                           0, 1, 0,
+                           0, 0, 1);
+
+   eina_matrix3_values_set(&m1,
+                           1, 0, 0,
+                           0, 1, 0,
+                           0, 0, 1);
+
+   eina_matrix3_values_set(&m2,
+                           1, 1, 1,
+                           0, 1, 0,
+                           0, 0, 1);
+   fail_if(eina_matrix3_type_get(&m) != EINA_MATRIX_TYPE_IDENTITY);
+
+   eina_matrix3_values_get(&m,
+                           &xx, &xy, &xz,
+                           &yx, &yy, &yz,
+                           &zx, &zy, &zz);
+
+   fail_if(xx != yy ||
+           yy != zz ||
+           zz != 1);
+
+   fail_if(xy != xz ||
+           yx != yz ||
+           zx != zy ||
+           zy != 0);
+
+   ret = eina_matrix3_equal(&m, &m1);
+   fail_if(ret != EINA_TRUE);
+
+   ret = eina_matrix3_equal(&m1, &m2);
+   fail_if(ret != EINA_FALSE);
+
+   eina_shutdown();
+}
+END_TEST
+
 void
 eina_test_matrix(TCase *tc)
 {
    tcase_add_test(tc, eina_matrix4);
    tcase_add_test(tc, eina_matrix4_2_3);
+   tcase_add_test(tc, eina_matrix3);
 }