mirror of
https://github.com/recp/cglm.git
synced 2025-12-26 02:25:02 +00:00
test: fix comparing two float values in tests
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user