-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleGeneration_test.py
32 lines (26 loc) · 998 Bytes
/
SimpleGeneration_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import pytest
from pcg import level_generation, math
@pytest.fixture
def positions():
return [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@pytest.mark.parametrize(
"axis, positionChecker",
[
(math.Vector3(1, 0, 0), lambda position: position.x),
(math.Vector3(-1, 0, 0), lambda position: -position.x),
(math.Vector3(0, 1, 0), lambda position: position.y),
(math.Vector3(0, -1, 0), lambda position: -position.y),
(math.Vector3(0, 0, 1), lambda position: position.z),
(math.Vector3(0, 0, -1), lambda position: -position.z),
],
)
def test_simpleLevelGeneration(resetSeed, positions, axis, positionChecker):
generationData = level_generation.GenerationData(10, 1, math.Vector3(0, 0, 0))
index = 0
def callback(position):
nonlocal index
assert positions[index] == positionChecker(position)
index += 1
level_generation.simpleGeneration(
generationData, axis, lambda position: callback(position)
)