コード例 #1
1
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_strike_return_10():
  assert_equals(score([10]), 10)
コード例 #2
0
ファイル: bowling_tests.py プロジェクト: kebarr/bowling2
 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))
コード例 #3
0
ファイル: bowling_tests.py プロジェクト: kebarr/bowling2
 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))
コード例 #4
0
def test_game_score_two_strikes():
    assert score('9- 9- 9- X X 54 9- 9- 9- 9-') == 116
コード例 #5
0
def test_all_misses():
    assert score('-- -- -- -- -- -- -- -- -- --') == 0
コード例 #6
0
def test_all_spares():
    assert score('5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5/ 5') == 150
コード例 #7
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_1_then_2_return_3():
  assert_equals(score([1, 2]), 3)
コード例 #8
0
 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.")
コード例 #9
0
def test_heart_break():
    assert 90 == score('9-9-9-9-9-9-9-9-9-9-')
コード例 #10
0
def test_score_28191():
    assert 23 == score('2/1/1')
コード例 #11
0
 def test_second_throw(self):
     score_list = [3]
     pins = 6
     current_score = score(pins, score_list)
     self.assertEqual(current_score, 9)
コード例 #12
0
ファイル: test_bowling.py プロジェクト: hjwp/bowling-kata
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
コード例 #13
0
ファイル: bowling_tests.py プロジェクト: kebarr/bowling2
 def test_all_ones(self):
     for i in range(20):
         roll_ball(self.frame, 1)
     self.assertEqual(20, score(self.frame))
コード例 #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.")
コード例 #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.")
コード例 #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.")
コード例 #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.")
コード例 #18
0
ファイル: test_bowling.py プロジェクト: hjwp/bowling-kata
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
コード例 #19
0
ファイル: bowling_tests.py プロジェクト: kebarr/bowling2
 def test_perfect_game(self):
     for i in range(12):
         roll_ball(self.frame, 10)
     self.assertEqual(300, score(self.frame))
コード例 #20
0
def test_score_11():
    assert 2 == score('11')
コード例 #21
0
ファイル: bowling_tests.py プロジェクト: kebarr/bowling2
 def test_gutter_game(self):
     for i in range(20):
         roll_ball(self.frame, 0)
     self.assertEqual(0, score(self.frame))
コード例 #22
0
def test_score_X12():
    assert 13+3 == score('X12')
コード例 #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.")
コード例 #24
0
def test_score_0():
    assert 0 == score('')
コード例 #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.")
コード例 #26
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_2_return_2():
  assert_equals(score([2]), 2)
コード例 #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.")
コード例 #28
0
def test_all_strikes():
    assert score('X X X X X X X X X X X X') == 300
コード例 #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.")
コード例 #30
0
def test_all_nine_misses():
    assert score('9- 9- 9- 9- 9- 9- 9- 9- 9- 9-') == 90
コード例 #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
コード例 #32
0
def test_most_misses():
    assert score('-- -- -- -- -/ 11 -- -- -- --') == 13
コード例 #33
0
def test_all_zeros():
    assert score('00 00 00 00 00 00 00 00 00 00') == 0
コード例 #34
0
ファイル: test_bowling.py プロジェクト: hjwp/bowling-kata
def test_misses():
    result = '30 30 30 30 30 30 30 30 30 30 '
    assert score(result) == 30
コード例 #35
0
def test_one_point():
    assert score('01 00 00 00 00 00 00 00 00 00') == 1
コード例 #36
0
ファイル: test_bowling.py プロジェクト: hjwp/bowling-kata
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
コード例 #37
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_spare_return_10():
  assert_equals(score([9, 1]), 10)
コード例 #38
0
ファイル: test_bowling.py プロジェクト: hjwp/bowling-kata
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
コード例 #39
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_spare_9_return_28():
  assert_equals(score([9, 1, 9]), 28)
コード例 #40
0
 def test_first_throw(self):
     score_list = []
     pins = 3
     current_score = score(pins, score_list)
     self.assertEqual(current_score, 3)
コード例 #41
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_2_spares_9_return_45():
  assert_equals(score([8, 2, 7, 3, 9]), 45)
コード例 #42
0
def test_score_123456():
    assert 21 == score('123456')
コード例 #43
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_strike_1_1_return_14():
  assert_equals(score([10, 1, 1]), 14)
コード例 #44
0
def test_score_901():
    assert 10 == score('9-1')
コード例 #45
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_perfect_game():
  assert_equals(score([10] * 12), 300)
コード例 #46
0
def test_score_XX1():
    assert 21+11+1 == score('XX1')
コード例 #47
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
def test_score_roll_1_return_1():
  assert_equals(score([1]), 1)
コード例 #48
0
def test_perfect_game():
    assert 270 == score('XXXXXXXXXX--')
コード例 #49
0
ファイル: test_bowling.py プロジェクト: alejandroclaro/katas
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)
コード例 #50
0
def test_score_12():
    assert 3 == score('12')
コード例 #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.")