News for hackers. Stuff that matters.
Re:Property-Based Testing in Rust with Arbitrary by tveita on Thursday November 10, 2022 @06:19PM (#33555066)
It looks like Arbitrary will sample integers from an uniform distribution. For property based testing you often would like to have a bias towards "interesting" values that might trigger special cases, like -1, 0 and 1.

E.g. if you had "max_speed_kph: Option<u64>", your tests might never check what happens if max_speed_kph is 0.

Re:Property-Based Testing in Rust with Arbitrary by pfdietz on Friday November 11, 2022 @06:50AM (#33559585)
One also may bias values to be similar (or equal) to other recently generated values. This was a trick used in the compiler tester yarpgen, where it was useful in testing optimization of bitwise operators on integers.

https://github.com/intel/yarpgen

https://github.com/intel/yarpgen/blob/main/papers/yarpgen-oo...

(see "Policies for constants", page 196:8.)