ztest: Add zassert_between_inclusive macro
Added macro to test that a value falls within a defined range, including the provided end points. Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
This commit is contained in:
parent
0976bdb3c9
commit
f2b8a9918f
1 changed files with 14 additions and 0 deletions
|
@ -210,6 +210,20 @@ static inline bool z_zassert(bool cond,
|
|||
#a " not within " #b " +/- " #d, \
|
||||
msg, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Assert that @a a is greater than or equal to @a l and less
|
||||
* than or equal to @a u
|
||||
*
|
||||
* @param a Value to compare
|
||||
* @param l Lower limit
|
||||
* @param u Upper limit
|
||||
* @param msg Optional message to print if the assertion fails
|
||||
*/
|
||||
#define zassert_between_inclusive(a, l, u, msg, ...) \
|
||||
zassert(((a) >= (l)) && ((a) <= (u)), \
|
||||
#a " not between " #l " and " #u " inclusive", \
|
||||
msg, ##__VA_ARGS__)
|
||||
|
||||
/**
|
||||
* @brief Assert that 2 memory buffers have the same contents
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue