Ejemplo n.º 1
0
def test_frame_total_nine_or_under():
    new_score = Score()
    score_card = [4, 2, 5, 3, 1, 6, 7, 1, 8, 1, 4, 5, 9, 0, 5, 3, 6, 3, 1, 3]
    assert new_score.calculate(score_card) == 77
Ejemplo n.º 2
0
def test_gutter_game():
    new_score = Score()
    score_card = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    assert new_score.calculate(score_card) == 0
Ejemplo n.º 3
0
def test_typical_game():
    new_score = Score()
    score_card = [6, 3, 6, 4, 6, 2, 4, 6, 10, 10, 3, 2, 5, 5, 4, 3, 3, 1]
    assert new_score.calculate(score_card) == 121
Ejemplo n.º 4
0
def test_strike_in_first_frame_five_and_two_in_second():
    new_score = Score()
    score_card = [10, 5, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    assert new_score.calculate(score_card) == 24
Ejemplo n.º 5
0
def test_perfect_game():
    new_score = Score()
    score_card = [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]
    assert new_score.calculate(score_card) == 300
Ejemplo n.º 6
0
def test_all_strikes():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(10, 10,
                                                        [10, 10, 10])) == 300
Ejemplo n.º 7
0
def test_spare_in_first_frame_five_in_second():
    new_score = Score()
    score_card = [9, 1, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    assert new_score.calculate(score_card) == 20
Ejemplo n.º 8
0
def test_all_strikes_except_last_frame():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(10, 10,
                                                        [0, 0, 0])) == 240
Ejemplo n.º 9
0
def test_last_frame_spare():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(0, 10,
                                                        [9, 1, 9])) == 19
Ejemplo n.º 10
0
def test_various_game():
    rolls = [[6, 3], [6, 4], [6, 2], [4, 6], [10, 0], [10, 0], [3, 2], [5, 5],
             [4, 3], [3, 1, 0]]
    new_score = Score()
    assert new_score.calculate(rolls) == 121
Ejemplo n.º 11
0
def test_strike_in_frame_one_ones():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(1, 1, [10, 0])) == 30
Ejemplo n.º 12
0
def test_spare_in_frame_one_ones():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(1, 1, [1, 9])) == 29
Ejemplo n.º 13
0
def test_all_ones_game():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(1, 0)) == 20
Ejemplo n.º 14
0
def test_gutter_game():
    new_score = Score()
    assert new_score.calculate(gen_all_x_except_y_frame(0, 0)) == 0