The code has the following check:
def test_consecutive_strikes_each_get_the_two_roll_bonus
game = Game.new
rolls = [10, 10, 10, 5, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
rolls.each { |pins| game.roll(pins) }
assert_equal 81, game.score
end
My understanding is that this array would have 18 entries after the game.roll
call? Therefore if each frame is two balls, this would mean you have bowled 9 frames, not a full game of 10 frames (assuming no extra balls).
This would violate the check for an incomplete game which uses this code:
def test_an_incomplete_game_cannot_be_scored
game = Game.new
rolls = [0, 0]
rolls.each { |pins| game.roll(pins) }
assert_raises Game::BowlingError do
game.score
end
end
Where the idea is that if you haven’t rolled 10 frames already, you should be throwing an error.
Am I missing something here? Seems like these checks might be off and cannot all be used at once which is making me confused here.