test_quat: add more robust quat_make test

Makes it so that it's easier to identify
the potential usecase of function. Commit also
includes a fix to the struct/quat.h glms_quat_make
comment. Should be returning versors it's not
a void function.

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
This commit is contained in:
Vincent Davis Jr
2023-07-02 12:09:36 -05:00
parent 49dd24eaf2
commit 5e798a94e3
3 changed files with 17 additions and 7 deletions

View File

@@ -1086,12 +1086,22 @@ TEST_IMPL(GLM_PREFIX, quat_rotate_atm) {
}
TEST_IMPL(GLM_PREFIX, quat_make) {
versor dest;
float src[4] = {7.2f, 1.0f, 2.5f, 6.1f};
versor dest[3];
float src[12] = {
7.2f, 1.0f, 2.5f, 6.1f,
0.2f, 2.8f, 17.3f, 5.1f,
4.2f, 7.3f, 6.6f, 8.8f
};
GLM(quat_make)(src, dest);
for (unsigned int i = 0; i < sizeof(src) / sizeof(float); i++) {
ASSERT(test_eq(src[i], dest[i]));
float *srcp = src;
unsigned int i, j;
for (i = 0, j = 0; i < sizeof(src) / sizeof(float); i+=4,j++) {
GLM(quat_make)(srcp + i, dest[j]);
ASSERT(test_eq(src[ i ], dest[j][0]));
ASSERT(test_eq(src[i+1], dest[j][1]));
ASSERT(test_eq(src[i+2], dest[j][2]));
ASSERT(test_eq(src[i+3], dest[j][3]));
}
TEST_SUCCESS