def test_food_random(): game = Game() food1 = game.food_pos game.food_spawn() food2 = game.food_pos assert (food1 != food2)
def test_score_plus(): snake = Snake() game = Game() snake.position = game.food_pos game.eat(snake) assert (game.score == 1)
def test_live(): snake = Snake() game = Game() snake.position = [100, 50] game.dead(snake) assert (game.run == True)
def test_dead_in_top(): snake = Snake() game = Game() snake.position = [512, 50] game.dead(snake) assert (game.run == False)
def test_dead_in_right(): snake = Snake() game = Game() snake.position = [200, 0] game.dead(snake) assert (game.run == False)