-
-
Notifications
You must be signed in to change notification settings - Fork 219
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
fix(anagram): allow arbitrary order of words in result #933
Conversation
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos.
For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
I like not having order in the returned data structure, to keep it simple and close to the intended exercise text. I would have used a set as well. I wondered if we should make it possible for the students to use any sensible std container? |
@IsaacG in the other PR says the same, so let's go with this PR and try to make it as good as possible.
Yes, I'm working on that now. It should be possible, but it will not make the test code more readable. I really wonder if that is worth it for an exercise as easy as anagram. Anyway, let's continue the discussion when I have something ready. |
Btw, since version 3.0.6 Catch2 has matchers integrated that would make this probably very easy. With the Catch2 files copied all over the repo, upgrading just for this matches is probably not reasonable. But another case showing that we should really push for improving that. |
The Test-Runner already has some fixes in place to run old catch versions, but the concept exercises run with the new catch version to support tags. We can thus use any catch version we please on a per-exercise base |
Can you give some pointers how this is implemented? The copies of |
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 think this makes it nice and easy for the students.
The only thing I would add is a small comment to explain the need for the class and that students can solve it with any container they like. Do you think that would help shipping the intent of the changes?
I coded something up now that supports any container that supports REQUIRE_THAT(matches, IsIdenticalTo({"gallery", "regally", "largely"})); However, with the old version of catch, which only supports old-style matches, that is not possible. The reason being that they use some sort of CRTP where you have to pass the type that |
Yes, for sure! I was also thinking about doing a forward declaration and putting the implementation at the bottom of the file. Do you think that would help reduce confusion or only add more? |
I now also added the comment. Let me know if this looks good to you and also what you think about having a forward declaration and moving the actual implementation of the class to the bottom of tile file. |
Forward declaration is a great idea! |
It doesn't work with a classic forward declaration, unfortunately. The only thing I could do is the standard declaration/definition split, but then we'd still have a lot of code at the top. I'd rather keep it as is. What do you think? |
I pushed some more minor improvements:
@vaeng If you think this is good now, I would squash and merge. You have approved already, but quite a lot has changed since then, so that I'd appreciate it if you could have another look. Thanks! |
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.
All good changes, which should help students to pass this exercise and read the instructions in a clear way. Thanks for the effort.
9d852c1
to
3e099c8
Compare
Here's my proposal on how we could accept any order of words for the anagram exercise.