a-robots-conundrum/tests/rollingstone_tests.py

32 lines
1015 B
Python
Raw Normal View History

import unittest
from robotgame.logic.rollingstone import *
from robotgame.logic.direction import *
playfield_example_succeed = [
[Start(Down), None, None, None ],
[None, None, Stone(), None ],
[Turn(Right), None, Turn(Down), None ],
[None, Stone(), Turn(Right), Goal()],
]
playfield_example_fail = [
[Start(Down), None, None, None ],
[None, None, Stone(), None ],
[Turn(Right), Stone(), Turn(Down), None ],
[None, None, Turn(Right), Goal()],
]
class RollingStoneTest(unittest.TestCase):
def test_playfield(self):
self.assertTrue(reaches_goal(playfield_example_succeed, 100))
self.assertFalse(reaches_goal(playfield_example_fail, 100))
def test_playfield_generation(self):
playfield, min_steps = generate_playfield(10, 10, (0, 0), Down, (9, 9), 10, 5)
# self.assertTrue(reaches_goal(playfield, min_steps))
if __name__ == '__main__':
unittest.main()