Crate chek

Source
Expand description

This is essentially a set of more fully-featured assert macros along the lines of assert_eq!, assert_ne!, etc. It provides better output than just performing a comparison in the assert!(...) body, in that it includes the values of the arguments on output. Unlike assert_eq!/assert_ne!, it also will output the expression strings that produced the value.

Macros§

almost_equal
Panics if the provided values are not almost equal to eachother.
almost_zero
Panics if the provided value is not almost equal to zero.
almost_zero_with_tolerance
Panics if the provided value is not almost equal to zero.
debug_almost_equal
Same as chek::almost_equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_almost_zero
Same as chek::almost_zero! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_almost_zero_with_tolerance
Same as chek::almost_zero_with_tolerance! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_eq
Same as chek::eq! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_equal
Same as chek::equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_ge
Same as chek::ge! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_greater
Same as chek::greater! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_greater_or_equal
Same as chek::greater_or_equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_gt
Same as chek::gt! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_le
Same as chek::le! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_less
Same as chek::less! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_less_or_equal
Same as chek::less_or_equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_lt
Same as chek::lt! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_ne
Same as chek::ne! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_not_almost_equal
Same as chek::not_almost_equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_not_almost_zero
Same as chek::not_almost_zero! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_not_almost_zero_with_tolerance
Same as chek::not_almost_zero_with_tolerance! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_not_equal
Same as chek::not_equal! in debug builds or release builds where the -C debug-assertions was provided to the compiler. For all other builds, vanishes without a trace.
debug_unreachable
Panics if reached. This is a variant of the standard library’s unreachable! macro that is controlled by cfg!(debug_assertions).
debug_unreachable_unchecked
In debug mode, panics if reached (with unreachable!). In release mode, is a std::hint::unreachable_unchecked() call. This is unsafe to call in both debug and release builds.
eq
Panics if the first expression is not strictly equal than the second.
equal
Panics if the first expression is not strictly equal than the second.
ge
Panics if the first expression is not strictly greater_or_equal than the second.
greater
Panics if the first expression is not strictly greater than the second.
greater_or_equal
Panics if the first expression is not strictly greater_or_equal than the second.
gt
Panics if the first expression is not strictly greater than the second.
le
Panics if the first expression is not less than or equal to the second.
less
Panics if the first expression is not strictly less than the second.
less_or_equal
Panics if the first expression is not less than or equal to the second.
lt
Panics if the first expression is not strictly less than the second.
ne
Panics if the first expression is not strictly not_equal than the second. Requires that the values implement PartialEq and Debug.
not_almost_equal
Panics if the provided values are almost equal to eachother.
not_almost_zero
Panics if the provided value is almost equal to zero.
not_almost_zero_with_tolerance
Panics if the provided value is not almost equal to zero.
not_equal
Panics if the first expression is not strictly not_equal than the second.