Skip to content

Update reverse-string missing test cases #917

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Elahi-cs
Copy link
Contributor

As mentioned by @BNAndras in #775 , some of reverse-string's test cases were created after opening the issue. This PR adds the missing test cases.

Copy link
Contributor

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

@github-actions github-actions bot closed this Oct 11, 2024
Copy link
Contributor

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.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

@Elahi-cs Elahi-cs mentioned this pull request Oct 11, 2024
21 tasks
@vaeng vaeng reopened this Oct 11, 2024
@vaeng
Copy link
Contributor

vaeng commented Oct 11, 2024

I'm pretty sure there is a discussion about this exercise with @siebenschlaefer somewhere.
I think the final consent was to not include the grapheme-based tests, as they are painful to implement in c++14 (and probably still are for c++23).

Maybe it was on the forums?

@BNAndras
Copy link
Member

Julia hides the grapheme tests behind a flag the student needs to set so that might be an option here. That'd require the example solution to be reworked.

@vaeng
Copy link
Contributor

vaeng commented Oct 16, 2024

Julia hides the grapheme tests behind a flag the student needs to set so that might be an option here. That'd require the example solution to be reworked.

Great idea. I like that. We could hide it with compiler flag option and describe the how-to in .docs/introduction.append.md. Marked as an additional challenge, it would not even interfere with the test runner.

@Elahi-cs
Copy link
Contributor Author

Elahi-cs commented Nov 4, 2024

@vaeng should I try to make these changes to the test cases to hide them behind a compiler flag in this same pull request? Could you elaborate as to how that wouldn't interfere with the test runner?

@vaeng
Copy link
Contributor

vaeng commented Nov 4, 2024

Do you understand how the EXERCISM_RUN_ALL_TESTS flag is used?

We could have a similar flag, like ADVANCED_STRING_TESTS and describe the usage and reasoning in an .append.md for expert students.

You do have to use this PR for both, as the CI checks will not run otherwise and they make a logical group for a PR.

(Also you need some code formatting to pass the other check).

Do you need help for these?

@Elahi-cs
Copy link
Contributor Author

Elahi-cs commented Nov 6, 2024

Do you understand how the EXERCISM_RUN_ALL_TESTS flag is used?

We could have a similar flag, like ADVANCED_STRING_TESTS and describe the usage and reasoning in an .append.md for expert students.

I do! I just have a question: Would EXERCISM_RUN_ALL_TESTS include all tests in this case? Or would both EXERCISM_RUN_ALL_TESTS and ADVANCED_STRING_TESTS need to be used to run both the tests and the grapheme cluster tests?

You do have to use this PR for both, as the CI checks will not run otherwise and they make a logical group for a PR.

(Also you need some code formatting to pass the other check).

Do you need help for these?

That makes sense! I'll get on that then. I'll let you know if I have any further questions, thank you for your guidance.

@vaeng
Copy link
Contributor

vaeng commented Nov 7, 2024

Would EXERCISM_RUN_ALL_TESTS include all tests in this case? Or would both EXERCISM_RUN_ALL_TESTS and ADVANCED_STRING_TESTS need to be used to run both the tests and the grapheme cluster tests?

If you want to be clean, you can edit the example files in the .meta directory, to be able to solve the added cases. In that case you would also need to edit the CMakeLists.txt to set the new ADVANCED_STRING_TESTS flag - here:

target_compile_definitions(${exercise} PRIVATE EXERCISM_RUN_ALL_TESTS)

With the edited CMakeLists.txt the test-runner will see your added code. If you don't set the flag, it won't notice the difference.

Moving the advanced tests outside the EXERCISM_RUN_ALL_TESTS group does not really make a difference. To have it a bit cleaner, I would have them below in an extra grouping, anyway.

@vaeng
Copy link
Contributor

vaeng commented Jan 23, 2025

Are you still working on this, or do you want me to finish your work @Elahi-cs

@Elahi-cs
Copy link
Contributor Author

Are you still working on this, or do you want me to finish your work @Elahi-cs

I'm really sorry for the very late reply @vaeng, I will not have time for it anymore.

@vaeng
Copy link
Contributor

vaeng commented May 13, 2025

@ahans @siebenschlaefer

Do you think the append will suffice?

## Grapheme Clusters

Unicode supports a lot of characters and languages.
The displayed 'graphemes' are constructed from code points.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither graphemes nor code points are introduced before this sentence. An external link here might be useful as background info.


## Grapheme Clusters

Unicode supports a lot of characters and languages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unicode is not introduced before this sentence. I'd similarly recommend an external link and perhaps a framing sentence about how Unicode is relevant before diving into the technical details.

Now consider more [complex constructions][grapheme-construction] like the Bengali word `ঝিল্লি`, which consists of six code points.

As graphemes make the string reversal process a lot more complicated, we made the respective test cases optional.
You can try them out by setting the `TEST_GRAPHEMES` compiler flag or editing the test file accordingly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
You can try them out by setting the `TEST_GRAPHEMES` compiler flag or editing the test file accordingly.
You can try them out by setting the `TEST_GRAPHEMES` preprocessor define or editing the test file accordingly.

As graphemes make the string reversal process a lot more complicated, we made the respective test cases optional.
You can try them out by setting the `TEST_GRAPHEMES` compiler flag or editing the test file accordingly.

[grapheme-construction]: https://r12a.github.io/uniview/?charlist=%E0%A6%9D%E0%A6%BF%E0%A6%B2%E0%A7%8D%E0%A6%B2%E0%A6%BF
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this sounds reasonable, but @BNAndras's points are valid. Having a few more external references probably wouldn't hurt.

However, what I'm missing most here is something about how to approach this in C++. Simply using something like std::u16string won't work, since in the test cases we clearly use UTF-8. Are students expected to implement some UTF-8 handling themselves? Can they use some library?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants