Example #1
0
def test_food_random():
    game = Game()

    food1 = game.food_pos
    game.food_spawn()
    food2 = game.food_pos

    assert (food1 != food2)
Example #2
0
def test_score_plus():
    snake = Snake()
    game = Game()

    snake.position = game.food_pos

    game.eat(snake)
    assert (game.score == 1)
Example #3
0
def test_live():
    snake = Snake()
    game = Game()

    snake.position = [100, 50]

    game.dead(snake)
    assert (game.run == True)
Example #4
0
def test_dead_in_top():
    snake = Snake()
    game = Game()

    snake.position = [512, 50]

    game.dead(snake)
    assert (game.run == False)
Example #5
0
def test_dead_in_right():
    snake = Snake()
    game = Game()

    snake.position = [200, 0]

    game.dead(snake)
    assert (game.run == False)