mirror of
https://github.com/recp/cglm.git
synced 2025-12-24 20:34:58 +00:00
vec: add one and zero helpers for vectors
This commit is contained in:
@@ -29,7 +29,10 @@ main(int argc, const char * argv[]) {
|
||||
cmocka_unit_test(test_quat),
|
||||
|
||||
/* vec4 */
|
||||
cmocka_unit_test(test_vec4)
|
||||
cmocka_unit_test(test_vec4),
|
||||
|
||||
/* vec3 */
|
||||
cmocka_unit_test(test_vec3)
|
||||
};
|
||||
|
||||
return cmocka_run_group_tests(tests, NULL, NULL);
|
||||
|
||||
@@ -31,4 +31,7 @@ test_quat(void **state);
|
||||
void
|
||||
test_vec4(void **state);
|
||||
|
||||
void
|
||||
test_vec3(void **state);
|
||||
|
||||
#endif /* test_tests_h */
|
||||
|
||||
21
test/src/test_vec3.c
Normal file
21
test/src/test_vec3.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* Copyright (c), Recep Aslantas.
|
||||
*
|
||||
* MIT License (MIT), http://opensource.org/licenses/MIT
|
||||
* Full license can be found in the LICENSE file
|
||||
*/
|
||||
|
||||
#include "test_common.h"
|
||||
|
||||
void
|
||||
test_vec3(void **state) {
|
||||
vec3 v;
|
||||
|
||||
/* test zero */
|
||||
glm_vec_zero(v);
|
||||
test_assert_vec3_eq(GLM_VEC3_ZERO, v);
|
||||
|
||||
/* test one */
|
||||
glm_vec_one(v);
|
||||
test_assert_vec3_eq(GLM_VEC3_ONE, v);
|
||||
}
|
||||
@@ -70,4 +70,12 @@ test_vec4(void **state) {
|
||||
test_rand_vec4(v);
|
||||
test_assert_eqf(test_vec4_norm2(v), glm_vec4_norm2(v));
|
||||
}
|
||||
|
||||
/* test zero */
|
||||
glm_vec4_zero(v);
|
||||
test_assert_vec4_eq(GLM_VEC4_ZERO, v);
|
||||
|
||||
/* test one */
|
||||
glm_vec4_one(v);
|
||||
test_assert_vec4_eq(GLM_VEC4_ONE, v);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user