Expand description
Assert for comparing functions.
These macros help compare functions that return anything. The macros call the functions, then compare the return values.
Compare a function with another function:
-
assert_fn_eq!(function1, function2)≈ function1() = function2() -
assert_fn_ne!(function1, function2)≈ function1() ≠ function2() -
assert_fn_ge!(function1, function2)≈ function1() ≥ function2() -
assert_fn_gt!(function1, function2)≈ function1() > function2() -
assert_fn_le!(function1, function2)≈ function1() ≤ function2() -
assert_fn_lt!(function1, function2)≈ function1() < function2()
Compare a function with an expression:
-
assert_fn_eq_expr!(function, expr)≈ function() = expr -
assert_fn_ne_expr!(function, expr)≈ function() ≠ expr -
assert_fn_ge_expr!(function, expr)≈ function() ≥ expr -
assert_fn_gt_expr!(function, expr)≈ function() > expr -
assert_fn_le_expr!(function, expr)≈ function() ≤ expr -
assert_fn_lt_expr!(function, expr)≈ function() < expr
§Example
use assertables::*;
let a: i8 = -1;
let b: i8 = 1;
assert_fn_eq!(i8::abs, a, i8::abs, b);Modules§
- Assert a function output is equal to another function output.
- Assert a function output is equal to an expression.
- Assert a function output is greater than or equal to another.
- Assert a function output is greater than or equal to an expression.
- Assert a function output is greater than another.
- Assert a function output is greater than an expression.
- Assert a function output is less than or equal to another.
- Assert a function output is less than or equal to an expression.
- Assert a function output is less than another.
- Assert a function output is less than an expression.
- Assert a function output is not equal to another.
- Assert a function output is not equal to an expression.