-
Notifications
You must be signed in to change notification settings - Fork 10
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
Switch to quickcheck 1.0 #9
Conversation
Looking at this from the stream's mention of #8, the failing test seems to be the fn with_cap(cap: usize) -> bool {
let vs: Vc<u8> = Vc::with_capacity(cap); // <-- attempts to allocate for arbitrary `usize`
println!("wish: {}, got: {} (diff: {})", cap, vs.capacity(), vs.capacity() as isize - cap as isize);
vs.capacity() >= cap
} It seems like before this PR, in quickcheck 9.2, the only fn with_cap(cap: usize) -> bool {
+ if cap > 256 {
+ panic!("{}", format!("about to test cap {cap}...")); // Rust pre-2021 edition feels odd :)
+ }
let vs: Vc<u8> = Vc::with_capacity(cap);
println!("wish: {}, got: {} (diff: {})", cap, vs.capacity(), vs.capacity() as isize - cap as isize);
vs.capacity() >= cap
} But now in quickcheck >=1.0, the sizes tested are more what we would expect for an arbitrary Echoing @ziutech's sentiment, I am not sure what range of input this specific |
The behaviour of quickcheck changed in a way, that the Edit: there is an unresolved issue asking for a way to specify the generated range: BurntSushi/quickcheck#267 |
Ah, that test is arguably a little silly, but I would do something like use a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now, thanks!
As far as I understand the only breaking change was published in this commit.
I found two significant differences:
Arbitrary::arbitrary
changedRngCore::next_u32
I changed every call to
RngCore::next_u32
tou32::arbitrary
. It was based purely on intuition, and seems to be wrong. The tests build, but don't pass — somewhere it tries to allocate more memory than max ofu32
. As I am writing this I'm not sure how to solve this. I would have to get more insight into howquickcheck
works and why the tests are implemented the way they are.