-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathintegrationtests.py
More file actions
executable file
·42 lines (33 loc) · 1.35 KB
/
integrationtests.py
File metadata and controls
executable file
·42 lines (33 loc) · 1.35 KB
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
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3.11
import unittest
from toy_robot.platform import Table
from toy_robot.blueprint import Robot
from toy_robot.processor import MovesetParser, Runner
table = Table(5, 5)
robot = Robot()
moveset = MovesetParser('moveset.txt').parse_moveset()
runner = Runner(moveset, robot, table)
print(runner.action())
class IntegrationTests(unittest.TestCase):
def test_a(self):
robot = Robot()
moveset = MovesetParser('fixtures/test_a.txt').parse_moveset()
runner = Runner(moveset, robot, table)
self.assertEqual(runner.action(), "End of commands, last location is: (0, 2) SOUTH")
def test_b(self):
robot = Robot()
moveset = MovesetParser('fixtures/test_b.txt').parse_moveset()
runner = Runner(moveset, robot, table)
self.assertEqual(runner.action(), "End of commands, last location is: (1, 1) EAST")
def test_c(self):
robot = Robot()
moveset = MovesetParser('fixtures/test_c.txt').parse_moveset()
runner = Runner(moveset, robot, table)
self.assertEqual(runner.action(), "End of commands, last location is: (3, 0) SOUTH")
def test_d(self):
robot = Robot()
moveset = MovesetParser('fixtures/test_d.txt').parse_moveset()
runner = Runner(moveset, robot, table)
self.assertEqual(runner.action(), "End of commands, robot was never placed on the table!")
if __name__ == '__main__':
unittest.main()