BurntSushi / quickcheck

Automated property based testing for Rust (with shrinking).
The Unlicense
2.32k stars 144 forks source link

Add support for arrays powered by const generics without unsafe or libs #311

Open Mathspy opened 2 years ago

Mathspy commented 2 years ago

Closes #187

Alternative to #282 that does not use unsafe

This seems to have been a heavily requested feature since 2017 now but the hold back was that implementing array support via macros heavily impacts compile times, is limited to some predefined arbitrary length and bloats the docs with unnecessary clutters. The wait was for const generic stabilization which is finally upon us, so we can utilize that and add array support!

Also lol while I was writing the shrink implementation I was like uff too much cloning there's probably a way to write this better that Sushi will tell me about, then while opening this PR I decided to double check there are no PRs open that already do this, which is when I found #282 and saw the exact same implementation I reached. Now I feel much less bad about the implementation

arkeet commented 2 years ago

I was looking to add this as well and came up with exactly the same implementation before seeing there was already a PR. Would be nice to see this get in.

cloudhead commented 1 year ago

FWIW I've published a fork of this library called qcheck under here: https://github.com/cloudhead/qcheck

It includes this change as well as a bunch of others that made sense to include.