-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbowlingGame.py
More file actions
35 lines (29 loc) · 806 Bytes
/
bowlingGame.py
File metadata and controls
35 lines (29 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import unittest
class BowlingGame():
def __init__(self):
self.totalScore = 0
def roll(self, pins):
self.totalScore += pins
def score(self):
return self.totalScore
class BowlingGameTest(unittest.TestCase):
def test_GutterGame(self):
game = BowlingGame()
for i in range(20):
game.roll(0)
self.assertEqual(0, game.score())
def test_RollAllOnes(self):
game = BowlingGame()
for i in range(20):
game.roll(1)
self.assertEqual(20, game.score())
def test_RollSpare(self):
game = BowlingGame()
game.roll(2)
game.roll(8)
game.roll(5)
self.asserEqual(15)
def test_RollStrike(self):
None
def test_PerfectGame(self):
None