Comments (17)
Also reproduces with i32::MIN
but not with e.g. i32::MIN + 1
.
Reproducer:
use quickcheck::Arbitrary;
i32::MIN.shrink().for_each(|v| println!("{}", v));
Looking at the SignedShrinker
, it's quite obvious that the shrinker is quaranteed to yield a result if it was initialized from i32::MIN
:
Line 827 in defde6f
Which results in the endless iteration.
I'm honestly surprised this didn't surface any earlier.
from quickcheck.
Can you verify that #296 solves your problem?
from quickcheck.
@neithernut Seems like it has, both #285 and this bug seem to be fixed by the changes. I can't reproduce it exactly with the cases, since running 50 or so repeats never had had those specific bit patterns occur, however, all the failing cases in the shrinker before had a bit pattern of 0b1100111XXXXXXXXXXXXXXXXXXXXXXXXX
, so I created the following test:
#[cfg(test)]
mod tests {
use quickcheck::quickcheck;
quickcheck! {
fn case_failure(a: f32) -> bool {
let mask = 0b11001110000000000000000000000000;
a.to_bits() & mask != mask
}
}
}
The minimum failing case, as expected was 0b11001110000000000000000000000000
, or -536870900.0
, which is fixed in your branch, but overflows the stack in the master branch. This now seems to be a further extension of #285.
0b11001000000000000000000000000000
does not cause a stack overflow on either, while 0b11001100000000000000000000000000
does produce a stack overflow for the master branch, so I believe this is a useful metric that the issue is fixed.
from quickcheck.
Can you verify that #296 solves your problem?
Yep, it does. Wonderful, thank you.
from quickcheck.
Weirdly, I'm getting another issue with a stack overflow for cases failing with the bit pattern 0b11001110111111111111111111110000
or 0b11001111000000000000000000000000
for a signed 32-bit integer type. Both these cases fail, and I'm unsure specifically which one causes the indefinite repetition.
It then attempts to shrink as follows (I believe, this is just the data passed to my test function being printed out as bits):
0b11001110111111111111111111111000
0b11001110111111111111111111111100
0b11001110111111111111111111111110
0b11001110111111111111111111111111
0b11001111000000000000000000000000
0b10000000000000000000000000000000
0b11001110100000000000000000000000
0b11001110110000000000000000000000
0b11001110111000000000000000000000
0b11001110111100000000000000000000
0b11001110111110000000000000000000
0b11001110111111000000000000000000
0b11001110111111100000000000000000
0b11001110111111110000000000000000
0b11001110111111111000000000000000
0b11001110111111111100000000000000
0b11001110111111111110000000000000
0b11001110111111111111000000000000
0b11001110111111111111100000000000
0b11001110111111111111110000000000
0b11001110111111111111111000000000
0b11001110111111111111111100000000
0b11001110111111111111111110000000
0b11001110111111111111111111000000
0b11001110111111111111111111100000
This repeats indefinitely until there's a fatal error due to a stack overflow. I've been using your branch of proptest
until the changes are merged, but this also reproduces on the main quickcheck repository. This also reproduces on v1.0.3, so it should be another issue with the shrinker.
from quickcheck.
Can you be more specific about what types you use? i32
? u32
?
Also, I this may warrant a new issue, though it definitely looks related.
from quickcheck.
Can you be more specific about what types you use?
i32
?u32
?Also, I this may warrant a new issue, though it definitely looks related.
I'm using f32, so it should be using a signed shrinker. I'll see if I can create a minimal failing case.
from quickcheck.
Looks like I failed to fix the issue properly.
The shrinker is bounded but it does yield the original value, which results in an endless recursion as quickcheck executes the test with the exact same value again and again. As I can't reproduce the issue with a i32
I suspect some information loss in the conversion to f32
. I'll have another look later.
from quickcheck.
I just applied some additional band-aids. Could you check whether you can reproduce the issue with 0c279d6 (part of #296)?
from quickcheck.
I get an infinite loop with the following test case:
quickcheck! {
fn something(x: f64) -> bool {
let x = x.abs() % 355.0;
x.cosh().acosh() - x < 1e-10
}
}
from quickcheck.
I have trouble reproducing the issue (both on master and with #296). Does this happen with some specific initial values of x
?
from quickcheck.
It's random for me :(, may necessitate running the test multiple times.
from quickcheck.
To be clear: it does reproduce on master. That much is expected since no fix was merged since the original issue report. However, I dedicated quite a bit of CPU time in an attempt to reproduce the issue with the changes in #296 applied, without any success. So... can you actually reproduce your issue with the fix(es) in #296 or "only" on current master (aka tag 1.0.3 aka defde6f)?
from quickcheck.
Yeah, I only reproduced this with 1.0.3.
from quickcheck.
It seems this might still be an issue?
from quickcheck.
#296 was supposed to fix this, but it was never merged.
...and that's not the only issue still open with an existing fix. quickcheck
appears to be practically abandoned. Depending on your situation, you may want to consider alternatives such as proptest
or qcheck
(which is a fork).
from quickcheck.
Related: image-rs/imageproc#522
from quickcheck.
Related Issues (20)
- Cannot use Rng methods on `Gen` when implementing `Arbitrary` HOT 5
- Identity checking HOT 3
- Stack overflow in quickcheck case shrinking HOT 3
- example case sort TEST FAILED HOT 1
- QuickChecking Const Generic Code HOT 5
- Implement Arbitrary for AsMut<[T: Arbitrary]> HOT 2
- Q: Idiomatic way to specify the length of an arbitrary vector HOT 7
- <newbie> How to generate a number within a range HOT 2
- Negating an integer leads to stack overflow HOT 2
- upgrade notes would be nice. HOT 1
- debug_reprs taking up 41% of test runtime HOT 2
- warning: panic message is not a string literal HOT 1
- Rng Size for Vec Arbitrary cannot be 0
- Impl Clone for Gen
- Implement something like choose_weighted for `Gen`
- Is this still maintained? HOT 1
- Is quickcheck still maintained? HOT 1
- How to combine quickcheck 1+ with fake? HOT 3
- Durations's Arbitrary instance is dependant on Gen's size HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quickcheck.