def test_spare(self): digit = str(random.randint(1, 9)) bowl_engine = BowlingNew(digit + '/') score = bowl_engine.get_score() self.assertEqual(score, 10)
def test_spare_and_strike(self): bowl_engine = BowlingNew('4/X') score = bowl_engine.get_score() self.assertEqual(score, 30)
def test_strike_and_regular(self): bowl_engine = BowlingNew('X34') score = bowl_engine.get_score() self.assertEqual(score, 24)
def test_three_strikes(self): bowl_engine = BowlingNew('XXX') score = bowl_engine.get_score() self.assertEqual(score, 60)
def test_split(self): bowl_engine = BowlingNew('X4/34-4') result = bowl_engine.split_score() self.assertEqual(result, ['X', '4/', '34', '-4'])
def test_strike(self): bowl_engine = BowlingNew('X') score = bowl_engine.get_score() self.assertEqual(score, 10)
def test_length(self): with self.assertRaises(ValueError): bowl_engine = BowlingNew('X234') bowl_engine.get_score()
def test_returns_score(self): bowl_engine = BowlingNew('XX4/34-4X') score = bowl_engine.get_score() self.assertEqual(score, 78)
def test_two_miss(self): bowl_engine = BowlingNew('--') score = bowl_engine.get_score() self.assertEqual(score, 0)
def test_one_miss(self): bowl_engine = BowlingNew('-4') score = bowl_engine.get_score() self.assertEqual(score, 4)
def test_two_hits(self): bowl_engine = BowlingNew('34') score = bowl_engine.get_score() self.assertEqual(score, 7)
def test_spare_and_regular(self): bowl_engine = BowlingNew('4/34') score = bowl_engine.get_score() self.assertEqual(score, 20)
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