Module correctness

Source
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 the map.
check_key_in_map
Checks the key is in the map.
check_key_not_in_index_map
Checks the key is not in the map.
check_key_not_in_map
Checks the key is not in the map.
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 the set.
check_member_not_in_set
Checks the member is not in the set.
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 pattern pat.
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.