3 ms·
This looks super cool! I was under the impression that burntsushi's implementation of quickcheck [0] was the most popular property-based testing library for Ru
by sn9 6y ago
This looks super cool!
I was under the impression that burntsushi's implementation of quickcheck [0] was the most popular property-based testing library for Rust. Was I mistaken or was there a reason the authors chose another library as inspiration?
[0] https://github.com/BurntSushi/quickcheck https://github.com/BurntSushi/quickcheck
- adreid 6y agoBurnt Sushi only uses the type to generate values. Proptest lets you constrain the values more precisely. Eg you can create a btreemap with up to 5 entries where the keys are some subset of ints (say) and the values are some subset of some other type. This can capture many of the constraints of a functions precondition and can be implemented efficiently in both fuzzers and verifiers.
- shepmaster 6y agoAs a previous user of quickcheck and now user of proptest, I can say that proptest feels much better to use because it doesn't tie quite as directly to a single type (as a sibling comment mentions). With quickcheck, I had to define `MyTypeWithAnOddOffset` and `MyTypeWithAnEvenOffset` (or equivalent formulation) and composing things was tedious or hard. With proptest [1], things flow much nicer. [1]: https://github.com/shepmaster/jetscii/blob/2b1039a9fb8d8ad9c0dbac2c1007c4d0533261c2/src/simd.rs#L387-L409 https://github.com/shepmaster/jetscii/blob/2b1039a9fb8d8ad9c...