eina: get rid of float comparison warning on quaternion tests.

This commit is contained in:
Cedric BAIL 2016-12-19 16:28:10 -08:00
parent 27bf609b9d
commit ae9257401e
1 changed files with 17 additions and 19 deletions

View File

@ -28,15 +28,13 @@
#include "eina_suite.h"
#define FLOAT_CMP(a, b) (fabs((float)a - (float)b) <= FLT_MIN)
static inline Eina_Bool
eina_quaternion_cmp(const Eina_Quaternion *a, const Eina_Quaternion *b)
{
if (FLOAT_CMP(a->x, b->x) &&
FLOAT_CMP(a->y, b->y) &&
FLOAT_CMP(a->z, b->z) &&
FLOAT_CMP(a->w, b->w))
if (EINA_FLT_CMP(a->x, b->x) &&
EINA_FLT_CMP(a->y, b->y) &&
EINA_FLT_CMP(a->z, b->z) &&
EINA_FLT_CMP(a->w, b->w))
return EINA_TRUE;
return EINA_FALSE;
}
@ -44,15 +42,15 @@ eina_quaternion_cmp(const Eina_Quaternion *a, const Eina_Quaternion *b)
static inline Eina_Bool
eina_matrix3_cmp(const Eina_Matrix3 *a, const Eina_Matrix3 *b)
{
if (FLOAT_CMP(a->xx, b->xx) &&
FLOAT_CMP(a->xy, b->xy) &&
FLOAT_CMP(a->xz, b->xz) &&
FLOAT_CMP(a->yx, b->yx) &&
FLOAT_CMP(a->yy, b->yy) &&
FLOAT_CMP(a->yz, b->yz) &&
FLOAT_CMP(a->zx, b->zx) &&
FLOAT_CMP(a->zy, b->zy) &&
FLOAT_CMP(a->zz, b->zz))
if (EINA_FLT_CMP(a->xx, b->xx) &&
EINA_FLT_CMP(a->xy, b->xy) &&
EINA_FLT_CMP(a->xz, b->xz) &&
EINA_FLT_CMP(a->yx, b->yx) &&
EINA_FLT_CMP(a->yy, b->yy) &&
EINA_FLT_CMP(a->yz, b->yz) &&
EINA_FLT_CMP(a->zx, b->zx) &&
EINA_FLT_CMP(a->zy, b->zy) &&
EINA_FLT_CMP(a->zz, b->zz))
return EINA_TRUE;
return EINA_FALSE;
}
@ -76,9 +74,9 @@ eina_matrix3_f16p16_cmp(const Eina_Matrix3_F16p16 *a, const Eina_Matrix3_F16p16
static inline Eina_Bool
eina_point_3d_cmp(const Eina_Point_3D *a, const Eina_Point_3D *b)
{
if (FLOAT_CMP(a->x, b->x) &&
FLOAT_CMP(a->y, b->y) &&
FLOAT_CMP(a->z, b->z))
if (EINA_FLT_CMP(a->x, b->x) &&
EINA_FLT_CMP(a->y, b->y) &&
EINA_FLT_CMP(a->z, b->z))
return EINA_TRUE;
return EINA_FALSE;
}
@ -101,7 +99,7 @@ START_TEST(eina_test_quaternion_norm)
eina_init();
fail_if(!FLOAT_CMP(result, sqrt(51)));
fail_if(!EINA_FLT_CMP(result, sqrt(51)));
eina_shutdown();
}