2012-08-07 13:23:05 +02:00
|
|
|
|
|
|
|
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))
|
|
|
|
|
2012-08-07 15:26:16 +02:00
|
|
|
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))
|
|
|
|
|
2012-08-07 13:23:05 +02:00
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|