mirror of
https://github.com/recp/cglm.git
synced 2025-12-26 02:25:02 +00:00
Custom Built-in Unit Test Suite (#105)
* tests: new built-in test runner * tests: update tests for new builtin test api * tests: print test suite logs * tests: remove cmocka from build files * tests: colorize test suite log and remove redundant prints
This commit is contained in:
@@ -7,10 +7,9 @@
|
||||
|
||||
#include "test_common.h"
|
||||
|
||||
void
|
||||
test_euler(void **state) {
|
||||
mat4 rot1, rot2;
|
||||
vec3 inAngles, outAngles;
|
||||
TEST_IMPL(euler) {
|
||||
mat4 rot1, rot2;
|
||||
vec3 inAngles, outAngles;
|
||||
|
||||
inAngles[0] = glm_rad(-45.0f); /* X angle */
|
||||
inAngles[1] = glm_rad(88.0f); /* Y angle */
|
||||
@@ -22,11 +21,11 @@ test_euler(void **state) {
|
||||
glmc_euler_angles(rot1, outAngles);
|
||||
|
||||
/* angles must be equal in that range */
|
||||
test_assert_vec3_eq(inAngles, outAngles);
|
||||
ASSERT(test_assert_vec3_eq(inAngles, outAngles).status == 1)
|
||||
|
||||
/* matrices must be equal */
|
||||
glmc_euler_xyz(outAngles, rot2);
|
||||
test_assert_mat4_eq(rot1, rot2);
|
||||
ASSERT(test_assert_mat4_eq(rot1, rot2).status == 1)
|
||||
|
||||
/* change range */
|
||||
inAngles[0] = glm_rad(-145.0f); /* X angle */
|
||||
@@ -40,5 +39,7 @@ test_euler(void **state) {
|
||||
|
||||
/* matrices must be equal */
|
||||
glmc_euler_xyz(outAngles, rot2);
|
||||
test_assert_mat4_eq(rot1, rot2);
|
||||
ASSERT(test_assert_mat4_eq(rot1, rot2).status == 1)
|
||||
|
||||
TEST_SUCCESS
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user