def testDrawMap(self): expected = """ -------------------- | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -------------------- """ snake = Snake() actual = snake.draw(None, None) self.assertMultiLineEqual(expected, actual, "Expected:\n\n{0}\nActual:\n\n{1}".format(expected, actual))
def testDrawSnakeHorizontal(self): expected = """ -------------------- | | | | | | | | | | | | | | | | | | | @@@@@ | | | | | | | | | | | | | | | | | | | | | -------------------- """ snake = Snake() snakePositions = [Coordinates(10,10), Coordinates(9,10), Coordinates(8,10), Coordinates(7,10), Coordinates(6,10)] actual = snake.draw(snakePositions, None) self.assertMultiLineEqual(expected, actual, "Expected:\n\n{0}\nActual:\n\n{1}".format(expected, actual))
def testDrawOtherFood(self): expected = """ -------------------- | * | | | | | | | | | | | | | | | | | | @@@@@ *| | | | | | | | | | | | | | | | * * | | | | | -------------------- """ snake = Snake() snakePositions = [Coordinates(10,10), Coordinates(9,10), Coordinates(8,10), Coordinates(7,10), Coordinates(6,10)] foodPositions = [Coordinates(5,1), Coordinates(2,18), Coordinates(17,18), Coordinates(20,10)] actual = snake.draw(snakePositions, foodPositions) self.assertMultiLineEqual(expected, actual, "Expected:\n\n{0}\nActual:\n\n{1}".format(expected, actual))