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!(a_function, b_function)≈ a_function() = b_function()assert_fn_ne!(a_function, b_function)≈ a_function() ≠ b_function()assert_fn_ge!(a_function, b_function)≈ a_function() ≥ b_function()assert_fn_gt!(a_function, b_function)≈ a_function() > b_function()assert_fn_le!(a_function, b_function)≈ a_function() ≤ b_function()assert_fn_lt!(a_function, b_function)≈ a_function() < b_function()
Compare a function with an expression:
assert_fn_eq_x!(function, expr)≈ function() = exprassert_fn_ne_x!(function, expr)≈ function() ≠ exprassert_fn_ge_x!(function, expr)≈ function() ≥ exprassert_fn_gt_x!(function, expr)≈ function() > exprassert_fn_le_x!(function, expr)≈ function() ≤ exprassert_fn_lt_x!(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_
fn_ eq - Assert a function output is equal to another.
- assert_
fn_ eq_ x - Assert a function output is equal to an expression.
- assert_
fn_ ge - Assert a function output is greater than or equal to another.
- assert_
fn_ ge_ x - Assert a function output is greater than or equal to an expression.
- assert_
fn_ gt - Assert a function output is greater than another.
- assert_
fn_ gt_ x - Assert a function output is greater than an expression.
- assert_
fn_ le - Assert a function output is less than or equal to another.
- assert_
fn_ le_ x - Assert a function output is less than or equal to an expression.
- assert_
fn_ lt - Assert a function output is less than another.
- assert_
fn_ lt_ x - Assert a function output is less than an expression.
- assert_
fn_ ne - Assert a function output is not equal to another.
- assert_
fn_ ne_ x - Assert a function output is not equal to an expression.