28 lines
824 B
Python
28 lines
824 B
Python
|
|
||
|
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))
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
unittest.main()
|