Skip to main content

prop_cbor_roundtrip

Macro prop_cbor_roundtrip 

Source
macro_rules! prop_cbor_roundtrip {
    ($title:ident, $ty:ty, $strategy:expr) => { ... };
    ($ty:ty, $strategy:expr) => { ... };
}
Expand description

Generate a roundtrip property to assert that Cbor encoder and decoder for a given type can safely be called in sequence and yield the original input.

Requires:

  • proptest

Usage:

§```

§prop_cbor_roundtrip!(MyType, my_strategy())

§

§// Or with an explicit test title in case a module contains multiple calls to the macro:

§prop_cbor_roundtrip!(prop_cbor_roundtrip_MyType, MyType, my_strategy())

§```