BurntSushi / quickcheck

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

Make Arbitrary::arbitrary for SystemTime not panic #322

Open neithernut opened 10 months ago

neithernut commented 10 months ago

Arbitrary SystemTimes are generated based on arbitrary Durations by adding or subtracting from UNIX_EPOCH. If we happen to generate big Durations, this could cause an overflow.

This change avoids this problem by resorting to ever smaller durations in case of an overflow.

Fixes #321.