Implement assert_str and assert_not_null and update tests
This commit is contained in:
@@ -12,4 +12,25 @@ typedef void (*Test)(void);
|
||||
*/
|
||||
void fail(const char* msg);
|
||||
|
||||
/**
|
||||
* Asserts that a pointer is not null.
|
||||
*
|
||||
* Calls `fail` if the assertion does not hold.
|
||||
*
|
||||
* @param ptr The pointer to test.
|
||||
* @param msg The message to print if the pointer is null.
|
||||
*/
|
||||
void assert_not_null(void* ptr, const char* msg);
|
||||
|
||||
/**
|
||||
* Asserts that a string has the expected value.
|
||||
*
|
||||
* Calls `fail` if the assertion does not hold.
|
||||
*
|
||||
* @param expected The expected value. This is typically a string literal.
|
||||
* @param actual The actual value. This is typically an expression.
|
||||
* @param msg The message to print if these do not match.
|
||||
*/
|
||||
void assert_str(const char* expected, const char* actual, const char* msg);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user