Praktikum 3: Post Tests
This commit is contained in:
1 parent
a2f6206bba
commit
10e0bd9557
5 files changed
+383
-1
No files matched your search
@@ -0,0 +1,20 @@
|
||||
from src.compute import project_ortho
|
||||
|
||||
def test_ortho_1():
|
||||
|
||||
point = (1.0, 2.0, 3.0)
|
||||
exp_point = (1.0, 2.0)
|
||||
|
||||
result = project_ortho(point)
|
||||
|
||||
assert result == exp_point
|
||||
|
||||
def test_ortho_2():
|
||||
|
||||
point = (1.0, 2.0, 3.0)
|
||||
exp_point = (100.0, 200.0)
|
||||
|
||||
result = project_ortho(point, 100)
|
||||
|
||||
assert result == exp_point
|
||||
|
||||
@@ -0,0 +1,183 @@
|
||||
from src.compute import rot_2d, rot_3d
|
||||
import math
|
||||
|
||||
def test_rot2d_1():
|
||||
|
||||
angle = 0
|
||||
expected_value = [[1, 0], [0, 1]]
|
||||
|
||||
result = rot_2d(angle)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot2d_2():
|
||||
|
||||
angle = math.pi/2
|
||||
expected_value = [[0, -1], [1, 0]]
|
||||
|
||||
result = rot_2d(angle)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot2d_3():
|
||||
|
||||
angle = math.pi
|
||||
expected_value = [[-1, 0], [0, -1]]
|
||||
|
||||
result = rot_2d(angle)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot2d_4():
|
||||
|
||||
angle = 3*math.pi/2
|
||||
expected_value = [[0, 1], [-1, 0]]
|
||||
|
||||
result = rot_2d(angle)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot2d_5():
|
||||
|
||||
angle = 2*math.pi
|
||||
expected_value = [[1, 0], [0, 1]]
|
||||
|
||||
result = rot_2d(angle)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
|
||||
def test_rot3d_1x():
|
||||
angle = 0
|
||||
axis = "x"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_1y():
|
||||
angle = 0
|
||||
axis = "y"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_1z():
|
||||
angle = 0
|
||||
axis = "z"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_2x():
|
||||
angle = math.pi/2
|
||||
axis = "x"
|
||||
expected_value = [[1, 0, 0], [0, 0, -1], [0, 1, 0]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_2y():
|
||||
angle = math.pi/2
|
||||
axis = "y"
|
||||
expected_value = [[0, 0, 1], [0, 1, 0], [-1, 0, 0]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_2z():
|
||||
angle = math.pi/2
|
||||
axis = "z"
|
||||
expected_value = [[0, -1, 0], [1, 0, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_3x():
|
||||
angle = math.pi
|
||||
axis = "x"
|
||||
expected_value = [[1, 0, 0], [0, -1, 0], [0, 0, -1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_3y():
|
||||
angle = math.pi
|
||||
axis = "y"
|
||||
expected_value = [[-1, 0, 0], [0, 1, 0], [0, 0, -1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_3z():
|
||||
angle = math.pi
|
||||
axis = "z"
|
||||
expected_value = [[-1, 0, 0], [0, -1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_4x():
|
||||
angle = 3*math.pi/2
|
||||
axis = "x"
|
||||
expected_value = [[1, 0, 0], [0, 0, 1], [0, -1, 0]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_4y():
|
||||
angle = 3*math.pi/2
|
||||
axis = "y"
|
||||
expected_value = [[0, 0, -1], [0, 1, 0], [1, 0, 0]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_4z():
|
||||
angle = 3*math.pi/2
|
||||
axis = "z"
|
||||
expected_value = [[0, 1, 0], [-1, 0, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_5x():
|
||||
angle = 2*math.pi
|
||||
axis = "x"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_5y():
|
||||
angle = 2*math.pi
|
||||
axis = "y"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
|
||||
def test_rot3d_5z():
|
||||
angle = 2*math.pi
|
||||
axis = "z"
|
||||
expected_value = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
|
||||
|
||||
result = rot_3d(angle, axis)
|
||||
|
||||
assert result == expected_value
|
||||
Reference in new issue
Block a user