Shrinker improvements to QCheck list, string, and function - #242
Conversation
c-cube
commented
Apr 21, 2022
via email
Just a remark, but if this modifies shrinking, I don't see it having any impact
on a successful test suite where 0 shrinking happens, correcT? |
aa1ce64 to
f8bbd31Comparejmid
commented
Apr 21, 2022
Good point 👍 |
jmid
commented
Apr 29, 2022
@gasche - I know you've been hand-writing shrinkers in the past. |
f8bbd31 to
3ba1ce8Comparejmid
commented
May 5, 2022
I just rebased and added a CHANGELOG entry. |
gasche
commented
May 6, 2022
Apologies for the lack of reply. I tried to look at the shrinker I wrote last, it works on the AST of a small programming language, and there the current shrinkers are efficient enough that I couldn't measure a difference (I tried to inject bugs, but all examples get minimized in 10 steps or less; maybe the bugs were not subtle enough). The shrinker does not use |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
vch9
commented
May 6, 2022
Looks great! The shrinks steps seems to be reduced in the vast majority of cases. |
Co-authored-by: Valentin Chaboche <valentinchb@gmail.Com>
OK, following @vch9 pointing out a shrink count that went up, I dug, found out it was caused by a linear time |
jmid
commented
May 6, 2022
OK, implemented string shrinker conversions which makes the shrinker benchmark run consistently in under 2 secs on my machine. |
jmid
commented
May 7, 2022
OK, I added a hand-rolled |
jmid
commented
May 9, 2022
OK, thanks for the review @vch9 🙏
Overall, with the inclusion of the Green light to merge @vch9? |
vch9
commented
May 9, 2022
Absolutely! This is a nice improvement :) The char shrinker makes sense! |
This PR contains the QCheck(1) shrinker improvements to
list,string, and functions described in #235.The essential part extracted from #235 (comment):
The reduced shrink counts in, e.g., test/core/QCheck_expect_test.expected are nice, but beware that this only counts successful shrink attempts. #235 (comment) documents how the PR reduces the total shrink attempts significantly, e.g.,
string never has a \255 charis reduced from 9365 attempts to 38 (on seed 6789)lists shorter than 432is reduced from 5118102 attempts to 19461 (on seed 1234)fold_left fold_right uncurriedis reduced from 80630 attempts to 199 (on seed 1234)I would be grateful if someone could give this a quick spin with an
opam pinof https://github.com/jmid/qcheck/tree/shrinker-improvements-list-string-fun on their regular QCheck tests before merging.