34 lines
670 B
C
34 lines
670 B
C
|
|
#include "./mathprimitives.h"
|
||
|
|
#include <stdio.h>
|
||
|
|
|
||
|
|
#ifdef assert
|
||
|
|
#undef assert
|
||
|
|
#endif
|
||
|
|
|
||
|
|
int test_vec3_equal_tol() {
|
||
|
|
struct Vec3 a = {.x = 1.0, .y = 2.0, .z = 3.0};
|
||
|
|
struct Vec3 b = {.x = 1.0, .y = 2.0, .z = 3.0};
|
||
|
|
|
||
|
|
return vec3_eql_tol(a, b, 1e-12);
|
||
|
|
}
|
||
|
|
|
||
|
|
int main() {
|
||
|
|
int tests_total = 0;
|
||
|
|
int tests_passed = 0;
|
||
|
|
|
||
|
|
tests_total += 1;
|
||
|
|
if (test_vec3_equal_tol()) {
|
||
|
|
tests_passed += 1;
|
||
|
|
} else {
|
||
|
|
printf("\033[91mtest_vec3_equal_tol failed\033[0m");
|
||
|
|
};
|
||
|
|
|
||
|
|
if (tests_total == tests_passed) {
|
||
|
|
printf("\033[92mAll tests passed!\033[0m");
|
||
|
|
} else {
|
||
|
|
|
||
|
|
printf("\033[91m%d of %d tests failed\033[0m", tests_total - tests_passed,
|
||
|
|
tests_total);
|
||
|
|
}
|
||
|
|
}
|