Skip to main content

assert_all

Macro assert_all 

Source
macro_rules! assert_all {
    (  $($cond:expr),*) => { ... };
}
Expand description

Multi-assertion macro. This macro take at least 1 argument as an expression. Several expressions can be added.

§Argument

  • $cond - Assertion condition. If several assertions, must be separated by a comma.

§Note

While an assertion condition is not valid, this macro doesn’t stop to test the nex assertion. After the last assertion was done, this macro show the list of assertion failed and the number of failures.

§Examples

use utmt::assert_all;

assert_all!(true, !false, 1+1 == 2);
use utmt::assert_all;
assert_all!(compute(), 1+1==2, 1*2==6);

fn compute() -> bool {
 false
}
Example of output errors:

Assertion failed : compute()
Assertion failed : 1*2==6


thread 'test::test_assert_8' (124729) panicked at src/main.rs:46:9:
2 assertion(s) failed.