proptest::collection

Function hash_map

Source
pub fn hash_map<K: Strategy, V: Strategy>(
    key: K,
    value: V,
    size: impl Into<SizeRange>,
) -> HashMapStrategy<K, V>
where K::Value: Hash + Eq,
Available on crate feature std only.
Expand description

Create a strategy to generate HashMaps containing keys and values drawn from key and value respectively, and with a size within the given range.

This strategy will implicitly do local rejects to ensure that the HashMap has at least the minimum number of elements, in case key should produce duplicate values.