Skip to content

[Bowling] Add edge case with fill balls in a last-frame strike #418

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 22, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions exercises/bowling/canonical-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
],
"score": {
"description": [
"Returns the final score of a bowling game"
"returns the final score of a bowling game"
],
"cases": [{
"description": "should be able to score a game with all zeros",
Expand Down Expand Up @@ -74,31 +74,39 @@
"rolls": [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
"expected": 300
}, {
"description": "Rolls can not score negative points",
"description": "rolls can not score negative points",
"rolls": [-1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"expected": -1
}, {
"description": "A roll can not score more than 10 points",
"description": "a roll can not score more than 10 points",
"rolls": [11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"expected": -1
}, {
"description": "Two rolls in a frame can not score more than 10 points",
"description": "two rolls in a frame can not score more than 10 points",
"rolls": [5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"expected": -1
}, {
"description": "Two bonus rolls after a strike in the last frame can not score more than 10 points",
"description": "two bonus rolls after a strike in the last frame can not score more than 10 points",
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 5, 6],
"expected": -1
}, {
"description": "An unstarted game can not be scored",
"description": "two bonus rolls after a strike in the last frame can score more than 10 points if one is a strike",
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 10, 6],
"expected": 26
}, {
"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",
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 6, 10],
"expected": -1
}, {
"description": "an unstarted game can not be scored",
"rolls": [],
"expected": -1
}, {
"description": "An incomplete game can not be scored",
"description": "an incomplete game can not be scored",
"rolls": [0, 0],
"expected": -1
}, {
"description": "A game with more than ten frames can not be scored",
"description": "a game with more than ten frames can not be scored",
"rolls": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"expected": -1
}, {
Expand Down