-
-
Notifications
You must be signed in to change notification settings - Fork 554
bracket-push: Add test case "partially paired brackets" #1219
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that such a described implementation (early return) passes all tests but not the new one.
Please designate that in the commit message. The PR description was good because it explains why the test case is added; the information should be in the commit message as well so that the information is visible without having to visit GitHub.
Commits should be squashed.
If nothing else, around 24 hours from now I will make both things happen.
* Bump version to v1.3.0 * Guard against solutions returning `true` once brackets are matched, which will pass all previous tests but the added one
1b91f69
to
4b84fed
Compare
@petertseng Done at your request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool. I could quibble a bit about "once brackets are matched" -> "once any one pair of brackets is matched" to really distinguish it from solutions that check all pairs of brackets as they should, but I haven't the time to write down all my thoughts, and it's good as-is anyway.
Guards against solutions immediately declaring the entire string matched as soon as they find any one matched pair. exercism/problem-specifications#1219
Guards against solutions immediately declaring the entire string matched as soon as they find any one matched pair. exercism/problem-specifications#1219
Guards against solutions immediately declaring the entire string matched as soon as they find any one matched pair. exercism/problem-specifications#1219
add test `partially paired brackets` per exercism/problem-specifications#1219
Some incorrect solutions return
true
as soon as brackets are matched. Check out this solution in Python which can pass all current tests:Clearly
return brackets_match(top_of_stack, char)
within thefor
loop is wrong, so it will fail test cases where brackets are partially paired, like{[])
.