Ejemplo n.º 1
0
def test_mario_resize_to_large():
    GAME = Game(0, 100, 1)

    # Assert changes on resize
    GAME.player.resize(1)
    assert GAME.player.get_size() == (4, 3)
    assert GAME.player.maxj == 11

    mario_exists_in_bounds(GAME)
Ejemplo n.º 2
0
def test_mario_move_right():
    GAME = Game(99, 100, 1)
    mario = GAME.player
    oldloc = mario.get_loc()
    mario.move(1)
    newloc = mario.get_loc()

    assert oldloc[1] == newloc[1] - 1

    mario_exists_in_bounds(GAME)
Ejemplo n.º 3
0
def test_mario_move_left():
    GAME = Game(0, 100, 1)
    mario = GAME.player
    oldloc = mario.get_loc()
    mario.move(2)
    newloc = mario.get_loc()

    assert oldloc[1] == newloc[1] + 1

    mario_exists_in_bounds(GAME)
Ejemplo n.º 4
0
def test_mario_jump():
    GAME = Game(99, 100, 1)
    mario = GAME.player

    mario.move(3)
    # Check jump up
    assert mario.jstate == mario.maxj
    while mario.jstate > 0:
        pjstate = mario.jstate
        mario.vertical()
        if pjstate == 1:
            assert mario.jstate == -1
        else:
            assert mario.jstate == pjstate - 1
        mario_exists_in_bounds(GAME)
Ejemplo n.º 5
0
def test_mario_init_with_default_params():
    '''
    Check for proper initialization of Mario in default
    '''
    GAME = Game(0, 100, 1)

    PLAYER_POS_I = GAME.player.i
    PLAYER_POS_J = GAME.player.j
    PLAYER_SIZE_I = GAME.player.get_size()[0]
    PLAYER_SIZE_J = GAME.player.get_size()[1]

    assert GAME.player.lives == 1
    assert GAME.player.get_size() == (3, 3)

    mario_exists_in_bounds(GAME)
    test_mario_resize_to_large()