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

Test the various heuristics of erase_indices #347

Merged
merged 1 commit into from
Sep 13, 2024

Conversation

cuviper
Copy link
Member

@cuviper cuviper commented Sep 13, 2024

This is a targeted test to make sure we cover all the heuristic edge
cases in erase_indices, used by drain and other methods.

I found a failure from cargo mutants where we still passed tests after
erase_indices_sweep was replaced with an empty body. I was concerned
because that function contains unsafe code, so we really need it
tested. It turns out that we do sometimes hit that in quickcheck
tests, but might miss that if we're randomly unlucky, so this PR adds a
new test that will hit all the edge cases every time.

This is a targeted test to make sure we cover all the heuristic edge
cases in `erase_indices`, used by `drain` and other methods.

I found a failure from `cargo mutants` where we still passed tests after
`erase_indices_sweep` was replaced with an empty body. I was concerned
because that function contains `unsafe` code, so we *really* need it
tested. It turns out that we do *sometimes* hit that in `quickcheck`
tests, but might miss that if we're randomly unlucky, so this PR adds a
new test that will hit all the edge cases every time.
@cuviper cuviper added this pull request to the merge queue Sep 13, 2024
Merged via the queue into indexmap-rs:master with commit 6328647 Sep 13, 2024
16 checks passed
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.

1 participant