Expand description
Functions for correctness checks similar to the design by contract philosophy.
This module provides validation checking of function or method conditions.
A condition is a predicate which must be true just prior to the execution of some section of code - for correct behavior as per the design specification.
An anyhow::Result
is returned with a descriptive message when the
condition check fails.
Constants§
- FAILED
- A message prefix that can be used with calls to
expect
or other assertion-related functions.
Functions§
- check_
equal - Checks the values are equal.
- check_
equal_ u8 - Checks the
u8
values are equal. - check_
equal_ usize - Checks the
usize
values are equal. - check_
in_ range_ inclusive_ f64 - Checks the
f64
value is in range [l
,r
] (inclusive). - check_
in_ range_ inclusive_ i64 - Checks the
i64
value is in range [l
,r
] (inclusive). - check_
in_ range_ inclusive_ u8 - Checks the
u8
value is in range [l
,r
] (inclusive). - check_
in_ range_ inclusive_ u64 - Checks the
u64
value is range [l
,r
] (inclusive). - check_
in_ range_ inclusive_ usize - Checks the
usize
value is in range [l
,r
] (inclusive). - check_
key_ in_ index_ map - Checks the
key
is in themap
. - check_
key_ in_ map - Checks the
key
is in themap
. - check_
key_ not_ in_ index_ map - Checks the
key
is not in themap
. - check_
key_ not_ in_ map - Checks the
key
is not in themap
. - check_
map_ empty - Checks the hashmap is empty.
- check_
map_ not_ empty - Checks the map is not empty.
- check_
member_ in_ set - Checks the
member
is in theset
. - check_
member_ not_ in_ set - Checks the
member
is not in theset
. - check_
non_ negative_ f64 - Checks the
f64
value is non-negative (< 0). - check_
positive_ i64 - Checks the
i64
value is positive (> 0). - check_
positive_ u64 - Checks the
u64
value is positive (> 0). - check_
predicate_ false - Checks the
predicate
is false. - check_
predicate_ true - Checks the
predicate
is true. - check_
slice_ empty - Checks the slice is empty.
- check_
slice_ not_ empty - Checks the slice is not empty.
- check_
string_ contains - Checks the string
s
contains the patternpat
. - check_
valid_ string - Checks the string
s
has semantic meaning and contains only ASCII characters. - check_
valid_ string_ optional - Checks the string
s
if Some, contains only ASCII characters and has semantic meaning.