-
-
Notifications
You must be signed in to change notification settings - Fork 200
pangram: Add test case with repeated letters in both upper and lower cases #10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
I believe it's legitimate to have the upper case also count as lowercase characters. Maybe your implementation would merely need:
These tests were taken from the canonical test suite: https://github.com/exercism/x-common/blob/master/pangram.json so we would need to see if this should be pushed out to the rest of the languages. CC @kytrinyx |
Oh yes, my implementation was definitely faulty according to the problem statement even though it passed all the existing tests, and your fix is the difference between passing and failing the new test. Adding the new test to the default suite covers off the possibility that others may fall into a similar trap in which an implementation appears to be valid in the general case but isn't. |
Related: is there any way to know which language test suites were generated using the canonical suite, and which were written manually? Thanks! |
I believe the ruby track has their tests generated from files, I'm not sure about all of the others. It would be nice to build a test generator for the Kotlin track, but it does get a little tricky. |
OHHH, I misread the test! I thought you were just adding FOX to the end of the statement, but in fact you replaced |
On inspection I think that assertTrue(Pangrams.isPangram("the quick brown fox jumps over the lazy dog FOX")) would still pass with my original faulty implementation (I used inequality there as I was not sure how the German alphabet characters would be handled). The key is to disallow upper and lower case versions of the same character from being counted separately. I'm happy to rename to your suggestion ( |
I agree that if it's possible to submit an "obviously incorrect" solution, then our tests are not good enough, and that should be addressed in x-common (which I see that @sdavids13 is fixing already. Excellent). |
Started a second try with exercism/problem-specifications#439 (after @sdavids13 failed) to get this added. |
My initial solution to the pangram problem was as follows:
This passes all the existing tests, but fails the newly-added test because I did not explicitly ignore case before calling
.distinct
.