Skip to content

Add a quickcheck property to better test the positive case #448

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

Merged
merged 1 commit into from
Mar 8, 2018

Conversation

ethanpailes
Copy link
Contributor

I've marked this as a WIP because I want to wait until #447 get merged and then rebase on top.

I've rolled back the fix from #447 locally and am running this new test in a loop to see if it will catch the bug. Unfortunatly, it does not fall out immediately.

If you just generate two random strings, the odds are very high
that the shorter one won't be a substring of the longer one once
they reach any substantial length. This means that the existing
quickcheck cases were probably just testing the negative cases.
The exception would be the two cases that append the needle
to the haystack, but those only test behavior at the ends. This
patch adds a better quickcheck case that can test a needle anywhere
in the haystack.

See the comments on #446

@ethanpailes
Copy link
Contributor Author

Good news! After letting it run for a few minutes this test did in fact dig up the bug! I'm going to use it to look for more.

@BurntSushi
Copy link
Member

@ethanpailes Can you rebase this on master? Also, your last comment mentions another bug---any head way on that?

@ethanpailes
Copy link
Contributor Author

Oh no, it was the same bug. I wrote this prop test with the goal of catching bugs like the one from #446, and it I was just noting that it did in fact catch the bug.

I'll rebase on master shortly.

If you just generate two random strings, the odds are very high
that the shorter one won't be a substring of the longer one once
they reach any substantial length. This means that the existing
quickcheck cases were probably just testing the negative cases.
The exception would be the two cases that append the needle
to the haystack, but those only test behavior at the ends. This
patch adds a better quickcheck case that can test a needle anywhere
in the haystack.

See the comments on rust-lang#446
@ethanpailes ethanpailes force-pushed the bm-qc-positive-case branch from cd09782 to 24ffdb4 Compare March 7, 2018 21:57
@ethanpailes ethanpailes changed the title [WIP] Add a quickcheck property to better test the positive case Add a quickcheck property to better test the positive case Mar 7, 2018
@BurntSushi BurntSushi merged commit c075e18 into rust-lang:master Mar 8, 2018
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.

None yet

2 participants