macro_rules! conformance_tests {
(@emit [$($counter:tt)*] $type:ty, $n_cases:expr) => { ... };
(@internal [$($counter:tt)*]) => { ... };
(@internal [$($counter:tt)*] $type:ty => $n_cases:expr, $($rest:tt)*) => { ... };
(@internal [$($counter:tt)*] $type:ty => $n_cases:expr) => { ... };
(@internal [$($counter:tt)*] $type:ty, $($rest:tt)*) => { ... };
(@internal [$($counter:tt)*] $type:ty) => { ... };
($($input:tt)*) => { ... };
}Expand description
Define conformance tests for Conformance types.
This macro generates test functions that verify encodings match expected
hash values stored in conformance.toml.
§Usage
ⓘ
conformance_tests! {
Vec<u8>, // Uses default (65536 cases)
Vec<u16> => 100, // Explicit case count
BTreeMap<u32, String> => 100,
}Test names are auto-generated. The type name is used as the key in the TOML file.
§Regeneration Mode
When cfg(generate_conformance_tests) is set, tests regenerate their
expected values in the TOML file (useful for intentional format changes):
RUSTFLAGS="--cfg generate_conformance_tests" cargo test -p my_crate conformance