proptest-rs / proptest

Hypothesis-like property testing for Rust
Apache License 2.0
1.74k stars 161 forks source link

Deprecate `hash_map` and `hash_set` strategies? #494

Open thomaseizinger opened 3 months ago

thomaseizinger commented 3 months ago

I've noticed that the hash_map and hash_set strategies can be quite severe footguns. Iteration order of HashMaps and HashSets is non-deterministic. Hence, composing more strategies on top of a hash_map with .prop_flat_map will most likely yield non-deterministic behaviour and completely break the idea of reproducing a failing test case based on its seed.

I've spent many hours debugging my tests (proptest-state-machine specifically) until I finally got to the bottom of this.

I am not sure if deprecation is the right call but I think it should be called out or warned about somewhere.