#![feature(never_type)]
use proptest::prelude::{prop_assert_eq, proptest, Arbitrary};
use proptest_derive::Arbitrary;
#[allow(unreachable_code)]
#[derive(Debug, Arbitrary, PartialEq)]
enum Ty1 {
_V2(!),
_V3([!; 1]),
_V4([!; 2 - 1]),
_V5([!; 2 * 1]),
_V6([!; 2 / 2]),
_V7([!; 0b0 ^ 0b1]),
_V8([!; 0b1 & 0b1]),
_V9([!; 0b1 | 0b0]),
_V10([!; 0b10 << 1]),
_V11([!; 0b10 >> 1]),
_V12([!; !0 - 18446744073709551614]),
_V13([!; 1 + 2 * (3 / 3)]),
V1,
}
proptest! {
#[test]
fn ty1_always_v1(v1: Ty1) {
prop_assert_eq!(v1, Ty1::V1);
}
}
macro_rules! tymac {
($ignore: ty) => {
u8
};
}
#[derive(Debug, Arbitrary)]
struct TyMac0 {
_field: tymac!(!),
}
#[derive(Debug, Arbitrary)]
struct TyMac1 {
_baz: tymac!([!; 3 + 4]),
}
enum _TyMac2 {
#[deny(dead_code)]
V0(tymac!((u8, !, usize))),
}
trait Fun {
type Prj;
}
impl Fun for ! {
type Prj = u8;
}
impl Fun for (!, usize, !) {
type Prj = u8;
}
#[derive(Debug, Arbitrary)]
enum UsePrj0 {
#[deny(dead_code)]
V0(<! as Fun>::Prj),
}
#[derive(Debug, Arbitrary)]
enum UsePrj1 {
#[deny(dead_code)]
V0(<(!, usize, !) as Fun>::Prj),
}
#[test]
fn asserting_arbitrary() {
fn assert_arbitrary<T: Arbitrary>() {}
assert_arbitrary::<Ty1>();
assert_arbitrary::<TyMac0>();
assert_arbitrary::<TyMac1>();
assert_arbitrary::<UsePrj0>();
assert_arbitrary::<UsePrj1>();
}