Skip to content

Conversation

petertseng
Copy link
Member

We have tests for:

  • Rolling 11 in a single roll
  • Rolling 5 then 6
  • Rolling 5 then 6 after a last-frame strike

So it appears we are missing the test for rolling an 11 after a
last-frame strike. Let's add it.

We have tests for:

* Rolling 11 in a single roll
* Rolling 5 then 6
* Rolling 5 then 6 after a last-frame strike

So it appears we are missing the test for rolling an 11 after a
last-frame strike. Let's add it.
"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": "second bonus roll after a strike in the last frame can not score than 10 points",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsure about the necessity of this one. But maybe it's useful - some people may only check the first bonus roll?

"rolls": [5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
"expected": -1
}, {
"description": "bonus roll after a strike in the last frame can not score more than 10 points",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My first implementation only checked the second bonus roll and would therefore allow anything in the first, oops. Gotta catch that with this 11.

@Insti
Copy link
Contributor

Insti commented Nov 8, 2016

I think it's a good idea to add explicit test cases for any bugs that are seen 'in the wild'.

The only roll that is checked for 11 is the first one. (and now the last)
Should we also have tests that the second or third roll (etc..) cannot be 11?

@petertseng
Copy link
Member Author

It is true - if we wish to be truly thorough, we would test that each and every roll cannot be 11.

It might be a lot to put in the JSON file; I wish we had some way of compactly expressing what I have just put in words.

The current set gets us a decent amount of mileage since (it is anticipated) most students will write the code such that the first nine frames use the same logic, and the tenth frame has a bit of extra logic for the fill balls. I admit it's a bit interesting to see that indeed we are paying an awful lot of attention to the last frame, but it rightfully is a hotspot where a lot of the problems come up.

@Insti
Copy link
Contributor

Insti commented Nov 8, 2016

The current set gets us a decent amount of mileage since (it is anticipated) most students will write the code such that the first nine frames use the same logic, and the tenth frame has a bit of extra logic for the fill balls.

Yeah, I'm fine for leaving it as it is and adding individual tests whenever anyone implements a solution that doesn't get caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants