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_eq2!(a_function, b_function)≈ a_function() = b_function() -
assert_fn_ne2!(a_function, b_function)≈ a_function() ≠ b_function() -
assert_fn_ge2!(a_function, b_function)≈ a_function() ≥ b_function() -
assert_fn_gt2!(a_function, b_function)≈ a_function() > b_function() -
assert_fn_le2!(a_function, b_function)≈ a_function() ≤ b_function() -
assert_fn_lt2!(a_function, b_function)≈ a_function() < b_function()
Compare a function with an expression:
-
assert_fn_eq!(function, expr)≈ function() = expr -
assert_fn_ne!(function, expr)≈ function() ≠ expr -
assert_fn_ge!(function, expr)≈ function() ≥ expr -
assert_fn_gt!(function, expr)≈ function() > expr -
assert_fn_le!(function, expr)≈ function() ≤ expr -
assert_fn_lt!(function, expr)≈ function() < expr
§Example
use assertables::*;
let a: i8 = -1;
let b: i8 = 1;
assert_fn_eq2!(i8::abs, a, i8::abs, b);Modules§
- Assert a function output is equal to an expression.
- Assert a function output is equal to another function output.
- Assert a function output is greater than or equal to an expression.
- Assert a function output is greater than or equal to another.
- Assert a function output is greater than an expression.
- Assert a function output is greater than another.
- Assert a function output is less than or equal to an expression.
- Assert a function output is less than or equal to another.
- Assert a function output is less than an expression.
- Assert a function output is less than another.
- Assert a function output is not equal to an expression.
- Assert a function output is not equal to another.