Files
matrixmania/test/test_matrixmania/test_rot.py
T

30 lines
676 B
Python

import math
import pytest
from matrixmania.compute import rot_2D, rot_3D
def test_rot2D_90_grad(): # dreht es sich wirklich um 90 grad?
#Arrange
angle = math.pi/2
expected = [
[math.cos(angle), -math.sin(angle)],
[math.sin(angle), math.cos(angle)]
]
#Act
result = rot_2D(angle)
#Assert
assert result == expected
def test_rot3D_drehen(): #dreht sich um 90 grad?
#Arrange
angle = math.pi/2
achse = "z"
expected = [
[math.cos(angle), -math.sin(angle), 0.0],
[math.sin(angle), math.cos(angle), 0.0],
[0.0, 0.0, 1.0],
]
result = rot_3D(angle, achse)
assert result == expected