예제 #1
0
import sys

from bowling.game import BowlingGame

if __name__ == '__main__':
    throwing = []
    if len(sys.argv) > 1:
        throwing = [int(arg) for arg in sys.argv[1:]]
    print(BowlingGame.computeScore(throwing))
예제 #2
0
 def test_compute_score(self):
     """
     Tests if the score is computed correctly without frames on a typical game
     """
     pins = [2, 3, 6, 4, 8, 1, 10, 3, 0, 10, 10, 10, 10, 1, 9, 5]
     self.assertEqual(BowlingGame.computeScore(pins), 164)
예제 #3
0
 def test_score_empty_game(self):
     """
     Tests if the score of an empty game is 0
     """
     self.assertEqual(BowlingGame.computeScoreOnFrames([]), 0)
     self.assertEqual(BowlingGame.computeScore([]), 0)
예제 #4
0
 def test_compute_max_score(self):
     """
     Tests if the maximum score is computed correctly without frames
     """
     pins = [10 for _ in range(12)]
     self.assertEqual(BowlingGame.computeScore(pins), 300)