Small refactor and add some more basic functions
This commit is contained in:
parent
519fbd131a
commit
55ba9f6cde
2 changed files with 33 additions and 16 deletions
|
|
@ -84,6 +84,19 @@ int test_mat3_identity() {
|
|||
fabs(i.r3.z - 1.0) < 1e-12;
|
||||
}
|
||||
|
||||
int test_mat3_eql() {
|
||||
struct Mat3 a = mat3_identity();
|
||||
struct Mat3 b = mat3_identity();
|
||||
return mat3_eql_tol(a, b, 1e+12);
|
||||
}
|
||||
|
||||
int test_mat3_add() {
|
||||
struct Mat3 a = {{1, 2, 3}, {0, 1, 5}, {0, 0, 0}};
|
||||
struct Mat3 b = {{0, 1, 0}, {0, 1, 1}, {0, 0, 2}};
|
||||
|
||||
struct Mat3 expected_c = {{1, 3, 3}, {0, 2, 6}, {0, 0, 2}};
|
||||
return mat3_eql_tol(expected_c, mat3_add(a, b), 1e-12);
|
||||
}
|
||||
int main() {
|
||||
int tests_total = 0;
|
||||
int tests_passed = 0;
|
||||
|
|
@ -95,6 +108,8 @@ int main() {
|
|||
run_test(test_vec3_scale);
|
||||
run_test(test_vec3_cross);
|
||||
run_test(test_mat3_identity);
|
||||
run_test(test_mat3_eql);
|
||||
run_test(test_mat3_add);
|
||||
|
||||
if (tests_total == tests_passed) {
|
||||
printf("\033[92mAll tests passed!\033[0m");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue