Add rotation and projection tests
This commit is contained in:
1 parent
f1861b4a39
commit
9aa475906e
9 files changed
+356
-148
No files matched your search
@@ -0,0 +1,36 @@
|
||||
|
||||
import math
|
||||
|
||||
import pytest
|
||||
|
||||
from matrixmania.compute import rot_2D, rot_3D
|
||||
|
||||
|
||||
def test_rot_2D():
|
||||
# Arrange
|
||||
angle = math.pi / 2
|
||||
expected = [[0.0, -1.0], [1.0, 0.0]]
|
||||
|
||||
# Act
|
||||
result = rot_2D(angle)
|
||||
|
||||
# Assert
|
||||
for row, expected_row in zip(result, expected):
|
||||
assert row == pytest.approx(expected_row)
|
||||
|
||||
|
||||
def test_rot_3D():
|
||||
# Arrange
|
||||
angle = math.pi / 2
|
||||
expected = [
|
||||
[0.0, -1.0, 0.0],
|
||||
[1.0, 0.0, 0.0],
|
||||
[0.0, 0.0, 1.0],
|
||||
]
|
||||
|
||||
# Act
|
||||
result = rot_3D(angle, "z")
|
||||
|
||||
# Assert
|
||||
for row, expected_row in zip(result, expected):
|
||||
assert row == pytest.approx(expected_row)
|
||||
Reference in new issue
Block a user