mirror of
https://github.com/recp/cglm.git
synced 2025-10-04 01:00:46 +00:00
- separating struct types into types-struct.h
- vec3s implementation - fix style issues
This commit is contained in:
@@ -47,6 +47,14 @@ test_rand_vec3(vec3 dest) {
|
||||
dest[2] = drand48();
|
||||
}
|
||||
|
||||
vec3s
|
||||
test_rand_vec3s()
|
||||
{
|
||||
vec3s r;
|
||||
test_rand_vec3(r.raw);
|
||||
return r;
|
||||
}
|
||||
|
||||
void
|
||||
test_rand_vec4(vec4 dest) {
|
||||
srand((unsigned int)time(NULL));
|
||||
@@ -127,6 +135,12 @@ test_assert_vec3_eq(vec3 v1, vec3 v2) {
|
||||
assert_true(fabsf(v1[2] - v2[2]) <= 0.000009);
|
||||
}
|
||||
|
||||
void
|
||||
test_assert_vec3s_eq(vec3s v1, vec3s v2)
|
||||
{
|
||||
test_assert_vec3_eq(v1.raw, v2.raw);
|
||||
}
|
||||
|
||||
void
|
||||
test_assert_vec4_eq(vec4 v1, vec4 v2) {
|
||||
assert_true(fabsf(v1[0] - v2[0]) <= 0.000009); /* rounding errors */
|
||||
|
@@ -44,6 +44,9 @@ test_assert_mat3_eq(mat3 m1, mat3 m2);
|
||||
void
|
||||
test_assert_vec3_eq(vec3 v1, vec3 v2);
|
||||
|
||||
void
|
||||
test_assert_vec3s_eq(vec3s v1, vec3s v2);
|
||||
|
||||
void
|
||||
test_assert_vec4_eq(vec4 v1, vec4 v2);
|
||||
|
||||
@@ -59,6 +62,9 @@ test_assert_quat_eq_abs(versor v1, versor v2);
|
||||
void
|
||||
test_rand_vec3(vec3 dest);
|
||||
|
||||
vec3s
|
||||
test_rand_vec3s();
|
||||
|
||||
void
|
||||
test_rand_vec4(vec4 dest);
|
||||
|
||||
|
@@ -12,6 +12,7 @@ test_vec3(void **state) {
|
||||
mat3 rot1m3;
|
||||
mat4 rot1;
|
||||
vec3 v, v1, v2;
|
||||
vec3s vs1, vs2, vs3, vs4;
|
||||
|
||||
/* test zero */
|
||||
glm_vec3_zero(v);
|
||||
@@ -75,4 +76,12 @@ test_vec3(void **state) {
|
||||
|
||||
test_assert_vec3_eq(v1, v2);
|
||||
test_assert_vec3_eq(v1, GLM_ZUP);
|
||||
|
||||
/* structs */
|
||||
vs1 = test_rand_vec3s();
|
||||
vs2 = test_rand_vec3s();
|
||||
|
||||
vs3 = glms_vec3_add(vs1, vs2);
|
||||
vs4 = glms_vec3_maxv(vs1, vs3);
|
||||
test_assert_vec3s_eq(vs3, vs4);
|
||||
}
|
||||
|
Reference in New Issue
Block a user