Add docs/tests.txt and initial tests.cpp for gamematrix
This commit is contained in:
parent
a7ec47ca03
commit
31e26a7a55
28
tests.cpp
Normal file
28
tests.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#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;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user