getBeerreturntrue/tests.cpp

29 lines
709 B
C++

#include <iostream>
#include <cmath>
#include "gamematrix.h" // anpassen, falls euer Header anders heißt
bool approx(double a, double b, double eps = 1e-6) {
return std::fabs(a - b) < eps;
}
int main() {
int failed = 0;
// Beispiel-Test: Rotation um Z 90°
std::array<double,3> v = {1,0,0};
auto Rz = rot3D(90, 'z'); // ggf. Namespace anpassen
auto result = apply(Rz, v);
if (!approx(result[0], 0.0) || !approx(result[1], 1.0)) {
std::cout << "Test rot3D(Z,90) failed!\n";
failed++;
}
// Ausgabe
if (failed == 0)
std::cout << "ALL TESTS PASSED ✅\n";
else
std::cout << failed << " TEST(S) FAILED ❌\n";
return failed;
}