-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_forestry.py
More file actions
33 lines (27 loc) · 789 Bytes
/
test_forestry.py
File metadata and controls
33 lines (27 loc) · 789 Bytes
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
33
from agressionSimulation import bird, clearing, forest, simulation_logger
# Set up testing variables
bird1 = bird()
bird1.setBirdChars("H", "M", 100, 200, 10)
bird2 = bird()
bird2.setBirdChars('H', "F", 100, 200, 10)
sl = simulation_logger()
sl.new_day()
# Create forest object
fr = forest(2, 10, 1, 1, 0.1, sl)
# Test the load function
fr.load([bird1, bird2])
assert fr.allBirds == [bird1, bird2]
assert len(fr.spaces) == 2
# Test the occupy function
fr.occupy()
count_birds = len(fr.nonOccupiedBirds)
for cl in fr.spaces:
count_birds += len(cl.birds)
# Test the time function via the simulation_logger save function
fr = forest(2, 10, 1, 1, 0.1, sl)
fr.load([bird1, bird2])
for day in range(0, 25):
fr.time()
sl.new_day()
sl.save()
print("Passed all forestry tests!")