Exemple #1
0
 def testOneTenSpareGame(self):
     weakGame = Bowler()
     weakGame.rolls(1)
     try:
         weakGame.rolls(10)
     except AssertionError:
         pass
Exemple #2
0
 def testZeroElevenSpareGame(self):
     weakGame = Bowler()
     weakGame.rolls(0)
     try:
         weakGame.rolls(11)
     except AssertionError:
         pass
Exemple #3
0
 def testTooManyWeakGame(self):
     weakGame = Bowler()
     for i in [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]:
         weakGame.rolls(i)
     try:
         weakGame.rolls(1)
     except AssertionError:
         pass
Exemple #4
0
 def testTooManySpares(self):
     weakGameOfSpares = Bowler() 
     for i in [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1]:
         weakGameOfSpares.rolls(i)
     try:
         weakGameOfSpares.rolls(1)
     except AssertionError:
         pass
Exemple #5
0
 def testTooManyPefectGame(self):
     perfectGame = Bowler()
     for i in [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]:
         perfectGame.rolls(i)
     try:
         perfectGame.rolls(10)
     except AssertionError:
         pass
Exemple #6
0
 def testWeakGame(self):
     weakGame = Bowler()
     for i in [1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3]:
         weakGame.rolls(i)
     weakGameScore = weakGame.currentScore()
     if weakGameScore == 40:
         pass
     else:
         raise AssertionError("the weakGame game should be 40 but was "+str(weakGameScore))
Exemple #7
0
 def testStrongGameOfSpares(self):
     strongGameOfSpares = Bowler()
     for i in [9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1,9]:
         strongGameOfSpares.rolls(i)
     strongGameOfSparesScore = strongGameOfSpares.currentScore()
     if strongGameOfSparesScore == 190:
         pass
     else:
         raise AssertionError("the strongGameOfSpares game should be 190 but was " + str(strongGameOfSparesScore))
Exemple #8
0
 def testWeakGameOfSpares(self):
     weakGameOfSpares = Bowler()
     for i in [1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1, 9, 1]:
         weakGameOfSpares.rolls(i)
     weakGameOfSparesScore = weakGameOfSpares.currentScore()
     if weakGameOfSparesScore == 110:
         pass
     else:
         raise AssertionError("the weakGameOfSpares game should be 110 but was "+str(weakGameOfSparesScore))
Exemple #9
0
 def testPefectGame(self):
     perfectGame = Bowler()
     for i in [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]:
         perfectGame.rolls(i)
     perfectGameScore = perfectGame.currentScore()
     if perfectGameScore == 300:
         pass
     else:
         raise AssertionError("the perfect game should be 300 but was "+str(perfectGameScore))
Exemple #10
0
 def testCompleteStrikeGame(self):
     completeStrikeGame = Bowler()
     for i in [10, 2, 2]:
         completeStrikeGame.rolls(i)
     completeStrikeGameScore = completeStrikeGame.currentScore()
     if completeStrikeGameScore == 18:
         pass
     else:
         raise AssertionError("the perfect game should be 18 but was "+str(completeStrikeGameScore))
Exemple #11
0
 def testIncompleteStrikeGame(self):
     incompleteStrikeGame = Bowler()
     for i in [10, 2]:
         incompleteStrikeGame.rolls(i)
     incompleteStrikeGameScore = incompleteStrikeGame.currentScore()
     if incompleteStrikeGameScore == 0:
         pass
     else:
         raise AssertionError("the perfect game should be 0 but was "+str(incompleteStrikeGameScore))
Exemple #12
0
 def testZeroTenSpareGame(self):
     weakGame = Bowler()
     weakGame.rolls(0)
     weakGame.rolls(10)
     weakGame.rolls(3)
     weakGameScore = weakGame.currentScore()
     if weakGameScore == 13:
         pass