-
-
Notifications
You must be signed in to change notification settings - Fork 554
isbn-verifier: Test Suite Omits Important Edge Case #1052
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
Comments
This seems related to #902, which is dealing with including or excluding cases that test for invalid input. The recent trend has been to steer clear of test cases that check for invalid input unless the test has relevance to the problem. The assumption being that, in real life, some algorithm would likely pre-screen the input before passing it on to the algorithm, ISBN Verifier in this instance. I personally have no issue with adding another test case that looks for an empty ISBN code to be verified. |
It’s somewhat related, and somewhat different. In the ISBN Verifier, we’re actually doing validation. There are already a few invalid ISBNs in the test suite because of this. And, “” is not a valid ISBN, but it isn’t tested for.
Pertaining to #902, I’ll just say I think reasonable edge cases should always be tested for unless the problem statement explicitly says something like “Assume all inputs have been validated by another process.”
|
I have a somewhat different understanding from #902: as I see it, all exercises should be able to implicitly assume that inputs have been pre-screened for validity. However, I'd agree that in this case we're actually performing validation, and a zero-length string is a reasonable case to test here. |
Appears to me that there are two changes that need to be made.
|
Yes, but those two should be in separate PRs; they're distinct. |
I agree |
@p0st0culus where should this new case appear in the test data? I am working on a PR to get #996 out of the way. |
Reported by @p0st0culus in exercism/exercism#3702
Confirmed missing from canonical data.
The test suite for the ISBN Verifier problem in the Swift track should test for an empty string ISBN. This is a an important edge case that @damlar noted was missing from my solutions which is also omitted from the test suite.
It's something that, in hindsight, I should have known to test for, but I didn't. That's the whole point of a well thought out test suite though: Code against assertions of what a valid solution should produce. I tend to implicitly put trust in the test suites, so that's my lesson learned. I'll take an active role in the test suites going forward.
I recommend modifying IsbnVerifierTests.swift as follows. Other content from the test suite omitted with ellipses for clarity:
Thanks.
The text was updated successfully, but these errors were encountered: