Hausaufgabe tests hinzufügen und §D funktion in commit
This commit is contained in:
1 parent
153b0ac6b4
commit
bf436441ce
4 files changed
+90
No files matched your search
Whitespace-only changes.
@@ -0,0 +1,30 @@
|
||||
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
|
||||
Reference in new issue
Block a user