Exemplo n.º 1
0
 def test_score_strike(self):
     """
     Tests that the score of a frame is updated correctly after a single strike
     """
     frame1 = BowlingFrame("test")
     frame2 = BowlingFrame("test")
     frame1.registerThrowing(10)
     self.assertTrue(frame1.getScore() is None)
     frame2.registerThrowing(2)
     self.assertTrue(frame1.getScore() is None)
     frame2.registerThrowing(5)
     frame1.computeScore(frame2)
     self.assertEqual(frame1.getScore(), 17)
Exemplo n.º 2
0
 def test_score_strike3(self):
     """
     Tests that the score of a frame is updated correctly after three strikes in a row
     """
     frame1 = BowlingFrame("test")
     frame2 = BowlingFrame("test")
     frame3 = BowlingFrame("test")
     frame1.registerThrowing(10)
     self.assertTrue(frame1.getScore() is None)
     frame2.registerThrowing(10)
     self.assertTrue(frame1.getScore() is None)
     frame3.registerThrowing(10)
     frame1.computeScore(frame2, frame3)
     self.assertEqual(frame1.getScore(), 30)
Exemplo n.º 3
0
 def test_score_spare2(self):
     """
     Tests that the score of a frame is updated correctly after the spare and the strike of the next frame are
     finished
     """
     frame1 = BowlingFrame("test")
     frame2 = BowlingFrame("test")
     frame1.registerThrowing(9)
     frame1.registerThrowing(1)
     self.assertTrue(frame1.getScore() is None)
     frame2.registerThrowing(10)
     frame1.computeScore(frame2)
     self.assertEqual(frame1.getScore(), 20)
     self.assertTrue(frame2.getScore() is None)