def test_strike_brief(self): """test another configuration that would grant a strike, as shown in the brief """ game=BowlingGame() game.throw(10) game.throw(3) game.throw(6) self.throw_many(game, 17, 0) game.calculate_score() self.assertEqual(game.score, 28)
def test_for_strike(self): """Run a unit test where a strike is awarded (bonus points are awarded following all 10 pins being hit) """ game=BowlingGame() game.throw(10) game.throw(4) game.throw(2) self.throw_many(game, 17,0) game.calculate_score() self.assertEqual(game.score, 22)
def test_successive_strikes(self): """test for successive strikes calculating, as shown in the brief """ game=BowlingGame() game.throw(10) game.throw(10) game.throw(4) game.throw(2) self.throw_many(game, 16, 0) game.calculate_score() self.assertEqual(game.score, 46)
def test_different_throws (self): """Run a unit test where a variety of pins are hit """ game = BowlingGame() game.throw(6) game.throw(0) game.throw(7) game.throw(0) game.throw(2) for _ in range(15): game.throw(0) game.calculate_score() self.assertEqual(game.score, 15)
def test_for_spare(self): """Run a unit test where a spare is awarded (bonus points awarded after all 10 pins hit within two throws) """ game = BowlingGame() game.throw(4) game.throw(6) game.throw(7) game.throw(0) for _ in range(16): game.throw(0) game.calculate_score() self.assertEqual(game.score, 24)
def test_sample_game(self): """testing an example game, with a mix of open frames, spares and strikes """ game=BowlingGame() game.throw(10) game.throw(7) game.throw(3) game.throw(7) game.throw(2) game.throw(9) game.throw(1) game.throw(10) game.throw(10) game.throw(10) game.throw(2) game.throw(3) game.throw(6) game.throw(4) game.throw(7) game.throw(3) game.throw(3) game.calculate_score() self.assertEqual(game.score, 168)