Beispiel #1
1
def test_score_roll_strike_return_10():
  assert_equals(score([10]), 10)
Beispiel #2
0
 def test_one_strike(self):
     roll_ball(self.frame, 10)
     roll_ball(self.frame, 3)
     roll_ball(self.frame, 4)
     for i in range(16):
         roll_ball(self.frame, 0)
     self.assertEqual(24, score(self.frame))
Beispiel #3
0
 def test_one_spare(self):
     roll_ball(self.frame, 5)
     roll_ball(self.frame, 5)
     roll_ball(self.frame, 3)
     for i in range(17):
         roll_ball(self.frame, 0)
     self.assertEqual(16, score(self.frame))
def test_game_score_two_strikes():
    assert score('9- 9- 9- X X 54 9- 9- 9- 9-') == 116
def test_all_misses():
    assert score('-- -- -- -- -- -- -- -- -- --') == 0
def test_all_spares():
    assert score('5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5') == 150
Beispiel #7
0
def test_score_roll_1_then_2_return_3():
  assert_equals(score([1, 2]), 3)
 def test_score__adds_two_frames_together(self):
     self.frames[0] = (5, 3)
     self.frames[1] = (8, 1)
     score = bowling.score(self.frames)
     self.assertEquals(score, 17, "Two frames should be added together.")
def test_heart_break():
    assert 90 == score('9-9-9-9-9-9-9-9-9-9-')
def test_score_28191():
    assert 23 == score('2/1/1')
 def test_second_throw(self):
     score_list = [3]
     pins = 6
     current_score = score(pins, score_list)
     self.assertEqual(current_score, 9)
Beispiel #12
0
def test1_spare():
    result = '3/ 12 34 00 00 00 00 00 00 00 '
    expected = (10 + 1) + (1 + 2) + (3 + 4)
    assert score(result) == expected
Beispiel #13
0
 def test_all_ones(self):
     for i in range(20):
         roll_ball(self.frame, 1)
     self.assertEqual(20, score(self.frame))
Beispiel #14
0
 def test_score__returns_zero_for_all_gutter_balls(self):
     score = bowling.score(self.frames)
     self.assertEquals(score, 0, "All gutter balls should result in a score of 0.")
Beispiel #15
0
 def test_score__correctly_scores_perfect_game_as_300(self):
     frames = [(10,0)] * 10
     frames.append((10,10))
     score = bowling.score(frames)
     self.assertEquals(score, 300, "Perfect game results in score of 300.")
Beispiel #16
0
 def test_score__adds_the_next_two_throws_if_strike(self):
     self.frames[0] = (10, 0)
     self.frames[1] = (5, 3)
     score = bowling.score(self.frames)
     self.assertEquals(score, 26, "Strike frame should add next two throws to total.")
Beispiel #17
0
 def test_score__adds_the_next_throw_twice_if_spare(self):
     self.frames[0] = (9, 1)
     self.frames[1] = (5, 3)
     score = bowling.score(self.frames)
     self.assertEquals(score, 23, "Spare frame should add next throw to total.")
Beispiel #18
0
def test_strike():
    result = 'XX 12 34 00 00 00 00 00 00 00 '
    expected = (10 + 1 + 2 + 3 + 4) + (1 + 2) + (3 + 4)
    assert score(result) == expected
Beispiel #19
0
 def test_perfect_game(self):
     for i in range(12):
         roll_ball(self.frame, 10)
     self.assertEqual(300, score(self.frame))
def test_score_11():
    assert 2 == score('11')
Beispiel #21
0
 def test_gutter_game(self):
     for i in range(20):
         roll_ball(self.frame, 0)
     self.assertEqual(0, score(self.frame))
def test_score_X12():
    assert 13+3 == score('X12')
Beispiel #23
0
 def test_score__adds_the_next_throw_twice_if_spare(self):
     self.frames[0] = (9, 1)
     self.frames[1] = (5, 3)
     score = bowling.score(self.frames)
     self.assertEquals(score, 23,
                       "Spare frame should add next throw to total.")
