fifth commit: test_rot 2D/3D added
This commit is contained in:
1 parent
043440e38c
commit
b649addb49
4 files changed
+33
-4
No files matched your search
Generated
+1
@@ -2,6 +2,7 @@
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/.venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.13 (matrixmania)" jdkType="Python SDK" />
|
||||
|
||||
@@ -1 +1 @@
|
||||
from compute import matmul, transpose, rot_2D
|
||||
from .compute import matmul, transpose, rot_2D, rot_3D
|
||||
@@ -1 +0,0 @@
|
||||
from compute import matmul, transpose, rot_2D
|
||||
@@ -1,9 +1,38 @@
|
||||
import pytest
|
||||
from matrixmania import rot_2D, rot_3D
|
||||
import math
|
||||
|
||||
def test_matrixmania():
|
||||
def test_rot_2D():
|
||||
#Arrange
|
||||
theta = math.pi / 2
|
||||
expected_value = [
|
||||
[0.0, -1.0],
|
||||
[1.0, 0.0]
|
||||
]
|
||||
|
||||
|
||||
#Act
|
||||
|
||||
result = rot_2D(theta)
|
||||
|
||||
#Assert
|
||||
assert len(result) == len(expected_value)
|
||||
for row_result, row_expected in zip(result, expected_value):
|
||||
assert row_result == pytest.approx(row_expected, abs=1e-5)
|
||||
|
||||
def test_rot_3D():
|
||||
#Arrange
|
||||
angle = 90
|
||||
axis = "z"
|
||||
expected_value = [
|
||||
[0.0, -1.0, 0.0],
|
||||
[1.0, 0.0, 0.0],
|
||||
[0.0, 0.0, 1.0]
|
||||
]
|
||||
|
||||
#Act
|
||||
result = rot_3D(angle,axis)
|
||||
|
||||
#Assert
|
||||
assert len(result) == len(expected_value)
|
||||
for row_result, row_expected in zip(result, expected_value):
|
||||
assert row_result == pytest.approx(row_expected, abs=1e-5)
|
||||
Reference in new issue
Block a user