test: fix comparing two float values in tests

This commit is contained in:
Recep Aslantas
2018-12-05 16:34:22 +03:00
parent b23d65bef5
commit 92605f845a
5 changed files with 11 additions and 11 deletions

View File

@@ -444,7 +444,7 @@ glm_vec3_maxadd(vec3 a, vec3 b, vec3 dest) {
* it applies += operator so dest must be initialized
*
* @param[in] a vector
* @param[in] s scalar
* @param[in] b scalar
* @param[out] dest dest += min(a, b)
*/
CGLM_INLINE

View File

@@ -331,9 +331,9 @@ glm_vec4_subs(vec4 v, float s, vec4 dest) {
/*!
* @brief multiply two vector (component-wise multiplication)
*
* @param a vector1
* @param b vector2
* @param d dest = (a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3])
* @param a vector1
* @param b vector2
* @param dest dest = (a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3])
*/
CGLM_INLINE
void
@@ -553,7 +553,7 @@ glm_vec4_maxadd(vec4 a, vec4 b, vec4 dest) {
* it applies += operator so dest must be initialized
*
* @param[in] a vector
* @param[in] s scalar
* @param[in] b scalar
* @param[out] dest dest += min(a, b)
*/
CGLM_INLINE

View File

@@ -24,9 +24,9 @@ test_mat3(void **state) {
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (i == j)
assert_true(m3[i][j] == 1.0f);
assert_true(glm_eq(m3[i][j], 1.0f));
else
assert_true(m3[i][j] == 0.0f);
assert_true(glm_eq(m3[i][j], 0.0f));
}
}

View File

@@ -24,9 +24,9 @@ test_mat4(void **state) {
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
if (i == j)
assert_true(m3[i][j] == 1.0f);
assert_true(glm_eq(m3[i][j], 1.0f));
else
assert_true(m3[i][j] == 0.0f);
assert_true(glm_eq(m3[i][j], 0.0f));
}
}

View File

@@ -25,7 +25,7 @@ test_quat(void **state) {
/* 0. test identiy quat */
glm_quat_identity(q4);
assert_true(glm_quat_real(q4) == cosf(glm_rad(0.0f) * 0.5f));
assert_true(glm_eq(glm_quat_real(q4), cosf(glm_rad(0.0f) * 0.5f)));
glm_quat_mat4(q4, rot1);
test_assert_mat4_eq2(rot1, GLM_MAT4_IDENTITY, 0.000009);
@@ -118,7 +118,7 @@ test_quat(void **state) {
/* 9. test imag, real */
/* 9.1 real */
assert_true(glm_quat_real(q4) == cosf(glm_rad(-90.0f) * 0.5f));
assert_true(glm_eq(glm_quat_real(q4), cosf(glm_rad(-90.0f) * 0.5f)));
/* 9.1 imag */
glm_quat_imag(q4, imag);