mirror of
https://github.com/recp/cglm.git
synced 2026-02-17 03:39:05 +00:00
test: fix comparing two float values in tests
This commit is contained in:
@@ -444,7 +444,7 @@ glm_vec3_maxadd(vec3 a, vec3 b, vec3 dest) {
|
|||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
* @param[in] a vector
|
* @param[in] a vector
|
||||||
* @param[in] s scalar
|
* @param[in] b scalar
|
||||||
* @param[out] dest dest += min(a, b)
|
* @param[out] dest dest += min(a, b)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -331,9 +331,9 @@ glm_vec4_subs(vec4 v, float s, vec4 dest) {
|
|||||||
/*!
|
/*!
|
||||||
* @brief multiply two vector (component-wise multiplication)
|
* @brief multiply two vector (component-wise multiplication)
|
||||||
*
|
*
|
||||||
* @param a vector1
|
* @param a vector1
|
||||||
* @param b vector2
|
* @param b vector2
|
||||||
* @param d dest = (a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3])
|
* @param dest dest = (a[0] * b[0], a[1] * b[1], a[2] * b[2], a[3] * b[3])
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
void
|
void
|
||||||
@@ -553,7 +553,7 @@ glm_vec4_maxadd(vec4 a, vec4 b, vec4 dest) {
|
|||||||
* it applies += operator so dest must be initialized
|
* it applies += operator so dest must be initialized
|
||||||
*
|
*
|
||||||
* @param[in] a vector
|
* @param[in] a vector
|
||||||
* @param[in] s scalar
|
* @param[in] b scalar
|
||||||
* @param[out] dest dest += min(a, b)
|
* @param[out] dest dest += min(a, b)
|
||||||
*/
|
*/
|
||||||
CGLM_INLINE
|
CGLM_INLINE
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ test_mat3(void **state) {
|
|||||||
for (i = 0; i < m; i++) {
|
for (i = 0; i < m; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (i == j)
|
if (i == j)
|
||||||
assert_true(m3[i][j] == 1.0f);
|
assert_true(glm_eq(m3[i][j], 1.0f));
|
||||||
else
|
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 (i = 0; i < m; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
if (i == j)
|
if (i == j)
|
||||||
assert_true(m3[i][j] == 1.0f);
|
assert_true(glm_eq(m3[i][j], 1.0f));
|
||||||
else
|
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 */
|
/* 0. test identiy quat */
|
||||||
glm_quat_identity(q4);
|
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);
|
glm_quat_mat4(q4, rot1);
|
||||||
test_assert_mat4_eq2(rot1, GLM_MAT4_IDENTITY, 0.000009);
|
test_assert_mat4_eq2(rot1, GLM_MAT4_IDENTITY, 0.000009);
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ test_quat(void **state) {
|
|||||||
/* 9. test imag, real */
|
/* 9. test imag, real */
|
||||||
|
|
||||||
/* 9.1 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 */
|
/* 9.1 imag */
|
||||||
glm_quat_imag(q4, imag);
|
glm_quat_imag(q4, imag);
|
||||||
|
|||||||
Reference in New Issue
Block a user