Merge pull request #301 from EasyIP2023/feature/glm_mat2_make

mat2: add new function glm_mat2_make
This commit is contained in:
Recep Aslantas
2023-05-15 11:18:27 +03:00
committed by GitHub
7 changed files with 70 additions and 0 deletions

View File

@@ -8,6 +8,7 @@
#include "test_common.h"
#define A_MATRIX2x2 {{1,2},{5,6}}
#define MAT2_ARRAY {1, 5, 2, 7}
#ifndef CGLM_TEST_MAT2_ONCE
#define CGLM_TEST_MAT2_ONCE
@@ -283,4 +284,19 @@ TEST_IMPL(GLM_PREFIX, mat2_rmc) {
TEST_SUCCESS
}
TEST_IMPL(GLM_PREFIX, mat2_make) {
mat2 dest;
unsigned int i, j;
float src[4] = MAT2_ARRAY;
GLM(mat2_make)(src, dest);
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=2, j++) {
ASSERT(test_eq(dest[j][0], src[i]))
ASSERT(test_eq(dest[j][1], src[i+1]))
}
TEST_SUCCESS
}
#undef A_MATRIX2x2