Beispiel #1
0
 def test_spare(self):
     digit = str(random.randint(1, 9))
     bowl_engine = BowlingNew(digit + '/')
     score = bowl_engine.get_score()
     self.assertEqual(score, 10)
Beispiel #2
0
 def test_spare_and_strike(self):
     bowl_engine = BowlingNew('4/X')
     score = bowl_engine.get_score()
     self.assertEqual(score, 30)
Beispiel #3
0
 def test_strike_and_regular(self):
     bowl_engine = BowlingNew('X34')
     score = bowl_engine.get_score()
     self.assertEqual(score, 24)
Beispiel #4
0
 def test_three_strikes(self):
     bowl_engine = BowlingNew('XXX')
     score = bowl_engine.get_score()
     self.assertEqual(score, 60)
Beispiel #5
0
 def test_split(self):
     bowl_engine = BowlingNew('X4/34-4')
     result = bowl_engine.split_score()
     self.assertEqual(result, ['X', '4/', '34', '-4'])
Beispiel #6
0
 def test_strike(self):
     bowl_engine = BowlingNew('X')
     score = bowl_engine.get_score()
     self.assertEqual(score, 10)
Beispiel #7
0
 def test_length(self):
     with self.assertRaises(ValueError):
         bowl_engine = BowlingNew('X234')
         bowl_engine.get_score()
Beispiel #8
0
 def test_returns_score(self):
     bowl_engine = BowlingNew('XX4/34-4X')
     score = bowl_engine.get_score()
     self.assertEqual(score, 78)
Beispiel #9
0
 def test_two_miss(self):
     bowl_engine = BowlingNew('--')
     score = bowl_engine.get_score()
     self.assertEqual(score, 0)
Beispiel #10
0
 def test_one_miss(self):
     bowl_engine = BowlingNew('-4')
     score = bowl_engine.get_score()
     self.assertEqual(score, 4)
Beispiel #11
0
 def test_two_hits(self):
     bowl_engine = BowlingNew('34')
     score = bowl_engine.get_score()
     self.assertEqual(score, 7)
Beispiel #12
0
 def test_spare_and_regular(self):
     bowl_engine = BowlingNew('4/34')
     score = bowl_engine.get_score()
     self.assertEqual(score, 20)
Beispiel #13
0
 def parse_line(self, line):
     name, game_result = line.split()
     self.game_count[name] += 1
     bowl_engine = BowlingNew(game_result)
     score = bowl_engine.get_score()
     return name, score