c2ee30f53e1d5b695c62a4a62fa201507f65a9bf
[bigint-presentation-code.git] / register_allocator / fuzz / fuzz_targets / loc_set_max_conflicts_with.rs
1 #![no_main]
2 use bigint_presentation_code_register_allocator::{
3 interned::{GlobalState, Intern},
4 loc::Loc,
5 loc_set::LocSet,
6 };
7 use libfuzzer_sys::fuzz_target;
8
9 fuzz_target!(|data: (LocSet, LocSet)| {
10 GlobalState::scope(|| {
11 GlobalState::get(|fast_global_state| {
12 GlobalState::scope(|| {
13 GlobalState::get(|reference_global_state| {
14 let (a, b) = data;
15 let a_fast = a.to_interned(fast_global_state);
16 let a_reference = a.into_interned(reference_global_state);
17 let b_fast = b.to_interned(fast_global_state);
18 let b_reference = b.into_interned(reference_global_state);
19 if let Some(loc) = b_fast.iter().next() {
20 let fast = a_fast.clone().max_conflicts_with(loc, fast_global_state);
21 let reference = a_reference
22 .clone()
23 .max_conflicts_with(loc, reference_global_state);
24 assert_eq!(fast, reference, "a={a_fast:?} loc={loc:?}");
25 }
26 let fast = a_fast
27 .clone()
28 .max_conflicts_with(b_fast.clone(), fast_global_state);
29 let reference =
30 a_reference.max_conflicts_with(b_reference, reference_global_state);
31 assert_eq!(fast, reference, "a={a_fast:?} b={b_fast:?}");
32 })
33 })
34 })
35 })
36 });