-
Notifications
You must be signed in to change notification settings - Fork 158
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
Common problematic values are often unlikely to be generated #82
Comments
I'd certainly welcome any contributions!
These all sound reasonable to me. Integers are defined in terms of ranges so instead of
Some of these already happen (zeroes, infinites, NaNs), though
Similar to integer range handling, all that needs to change is the starting value
This would actually happen automatically with the slice change since regex repititions are defined in terms of the collection strategies.
This should already be the case
This is harder, since strings are generated in terms of regexes. Just setting the starting point won't work since some way would be needed to represent that starting point in terms of all the machinery underneath. It might be possible to extend the string strategy to have a chance of picking a BLNS string, check whether it matches the regex, and start from there, and then shrink to whatever regex-based string it would have generated otherwise. |
I actually came here to report this exact issue. I could be wrong, but I was under the impression that Haskell's Quickcheck generates all "edge" cases for each type. Another thing to consider is permutations of those edge cases. e.g., when generating values of a type: Pair {
a: i32,
b: Option<f32>
} This now has requires "minimal" edge cases of:
multiplied by:
For 7 * 11 = 77 "edge" combinations. This can explode pretty fast! |
Even if code isn't expecting these values, it shouldn't panic or exhibit UB. Sometimes, you just forget that these values are possible. It would be much better to have these included by default but provide a convenient way to exclude them. That way, the first time a test fails due to a |
I was doing roundtrip tests for a binary parsing library testing and thought that proptest would check I had a hard time tracking down what proptest was doing for Thanks for the great library at any rate! It quickly found a copy-paste error I had in some of my low level parsing code, so it did its job well! 😍 |
In the Readme, the "Limitations of Property Testing" section details that the
any::<i64>()
strategy is unlikely to producei64::MIN
. This, and other i64 constants, are usually far more likely to cause problems than an arbitrary i64.I propose, at least for the built in Strategies, that they proactively generate common problematic values before generating arbitrary ones.
Some possibilities for the different types:
I'm happy to work on this. I'll just need a bit of direction in how to go about it.
The text was updated successfully, but these errors were encountered: