示例#1
0
 def test_step_eating(self):
     snake = Snake(width=100, height=100)
     snake.food_coordinates = (51, 50)
     snake.step((1, 0))
     self.assertEqual(snake.snake_body, [(51, 50), (50, 50),
                                         (49, 50), (48, 50)])
     self.assertEqual(snake.score, 1)
     self.assertTrue(snake.food_coordinates not in snake.snake_body)
示例#2
0
 def test_step_pushback(self):
     snake = Snake(width=100, height=100)
     snake.food_coordinates = (0, 0)
     snake.step((1, 0))
     self.assertEqual(snake.snake_body, [(51, 50), (50, 50), (49, 50)])
     self.assertEqual(snake.score, 0)
     self.assertEqual(snake.x, 51)
     self.assertEqual(snake.y, 50)
示例#3
0
 def test_step_eating(self):
     snake = Snake(width=100, height=100)
     snake.food_coordinates = (51, 50)
     snake.step((1, 0))
     self.assertEqual(snake.snake_body, [(51, 50), (50, 50), (49, 50),
                                         (48, 50)])
     self.assertEqual(snake.score, 1)
     self.assertTrue(snake.food_coordinates not in snake.snake_body)
示例#4
0
 def test_step_pushback(self):
     snake = Snake(width=100, height=100)
     snake.food_coordinates = (0, 0)
     snake.step((1, 0))
     self.assertEqual(snake.snake_body, [(51, 50), (50, 50), (49, 50)])
     self.assertEqual(snake.score, 0)
     self.assertEqual(snake.x, 51)
     self.assertEqual(snake.y, 50)
示例#5
0
 def test_step_dies(self):
     snake = Snake()
     snake.step((0, 0))
     self.assertTrue(snake.dead)
示例#6
0
 def test_step_dies(self):
     snake = Snake()
     snake.step((0, 0))
     self.assertTrue(snake.dead)