use proptest::prelude::*;
fn expect_word_and(left: &[u32], right: &[u32]) -> Vec<u32> {
left.iter()
.zip(right.iter())
.map(|(left, right)| *left & *right)
.collect()
}
proptest! {
#![proptest_config(ProptestConfig::with_cases(2048))]
#[test]
fn fuzz_must_init_matches_word_and(
left in proptest::collection::vec(any::<u32>(), 0..128),
right in proptest::collection::vec(any::<u32>(), 0..128),
) {
prop_assert_eq!(weir::oracle::bitset::must_init(&left, &right), expect_word_and(&left, &right));
}
#[test]
fn fuzz_live_at_matches_word_and(
left in proptest::collection::vec(any::<u32>(), 0..128),
right in proptest::collection::vec(any::<u32>(), 0..128),
) {
prop_assert_eq!(weir::oracle::bitset::live_at(&left, &right), expect_word_and(&left, &right));
}
#[test]
fn fuzz_post_dominates_matches_word_and(
left in proptest::collection::vec(any::<u32>(), 0..128),
right in proptest::collection::vec(any::<u32>(), 0..128),
) {
prop_assert_eq!(weir::oracle::bitset::post_dominates(&left, &right), expect_word_and(&left, &right));
}
#[test]
fn fuzz_scc_query_matches_word_and(
left in proptest::collection::vec(any::<u32>(), 0..128),
right in proptest::collection::vec(any::<u32>(), 0..128),
) {
prop_assert_eq!(weir::oracle::bitset::scc_query(&left, &right), expect_word_and(&left, &right));
}
}