Initial commit with basic vec3 equals function

This commit is contained in:
Alex Selimov 2026-10-20 22:48:22 -04:00
commit c171a2ff7a
8 changed files with 139 additions and 0 deletions

33
mathprimitives/test.c Normal file
View file

@ -0,0 +1,33 @@
#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);
}
}