import math import pytest from matrixmania.compute import rot_3D def test_rot_3D_x_axis(): # Test bei 0 Radian (Identitätsmatrix) res = rot_3D(0.0, "x") assert res == [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] # Test bei 90 Grad (PI / 2) res_90 = rot_3D(math.pi / 2, "x") assert pytest.approx(res_90[1][1]) == 0.0 assert pytest.approx(res_90[1][2]) == -1.0 assert pytest.approx(res_90[2][1]) == 1.0 assert pytest.approx(res_90[2][2]) == 0.0 def test_rot_3D_y_axis(): res = rot_3D(0.0, "y") assert res == [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] def test_rot_3D_z_axis(): res = rot_3D(0.0, "z") assert res == [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]] def test_rot_3D_invalid_axis(): # Prüft, ob bei ungültiger Achse ein ValueError geworfen wird with pytest.raises(ValueError): rot_3D(1.0, "w")