im_rc::proptest

Function hash_map

Source
pub fn hash_map<K: Strategy + 'static, V: Strategy + 'static>(
    key: K,
    value: V,
    size: Range<usize>,
) -> BoxedStrategy<HashMap<<K::Tree as ValueTree>::Value, <V::Tree as ValueTree>::Value>>
where <K::Tree as ValueTree>::Value: Hash + Eq + Clone, <V::Tree as ValueTree>::Value: Clone,
Expand description

A strategy for a HashMap of a given size.

ยงExamples

proptest! {
    #[test]
    fn proptest_works(ref m in hash_map(0..9999, ".*", 10..100)) {
        assert!(m.len() < 100);
        assert!(m.len() >= 10);
    }
}