stedolan / crowbar

Property fuzzing for OCaml
MIT License
180 stars 31 forks source link

Shortcut generation for map/bind with lazy small_example #66

Open art-w opened 2 years ago

art-w commented 2 years ago

This proposal might not be the right bandage (maybe just expanding the documentation of choose would be better.) I ran into some issues with a recursive generator that was failing to terminate. Reading crowbar source code, there's a size fuel mechanism in place to shortcut the random generation by choosing the first available const/primitive when the generated term grows too much -- but my leaves were wrapped in a map [..] and so the shortcut couldn't trigger (for example, see the xmldiff test where knowledge of the optimization edge-case yields a manual unrolling).

Some random comments:

(unrelatedly, the xmldiff test seems to work on my computer -- however the calendar test crashes very fast!)

lindig commented 1 year ago

I tried to understand how the length of lists is controlled; reading the source I came across the size parameter but could not see how it is initialized. A comment in the code of its role and initialization would be useful.