-
Notifications
You must be signed in to change notification settings - Fork 524
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
Incomplete test coverage for scrabble-score #264
Comments
Aside: I found it is quite amazing that Thanks for the proposals and motivations for them! I agree with both of them, conditional on the Rust track's desire to continue using non-ASCII characters in our scrabble-score tests. Note that in using non-ASCII characters, our track is in contravention of the Exercism-wide exercism/problem-specifications#428. Note that in #125 this track made an explicit decision to add the non-ASCII character because otherwise the implementation could in an extreme case be a one-liner. That decision was made before the Exercism-wide decision of exercism/problem-specifications#428. So I would like to ask now, do we at this track stand by our earlier decision, or shall it be re-evaluted in light of exercism/problem-specifications#428? If we stand by our decision, I recommend applying both proposals in this issue. If nobody comes forth to either support or oppose the decision to use non-ASCII characters, then in that case I also recommend to apply both proposals, since they definitely improve the state of the current tests. |
This is a well thought out proposal and definitely improves the current state of the exercise. I'm in favor of keeping non-ASCII characters in our tests. |
I support non-ASCII tests. |
First. Sorry for my looong issue and now also comment.
I didn't know about exercism/problem-specifications#428. My personal viewpoint: Yes, since:
Some points against keeping the proposed tests (and indeed the original
|
I wanted to work on this issue, read all the links and came to this decision: 1.ProposalAccording to Issue 428 it would be reasonable to only write non-Ascii tests when it makes sense in a real world example. 2.ProposalAdding a information in the console output what the purpose of the failing test is is a great thing which i think some should do in all future implementations. |
And there is precedent for this in exercism/problem-specifications#284 as well
I have some hope that sometimes this can be expressed via the function name, but if that is not possible it is surely good to add it as the assert message. |
I'd like to resolve this issue. I believe that both tests proposed could usefully be added to the exercise's suite, and discussion seems to have ceased with a general consensus in favor of both additions. @dexterlemmer would you like to create a PR adding both test cases? If so, do you need any help getting started? |
Resolves exercism#264. Implements both of @dexterlemmer's proposals.
Resolves exercism#264. Implements both of @dexterlemmer's proposals.
* Update tests for scrabble-score Resolves #264. Implements both of @dexterlemmer's proposals. * remove extra period from test's detailed explanation
Sorry if I make any mistakes here. This is my first issue on exercism, and one of my first on GitHub. Furthermore, I'm actually rather new to TDD.
Proposals:
Proposal 1:
Add the following test to scrabble-score:
Proposal 2:
Additionally, modify the
non_english_scrabble_letters_do_not_score
test to something like:Motivation:
Motivation for Proposal 1:
The exercise
scrabble-score
contains a test for ensuring only "English" letters is used, namelynon_english_scrabble_letters_do_not_score
. I assume that means all non-English letters shouldn't score. For example, the "word""ß"
should score 0!Here's the problem: I originally thought the obvious solution is:
It doesn't compile due to
to_uppercase()
having an output-type ofToUppercase
rather thanchar
. So I resolved the compilation error by changing my code to:The above code correctly passes
non_english_scrabble_letters_do_not_score
, but also correctly fails the following test:I don't know if anybody else would go this route. However since in Rust's
char.to_uppercase
returns aToUppercase
, which can be obviously checked one codepoint at a time. And since thescrabble-score
exercise, contains the testscoring_is_case_insensitive
, I at least think that such an approach might occur more often. Even if it doesn't. Including a test that tests for something like this might encourage other students to think about some more "out of the box" problems during coding and/or testing.My proposal is therefore to add a test that would fail if any character that
char.to_uppercase
converts to two or more English letters gets a score greater than 0.Motivation for Proposal 2:
assert!
.Example:
For some reason I can't seem to attach files. See iteration >=3 of http://exercism.io/submissions/b0f318070ab34df2aa3a03b0ecfcc0bb for a complete example.
Updates:
Several updates due to problems related to my being incapable attaching a file.
The text was updated successfully, but these errors were encountered: