sometimes_assert

Macro sometimes_assert 

Source
macro_rules! sometimes_assert {
    ($name:ident, $condition:expr, $message:expr) => { ... };
}
Expand description

Assert a condition that should sometimes be true, tracking the success rate.

This macro is used for probabilistic properties in distributed systems, such as “consensus should usually be reached quickly” or “the system should be available most of the time”. The assertion result is tracked for statistical analysis without causing the simulation to fail.

The macro automatically registers the assertion at compile time and tracks module execution to enable unreachable code detection.

§Parameters

  • name - An identifier for this assertion (for tracking purposes)
  • condition - The expression to evaluate (must be boolean)
  • message - A descriptive message about what this assertion tests

Assert that a condition should sometimes be true. Records statistics for analysis.