Exemplo n.º 1
0
def test_starting_resources_health(char_state, prev_health, cur_health,
                                   expected_low, expected_no):
    run_state = RunState()
    run_state.health = prev_health

    player = Player(state=char_state, health=cur_health)
    run_state.update_starting_resources(player, WinState.NO_WIN)
    assert run_state.health == cur_health

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low

    is_no = Label.NO in run_state.run_label._set
    assert is_no == expected_no
Exemplo n.º 2
0
def test_starting_resources_bombs(prev_bombs, cur_bombs, expected_low,
                                  expected_no):
    run_state = RunState()
    run_state.bombs = prev_bombs

    inventory = Inventory(bombs=cur_bombs)
    player = Player(inventory=inventory)
    run_state.update_starting_resources(player, WinState.NO_WIN)

    assert run_state.bombs == cur_bombs

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low

    is_no = Label.NO in run_state.run_label._set
    assert is_no == expected_no
Exemplo n.º 3
0
def test_starting_resources_ropes(level_start_ropes, prev_ropes, cur_ropes,
                                  win_state, expected_low, expected_no):
    run_state = RunState()
    run_state.level_start_ropes = level_start_ropes
    run_state.ropes = prev_ropes

    inventory = Inventory(ropes=cur_ropes)
    player = Player(inventory=inventory)
    run_state.update_starting_resources(player, win_state)

    assert run_state.ropes == cur_ropes

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low

    is_no = Label.NO in run_state.run_label._set
    assert is_no == expected_no