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
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
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
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
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
def test_all_strikes(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(10, 10, [10, 10, 10])) == 300
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
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
def test_last_frame_spare(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 10, [9, 1, 9])) == 19
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
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
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
def test_all_ones_game(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(1, 0)) == 20
def test_gutter_game(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 0)) == 0