mirror of
https://github.com/guezoloic/t3dsr.git
synced 2026-01-25 07:34:23 +00:00
test(vector3): add rotateVector3_test function
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define SUCCESS(X) printf("\n--------- All %s tests succeeded ---------\n\n", X);
|
||||
|
||||
int main() {
|
||||
|
||||
// --- Vector3 ---
|
||||
@@ -17,7 +19,8 @@ int main() {
|
||||
projVector3_test();
|
||||
reflVector3_test();
|
||||
distVector3_test();
|
||||
printf("All Vector3 tests succeeded\n");
|
||||
rotateVector3_test();
|
||||
SUCCESS("Vector3");
|
||||
|
||||
// --- Vector4 ---
|
||||
|
||||
@@ -32,8 +35,8 @@ int main() {
|
||||
projVector4_test();
|
||||
reflVector4_test();
|
||||
distVector4_test();
|
||||
printf("All Vector4 tests succeeded\n");
|
||||
SUCCESS("Vector4");
|
||||
|
||||
printf("All tests succeeded\n");
|
||||
SUCCESS("");
|
||||
return 0;
|
||||
}
|
||||
@@ -129,6 +129,23 @@ void distVector3_test() {
|
||||
printf("Finished distVector3_test!\n\n");
|
||||
}
|
||||
|
||||
void rotateVector3_test() {
|
||||
printf("Running RotateVector3_test...\n");
|
||||
|
||||
Vec3 v = {1.0f, 0.0f, 0.0f};
|
||||
Vec3 axis = {0.0f, 0.0f, 1.0f};
|
||||
float angle = M_PI / 2.0f;
|
||||
Vec3* result = vec3Rotate(&v, &axis, angle);
|
||||
printVector3(result);
|
||||
|
||||
assert(fabs(result->x - 0.0f) < 0.0001f);
|
||||
assert(fabs(result->y - 1.0f) < 0.0001f);
|
||||
assert(fabs(result->z - 0.0f) < 0.0001f);
|
||||
|
||||
vec3Free(result);
|
||||
printf("Finished RotateVector3_test!\n\n");
|
||||
}
|
||||
|
||||
// --- Tests Vec4 ---
|
||||
|
||||
void addVector4_test() {
|
||||
|
||||
@@ -14,6 +14,7 @@ void anglVector3_test();
|
||||
void projVector3_test();
|
||||
void reflVector3_test();
|
||||
void distVector3_test();
|
||||
void rotateVector3_test();
|
||||
|
||||
// --- Vector4 ---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user