Files
tlsn-utils/utils/fuzz/fuzz_targets/range_intersection_set.rs
sinu.eth e7b2db6a0c feat(utils): additional set operations (#39)
* rename traits

* subset

* intersection

* prove set intersection

* assert invariants

* fix doctest
2024-09-04 19:29:29 -07:00

26 lines
620 B
Rust

#![no_main]
use std::collections::HashSet;
use std::ops::Range;
use libfuzzer_sys::fuzz_target;
use tlsn_utils_fuzz::{assert_invariants, SmallSet};
use utils::range::*;
fuzz_target!(|r: (Range<u8>, SmallSet)| {
let s1 = r.0;
let s2: RangeSet<u8> = r.1.into();
let h1: HashSet<u8> = HashSet::from_iter(s1.clone());
let h2: HashSet<u8> = HashSet::from_iter(s2.iter());
let intersection = s1.intersection(&s2);
let h3: HashSet<u8> = HashSet::from_iter(intersection.iter());
assert_eq!(h3, h1.intersection(&h2).copied().collect::<HashSet<_>>());
assert_invariants(intersection);
});