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
expector other assertion-related functions.
Functions§
- check_
equal - Checks the values are equal.
- check_
equal_ u8 - Checks the
u8values are equal. - check_
equal_ usize - Checks the
usizevalues are equal. - check_
in_ range_ inclusive_ f64 - Checks the
f64value is in range [l,r] (inclusive). - check_
in_ range_ inclusive_ i64 - Checks the
i64value is in range [l,r] (inclusive). - check_
in_ range_ inclusive_ u8 - Checks the
u8value is in range [l,r] (inclusive). - check_
in_ range_ inclusive_ u64 - Checks the
u64value is range [l,r] (inclusive). - check_
in_ range_ inclusive_ usize - Checks the
usizevalue is in range [l,r] (inclusive). - check_
key_ in_ map - Checks the
keyis in themap. - check_
key_ not_ in_ map - Checks the
keyis 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
memberis in theset. - check_
member_ not_ in_ set - Checks the
memberis not in theset. - check_
non_ negative_ f64 - Checks the
f64value is non-negative (>= 0). - check_
nonempty_ string - Checks if the string
sis not empty. - check_
positive_ decimal - Checks the
Decimalvalue is positive (> 0). - check_
positive_ i64 - Checks the
i64value is positive (> 0). - check_
positive_ i128 - Checks the
i64value is positive (> 0). - check_
positive_ u64 - Checks the
u64value is positive (> 0). - check_
positive_ u128 - Checks the
u128value is positive (> 0). - check_
predicate_ false - Checks the
predicateis false. - check_
predicate_ true - Checks the
predicateis 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
scontains the patternpat. - check_
valid_ string_ ascii - Checks the string
shas semantic meaning and contains only ASCII characters. - check_
valid_ string_ ascii_ optional - Checks the string
sif Some, contains only ASCII characters and has semantic meaning. - check_
valid_ string_ utf8 - Checks the string
shas semantic meaning and allows UTF-8 characters.