use super::super::super::support::arb_vv;
use proptest::prelude::*;
proptest! {
#[test]
fn prop_merge_commutative_associative_idempotent(
a in arb_vv(), b in arb_vv(), c in arb_vv(),
) {
prop_assert_eq!(a.merge(&b), b.merge(&a));
prop_assert_eq!(a.merge(&b).merge(&c), a.merge(&b.merge(&c)));
prop_assert_eq!(a.merge(&a), a);
}
#[test]
fn prop_merge_is_least_upper_bound(a in arb_vv(), b in arb_vv()) {
let m = a.merge(&b);
prop_assert!(a <= m);
prop_assert!(b <= m);
for station in 0u32..8 {
prop_assert_eq!(m.get(station), a.get(station).max(b.get(station)));
}
}
#[test]
fn prop_meet_commutative_associative_idempotent(
a in arb_vv(), b in arb_vv(), c in arb_vv(),
) {
prop_assert_eq!(a.meet(&b), b.meet(&a));
prop_assert_eq!(a.meet(&b).meet(&c), a.meet(&b.meet(&c)));
prop_assert_eq!(a.meet(&a), a);
}
#[test]
fn prop_meet_is_greatest_lower_bound(
a in arb_vv(), b in arb_vv(), c in arb_vv(),
) {
let m = a.meet(&b);
prop_assert!(m <= a);
prop_assert!(m <= b);
prop_assert_eq!(c <= a && c <= b, c <= m);
for station in 0u32..8 {
prop_assert_eq!(m.get(station), a.get(station).min(b.get(station)));
}
}
#[test]
fn prop_join_meet_absorption_and_distributivity(
a in arb_vv(), b in arb_vv(), c in arb_vv(),
) {
prop_assert_eq!(&a.meet(&a.merge(&b)), &a);
prop_assert_eq!(&a.merge(&a.meet(&b)), &a);
prop_assert_eq!(a.meet(&b.merge(&c)), a.meet(&b).merge(&a.meet(&c)));
prop_assert_eq!(a.merge(&b.meet(&c)), a.merge(&b).meet(&a.merge(&c)));
}
}