Skip to main content

for_each_model_rule

Macro for_each_model_rule 

macro_rules! for_each_model_rule {
    ($($callback:tt)+) => { ... };
}
Available on crate feature proptest only.
Expand description

Hands the complete model rule set to $callback.

The model family’s single enumeration (CF-22), and the reason it is here rather than in registry.rs is the same reason the rules are here rather than in suite.rs: cargo xtask spec-trace reads suite.rs and would report a rule written there as needing a clause of its own.

There is one rule in it today. The macro exists anyway, because the property CF-22 asks for is one list per family whether the family has one rule or ten — and because the second model rule is otherwise landed by copying a name into however many harnesses exist by then.

§Examples

This example is only compiled when the proptest feature is on, because the module defining the macro is — which is the same reason it needs no cfg of its own.

macro_rules! rule_names {
    ($($name:ident),* $(,)?) => { [ $( stringify!($name) ),* ] };
}

let names = happenstance_testkit::for_each_model_rule!(rule_names);
assert!(names.contains(&"ops_agree_with_the_model"));