use op_reflect::{Db, BrokenReflect}; use proptest_derive::Arbitrary; // this crate tries to exercise every feature // can derive for generic types! #[derive(BrokenReflect)] struct Newtype(T); #[derive(BrokenReflect)] struct UnitLike; #[derive(BrokenReflect)] struct TupleLike(String, Vec); #[derive(BrokenReflect)] struct RealStruct { field: u8, } #[derive(BrokenReflect)] enum BigFinalType { UnitVariant, StructUnit(UnitLike), StructTuple(TupleLike), StructStruct(RealStruct), TupleVariant(u8, Newtype<()>), StructVariant { datum: String, wee_woo: usize }, } #[test] fn main() { let mut db = Db::new(); BigFinalType::register(&mut db); proptest::proptest!(|(b: BigFinalType)| { let json_val = db.serialize(serde_json::value::Serializer, &b)?; let deser = db.deserialize(json_val); b == deser }); }