eina: get rid of float comparison warning on quad tests.
authorCedric BAIL <cedric@osg.samsung.com>
Tue, 20 Dec 2016 00:27:51 +0000 (16:27 -0800)
committerCedric BAIL <cedric@osg.samsung.com>
Tue, 20 Dec 2016 00:33:46 +0000 (16:33 -0800)
src/tests/eina/eina_test_quad.c

index b65f5c2..60cb653 100644 (file)
@@ -29,14 +29,20 @@ START_TEST(eina_quad_simple)
                         &x1, &y1,
                         &x2, &y2,
                         &x3, &y3);
-   fail_if (r2.x0 != 0.0 || r2.y0 != 5.0
-           || r2.x1 != 5.0 || r2.y1 != 0.0
-           || r2.x2 != 10.0 || r2.y2 != 5.0
-           || r2.x3 != 5.0 || r2.y3 != 10.0);
+   fail_if (!EINA_FLT_CMP(r2.x0, 0.0) ||
+            !EINA_FLT_CMP(r2.y0, 5.0) ||
+            !EINA_FLT_CMP(r2.x1, 5.0) ||
+            !EINA_FLT_CMP(r2.y1, 0.0) ||
+            !EINA_FLT_CMP(r2.x2, 10.0) ||
+            !EINA_FLT_CMP(r2.y2, 5.0) ||
+            !EINA_FLT_CMP(r2.x3, 5.0) ||
+            !EINA_FLT_CMP(r2.y3, 10.0));
 
    eina_quad_rectangle_to(&r2, &r1);
-   fail_if (r1.x != 0 || r1.y != 0
-           || r1.w != 10 || r1.h != 10);
+   fail_if (!EINA_FLT_CMP(r1.x, 0) ||
+            !EINA_FLT_CMP(r1.y, 0) ||
+            !EINA_FLT_CMP(r1.w, 10) ||
+            !EINA_FLT_CMP(r1.h, 10));
 
    eina_quad_coords_set(&r2,
                         0.0, 0.0,
@@ -44,15 +50,21 @@ START_TEST(eina_quad_simple)
                         0.0, 0.0,
                         0.0, 0.0);
    eina_quad_rectangle_to(&r2, &r1);
-   fail_if (r1.x != 0 || r1.y != 0
-           || r1.w != 0 || r1.h != 0);
+   fail_if (!EINA_FLT_CMP(r1.x, 0) ||
+            !EINA_FLT_CMP(r1.y, 0) ||
+            !EINA_FLT_CMP(r1.w, 0) ||
+            !EINA_FLT_CMP(r1.h, 0));
 
    EINA_RECTANGLE_SET(&r1, 5, 10, 20, 30);
    eina_quad_rectangle_from(&r2, &r1);
-   fail_if (r2.x0 != 5.0 || r2.y0 != 10.0
-           || r2.x1 != 25.0 || r2.y1 != 10.0
-           || r2.x2 != 25.0 || r2.y2 != 40.0
-           || r2.x3 != 5.0 || r2.y3 != 40.0);
+   fail_if (!EINA_FLT_CMP(r2.x0, 5.0) ||
+            !EINA_FLT_CMP(r2.y0, 10.0) ||
+            !EINA_FLT_CMP(r2.x1, 25.0) ||
+            !EINA_FLT_CMP(r2.y1, 10.0) ||
+            !EINA_FLT_CMP(r2.x2, 25.0) ||
+            !EINA_FLT_CMP(r2.y2, 40.0) ||
+            !EINA_FLT_CMP(r2.x3, 5.0) ||
+            !EINA_FLT_CMP(r2.y3, 40.0));
 
    eina_shutdown();
 }