Skip to content

Commit 7b0949e

Browse files
authored
[Bowling] Add edge case with fill balls in a last-frame strike (#418) (#423)
* Add edge case with fill balls in a last-frame strike The previous test does not quite capture the behavior. If the first fill fill is a non-strikes, then the total fill-ball score must be less than 10. But, if the first fill ball is a strike, then the total fill-ball score must be less than 20. Because that first fill-ball strike resets the pins. I had what I thought was a working implementation but it totally missed the 2nd case. Adding a test to cover that case. * Add edge case test for final-strike fill balls This test checks that the fill balls validate correctly if the 2nd ball is a strike.
1 parent ea3d631 commit 7b0949e

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

exercises/bowling/canonical-data.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"score": {
1717
"description": [
18-
"Returns the final score of a bowling game"
18+
"returns the final score of a bowling game"
1919
],
2020
"cases": [{
2121
"description": "should be able to score a game with all zeros",
@@ -89,6 +89,14 @@
8989
"description": "two bonus rolls after a strike in the last frame can not score more than 10 points",
9090
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 6],
9191
"expected": -1
92+
}, {
93+
"description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike",
94+
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6],
95+
"expected": 26
96+
}, {
97+
"description": "the second bonus rolls after a strike in the last frame can not be a strike if the first one is not a strike",
98+
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10],
99+
"expected": -1
92100
}, {
93101
"description": "an unstarted game can not be scored",
94102
"rolls": [],

0 commit comments

Comments
 (0)