Skip to content
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

card-tricks: Check if index is >= len(slice) #2763

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

CodeBleu
Copy link
Contributor

Adjusting so the test will now fail if the index value is greater than or equal to the size of the slice.

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 Feb 24, 2024
@andrerfcsantos
Copy link
Member

Hey @CodeBleu.

Sorry for the delay in reviewing this. Still interested in working on this?

In this case, I'd suggest to add a new test where the index is strictly bigger than len(slice). That way we have a test for when the index is equal to len(slice) and another one for when it is bigger.

@CodeBleu
Copy link
Contributor Author

@andrerfcsantos Does there really need to be 2 tests? Not sure what the benefit is, if an = or > value is used. There would not be any use case to just check for =, right? Both will fail. Maybe I'm missing something, but I don't see it any different than writing a test that checks for a specific number greater than either...hence just test for >

Copy link
Member

@andrerfcsantos andrerfcsantos left a comment

Choose a reason for hiding this comment

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

After doing some testing, I think I see your point now.

I suggested having two tests to try to be more exhaustive and intentional in the testing. The idea is to have the tests fail even if solutions were just doing > or == and only pass when they have >=. Your change does this, so it's all good.

The benefit of this change is that solutions that just check for == will now fail, where previously they would pass.

I'll merge, thanks for this! And again, sorry for taking so long.

@andrerfcsantos andrerfcsantos added the x:rep/small Small amount of reputation label Jul 25, 2024
@andrerfcsantos andrerfcsantos merged commit 166f24d into exercism:main Jul 25, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:rep/small Small amount of reputation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants