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 bycfg!(debug_assertions)
. - debug_
unreachable_ unchecked - In debug mode, panics if reached (with
unreachable!
). In release mode, is astd::hint::unreachable_unchecked()
call. This isunsafe
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
andDebug
. - 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.