Tests für rot_2D und rot_3D

This commit is contained in:
Lena committed 2026-10-28 21:29:44 +01:00
1 parent 70e1a351f3
commit 7753115638
6 files changed
+196 -54

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
import math
import pytest
from compute import rot_2D, rot_3D
def test_rot_2D_winkel_null():
# Arrange
winkel = 0
erwartet = [[1, 0], [0, 1]]
# Act
ergebnis = rot_2D(winkel)
# Assert
assert ergebnis == erwartet
def test_rot_2D_winkel_90():
# Arrange
winkel = math.pi / 2
erwartet = [[0, -1], [1, 0]]
# Act
ergebnis = rot_2D(winkel)
# Assert
assert ergebnis[0] == pytest.approx(erwartet[0]) and ergebnis[1] == pytest.approx(
erwartet[1]
)
def test_rot_3D_winkel_null():
# Arrange
winkel = 0
achse = "z"
erwartet = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
# Act
ergebnis = rot_3D(winkel, achse)
# Assert
assert ergebnis == erwartet
def test_rot_3D_winkel_90():
# Arrange
winkel = math.pi / 2
achse = "z"
erwartet = [[0, -1, 0], [1, 0, 0], [0, 0, 1]]
# Act
ergebnis = rot_3D(winkel, achse)
# Assert
assert (
ergebnis[0] == pytest.approx(erwartet[0])
and ergebnis[1] == pytest.approx(erwartet[1])
and ergebnis[2] == pytest.approx(erwartet[2])
)