ztest: fix z_assert_within() bounds
zassert_within should also compare on equality instead of only greater/lower. example: zassert_within(1,1,0); // should return true zassert_within(1,2,1); // should return true Signed-off-by: Alexander Wachter <alexander@wachter.cloud>
This commit is contained in:
parent
a8b97075bf
commit
0c1877a999
1 changed files with 1 additions and 1 deletions
|
@ -190,7 +190,7 @@ static inline void z_zassert(bool cond,
|
|||
* @param msg Optional message to print if the assertion fails
|
||||
*/
|
||||
#define zassert_within(a, b, d, msg, ...) \
|
||||
zassert(((a) > ((b) - (d))) && ((a) < ((b) + (d))), \
|
||||
zassert(((a) >= ((b) - (d))) && ((a) <= ((b) + (d))), \
|
||||
#a " not within " #b " +/- " #d, \
|
||||
msg, ##__VA_ARGS__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue