test: add missing mat2x4 tests

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
Vincent Davis Jr
2023-08-06 10:18:41 -04:00
parent 006e4ffbdf
commit 37d20f7da8
4 changed files with 194 additions and 1 deletions

View File

@@ -22,6 +22,21 @@ test_rand_mat4(mat4 dest) {
/* glm_scale(dest, (vec3){drand48(), drand48(), drand48()}); */
}
void
test_rand_mat4x2(mat4x2 dest) {
dest[0][0] = drand48();
dest[0][1] = drand48();
dest[1][0] = drand48();
dest[1][1] = drand48();
dest[2][0] = drand48();
dest[2][1] = drand48();
dest[3][0] = drand48();
dest[3][1] = drand48();
}
void
test_rand_mat3(mat3 dest) {
mat4 m4;
@@ -59,6 +74,18 @@ test_rand_mat2x3(mat2x3 dest) {
dest[1][2] = drand48();
}
void
test_rand_mat2x4(mat2x4 dest) {
dest[0][0] = drand48();
dest[0][1] = drand48();
dest[0][2] = drand48();
dest[0][3] = drand48();
dest[1][0] = drand48();
dest[1][1] = drand48();
dest[1][2] = drand48();
dest[1][3] = drand48();
}
void
test_rand_vec3(vec3 dest) {
dest[0] = drand48();
@@ -233,6 +260,19 @@ test_assert_mat2x4_eq_zero(mat2x4 m2x4) {
TEST_SUCCESS
}
test_status_t
test_assert_mat2x4_eq(mat2x4 m1, mat2x4 m2) {
int i, j;
for (i = 0; i < 2; i++) {
for (j = 0; j < 4; j++) {
ASSERT(fabsf(m1[i][j] - m2[i][j]) <= 0.0000009)
}
}
TEST_SUCCESS
}
test_status_t
test_assert_mat3_eq(mat3 m1, mat3 m2) {
int i, j;
@@ -371,6 +411,19 @@ test_assert_mat4x2_eq_zero(mat4x2 m4x2) {
TEST_SUCCESS
}
test_status_t
test_assert_mat4x2_eq(mat4x2 m1, mat4x2 m2) {
int i, j;
for (i = 0; i < 4; i++) {
for (j = 0; j < 2; j++) {
ASSERT(fabsf(m1[i][j] - m2[i][j]) <= 0.0000009)
}
}
TEST_SUCCESS
}
test_status_t
test_assert_mat4x3_eq_zero(mat4x3 m4x3) {
int i, j;