-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestCase.py
More file actions
28 lines (23 loc) · 834 Bytes
/
TestCase.py
File metadata and controls
28 lines (23 loc) · 834 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
#!/usr/bin/python
from DroneException import DroneException
from ServerMessenger import ServerMessenger
class TestCase:
def __init__(self, name, timeLimit, drones, noFlyZones, mannedAviation):
self.name = name
self.timeLimit = timeLimit
self.drones = drones
self.noFlyZones = noFlyZones
self.mannedAviation = mannedAviation
# TODO make this a field in drone
self.serverMessenger = ServerMessenger()
def run(self):
self.serverMessenger.postTestCase(self.noFlyZones, self.mannedAviation)
i = 0
while i < self.timeLimit:
for drone in self.drones:
try:
drone.tick(i, self.serverMessenger)
except DroneException:
return False
i += 1
return 0