9 Commits
Author SHA1 Message Date
abdullayevis62382 2f74c66844 Merge branch 'main' into project_tests
-tried to repair
-works with newer c-make versions

# Conflicts:
#	CMakeLists.txt
#	gamecube.cpp
#	gamecube.h
#	tests.cpp
2025-11-17 15:22:17 +01:00
abdullayevis62382 d9abb1cfe9 Merge branch 'main' into project_tests
-tried to repair

# Conflicts:
#	CMakeLists.txt
#	gamecube.cpp
#	gamecube.h
#	tests.cpp
2025-11-17 15:03:57 +01:00
abdullayevis62382 b7b87e7258 my own stuff 2025-11-17 14:40:52 +01:00
abdullayevis62382 1e1e8fe93c Add .gitignore for macOS and IDE files 2025-11-04 16:27:36 +01:00
abdullayevis62382 31e26a7a55 Add docs/tests.txt and initial tests.cpp for gamematrix 2025-11-04 16:04:27 +01:00
Iskender Abdullayev a7ec47ca03 Add completed test plan to docs/tests.txt 2025-11-03 15:37:26 +01:00
freudenreichan 88e29a1d3e CMakeLists.txt betriebssystemunabhängig machen 2025-10-29 16:35:15 +00:00
freudenreichan a1aa30a84c CMakeLists.txt aktualisiert 2025-10-20 12:00:17 +00:00
Anja Freudenreich 4c3bec0b4d initiate git repo 2025-10-12 16:59:58 +02:00
4 changed files with 111 additions and 16 deletions
+2
View File
@@ -0,0 +1,2 @@
.DS_Store
.idea/
+14 -1
View File
@@ -3,6 +3,9 @@ project(Prog3B)
set(CMAKE_CXX_STANDARD 17)
# WICHTIG: wegen raylib + neuer CMake-Version
set(CMAKE_POLICY_VERSION_MINIMUM 3.5)
include(FetchContent)
FetchContent_Declare(
@@ -20,4 +23,14 @@ add_executable(Prog3B
)
target_include_directories(Prog3B PRIVATE .)
target_link_libraries(Prog3B raylib)
target_link_libraries(Prog3B raylib)
# macOS-Frameworks nicht vergessen:
if(APPLE)
target_link_libraries(Prog3B
"-framework Cocoa"
"-framework IOKit"
"-framework CoreVideo"
"-framework OpenGL"
)
endif()
+74
View File
@@ -0,0 +1,74 @@
========================================================
Projekt: gamematrix (C++ Library)
Rolle: Tester
Datei: tests.txt
Datum: ____________________
Team: ____________________
========================================================
# ----------------------------
# 1. Testplan Übersicht
# ----------------------------
Ziel: Überprüfung der Funktionen matmul(), translate(), rot3D().
Hinweise:
- Numerik: Vergleiche mit EPS = 1e-6
- Winkelmaß: rot3D erwartet Grad (90/180/270). (Anpassen, falls Implementierung Radiant nutzt.)
- Homogene Koordinate: Beim Anwenden von Mat4 auf Vec3 gilt w = 1.
| Funktion | Testfall | Eingabe / Setup | Erwartetes Ergebnis / Prüfung | Bemerkung |
|---------------|-----------------------------------|----------------------------------------------------------------------------------|-------------------------------------------------------------|------------------------------------|
| matmul | Identity * Identity | A = I4, B = I4 | C = I4 | Basisfall |
| matmul | Beispielmatrizen | A = [[1,2,0,0],[0,1,3,0],[0,0,1,4],[0,0,0,1]]; B = [[1,0,5,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]] | C = A*B (per Hand gerechnet); alle Einträge ≈ erwartet | Handrechnung in Abschnitt 2 |
| matmul | Assoziativität (Stichprobe) | Zufällige A,B,C (kleine Ganzzahlen) | (A*B)*C ≈ A*(B*C) | Numerisch mit EPS |
| matmul | Nicht-Kommutativität | A = rotZ(90), B = rotX(90) | A*B ≠ B*A | Beispiel |
| translate | Matrix-Struktur | t = (1,2,3) | T = [[1,0,0,1],[0,1,0,2],[0,0,1,3],[0,0,0,1]] | Letzte Spalte ist Translation |
| translate | Anwendung auf Vektor | v = (4,5,6), T = translate(1,2,3) | T·(v,1) → (5,7,9) | Homogene 1 beachten |
| rot3D | Rotation Z 90° | v = (1,0,0), Rz = rot3D(90,'z') | Rz·v → (0,1,0) | Rechtshändiges System |
| rot3D | Rotation X 180° | v = (0,1,0), Rx = rot3D(180,'x') | Rx·v → (0,-1,0) | |
| rot3D | Rotation Y 270° (Korrektur) | v = (1,0,0), Ry = rot3D(270,'y') | Ry·v → (0,0,1) | Vorher war -1: korrigiert |
| rot3D | Inverse | R = rot3D(θ,axis) | R * rot3D(-θ,axis) ≈ I4 | Für θ ∈ {30, 90} testen |
| rot3D+trans | Reihenfolge-Effekt | Rz = rot3D(90,'z'), T = translate(1,0,0), p=(1,0,0) | Rz*T·p ≠ T*Rz·p (aber jeweils plausibles Ergebnis) | Reihenfolge wichtig |
# ----------------------------
# 2. Testdaten / Matrizen
# ----------------------------
- Identity I4 = diag(1,1,1,1)
- Beispielmatrizen für matmul:
A = [[1,2,0,0],
[0,1,3,0],
[0,0,1,4],
[0,0,0,1]]
B = [[1,0,5,0],
[0,1,0,0],
[0,0,1,0],
[0,0,0,1]]
Erwartetes C = A*B =
[[1,2,5,0],
[0,1,3,0],
[0,0,1,4],
[0,0,0,1]]
- Translation t = (1,2,3) ⇒
T = [[1,0,0,1],
[0,1,0,2],
[0,0,1,3],
[0,0,0,1]]
- Beispielvektoren:
v1=(1,0,0), v2=(0,1,0), v3=(4,5,6)
# ----------------------------
# 3. Abnahmekriterien
# ----------------------------
- Alle Unit-Tests erfolgreich (keine Abweichung > EPS)
- Einheitliches Winkelmaß eingehalten (Grad oder Radiant, dokumentiert)
- Keine Exceptions außer gewollt (z. B. ungültige Achse löst definierte Exception aus)
- Testbericht (Eingaben, erwartetes Ergebnis, Ist-Ergebnis, Status, Bemerkung) vollständig
========================================================
Hinweis:
- Diese Datei wird vom Tester gepflegt.
- Tester dokumentiert Input, Output, erwartetes Ergebnis und Erfolg/Fehler.
========================================================
+21 -15
View File
@@ -1,22 +1,28 @@
#include <iostream>
#include <cmath>
#include "gamematrix.h"
using namespace Matrix3D;
void test_rotation_z() {
Vec3 v{1,0,0};
auto R = rot3D(90,'z');
Vec3 res = apply(R,v);
std::cout << "Rotate Z 90° -> (" << res.x << "," << res.y << "," << res.z << ")\n";
}
void test_translate() {
Vec3 v{0,0,0};
auto T = translate({1,2,3});
Vec3 res = apply(T,v);
std::cout << "Translate -> (" << res.x << "," << res.y << "," << res.z << ")\n";
bool approx(double a, double b, double eps = 1e-6) {
return std::fabs(a - b) < eps;
}
int main() {
test_rotation_z();
test_translate();
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;
}