def test_score_0():
    assert 0 == score('')
Beispiel #25
0
 def test_score__adds_the_next_two_throws_if_strike(self):
     self.frames[0] = (10, 0)
     self.frames[1] = (5, 3)
     score = bowling.score(self.frames)
     self.assertEquals(score, 26,
                       "Strike frame should add next two throws to total.")
Beispiel #26
0
def test_score_roll_2_return_2():
  assert_equals(score([2]), 2)
Beispiel #27
0
 def test_score__correctly_scores_perfect_game_as_300(self):
     frames = [(10, 0)] * 10
     frames.append((10, 10))
     score = bowling.score(frames)
     self.assertEquals(score, 300, "Perfect game results in score of 300.")
def test_all_strikes():
    assert score('X X X X X X X X X X X X') == 300
Beispiel #29
0
 def test_score__returns_zero_for_all_gutter_balls(self):
     score = bowling.score(self.frames)
     self.assertEquals(score, 0,
                       "All gutter balls should result in a score of 0.")
def test_all_nine_misses():
    assert score('9- 9- 9- 9- 9- 9- 9- 9- 9- 9-') == 90
Beispiel #31
0
def test_more_than_one_point():
    assert score('04 00 00 00 00 00 00 00 00 00') == 4
    assert score('40 00 00 00 00 00 00 00 00 00') == 4
def test_most_misses():
    assert score('-- -- -- -- -/ 11 -- -- -- --') == 13
Beispiel #33
0
def test_all_zeros():
    assert score('00 00 00 00 00 00 00 00 00 00') == 0
Beispiel #34
0
def test_misses():
    result = '30 30 30 30 30 30 30 30 30 30 '
    assert score(result) == 30
Beispiel #35
0
def test_one_point():
    assert score('01 00 00 00 00 00 00 00 00 00') == 1
Beispiel #36
0
def test2_spare():
    result = '2/ 9/ 12 00 00 00 00 00 00 00 '
    expected = (10 + 9) + (10 + 1) + (1 + 2)
    assert score(result) == expected
Beispiel #37
0
def test_score_roll_spare_return_10():
  assert_equals(score([9, 1]), 10)
Beispiel #38
0
def test_no_strikes_no_spares():
    result = '34 34 34 34 34 34 34 34 34 34 '
    assert score(result) == 70
    result = '35 35 35 35 35 35 35 35 35 35 '
    assert score(result) == 80
Beispiel #39
0
def test_score_roll_spare_9_return_28():
  assert_equals(score([9, 1, 9]), 28)
 def test_first_throw(self):
     score_list = []
     pins = 3
     current_score = score(pins, score_list)
     self.assertEqual(current_score, 3)
Beispiel #41
0
def test_score_roll_2_spares_9_return_45():
  assert_equals(score([8, 2, 7, 3, 9]), 45)
def test_score_123456():
    assert 21 == score('123456')
Beispiel #43
0
def test_score_roll_strike_1_1_return_14():
  assert_equals(score([10, 1, 1]), 14)
def test_score_901():
    assert 10 == score('9-1')
Beispiel #45
0
def test_score_perfect_game():
  assert_equals(score([10] * 12), 300)
def test_score_XX1():
    assert 21+11+1 == score('XX1')
Beispiel #47
0
def test_score_roll_1_return_1():
  assert_equals(score([1]), 1)
def test_perfect_game():
    assert 270 == score('XXXXXXXXXX--')
Beispiel #49
0
def test_score_girl_game_return_133():
  assert_equals(score([1, 4, 4, 5, 6, 4, 5, 5, 10, 0, 1, 7, 3, 6, 4, 10, 2, 8, 6]), 133)
def test_score_12():
    assert 3 == score('12')
Beispiel #51
0
 def test_score__each_no_spare_or_strike_frame_adds_pin_total_to_score(self):
     self.frames[0] = (5, 3)
     score = bowling.score(self.frames)
     self.assertEquals(score, 8, "Five and three should result in a score of 8.")