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

@@ -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);