subsys/testsuite: Add an assert for a zero return code
Many functions signal success by returning a return code of zero. Add an assertion for this. Some functions can return a positive value to indicate success, where they want to convey some information. This is not handled by this assert function. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
bf04c61f6e
commit
c5d85e175f
1 changed files with 8 additions and 0 deletions
|
@ -116,6 +116,14 @@ static inline void z_zassert(bool cond,
|
||||||
#define zassert_false(cond, msg, ...) zassert(!(cond), #cond " is true", \
|
#define zassert_false(cond, msg, ...) zassert(!(cond), #cond " is true", \
|
||||||
msg, ##__VA_ARGS__)
|
msg, ##__VA_ARGS__)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Assert that @a cond is 0 (success)
|
||||||
|
* @param cond Condition to check
|
||||||
|
* @param msg Optional message to print if the assertion fails
|
||||||
|
*/
|
||||||
|
#define zassert_ok(cond, msg, ...) zassert(!(cond), #cond " is non-zero", \
|
||||||
|
msg, ##__VA_ARGS__)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Assert that @a ptr is NULL
|
* @brief Assert that @a ptr is NULL
|
||||||
* @param ptr Pointer to compare
|
* @param ptr Pointer to compare
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue