1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-01 10:06:53 +03:00

For tests, rename ASSERT_ALLOC() to TEST_CALLOC_OR_FAIL()

Signed-off-by: Tom Cosgrove <tom.cosgrove@arm.com>
This commit is contained in:
Tom Cosgrove
2023-09-04 11:05:59 +01:00
parent f88ee8b007
commit 1357502bca
27 changed files with 159 additions and 159 deletions

View File

@ -143,22 +143,22 @@
* This expression may be evaluated multiple times.
*
*/
#define ASSERT_ALLOC(pointer, length) \
do \
{ \
TEST_ASSERT((pointer) == NULL); \
if ((length) != 0) \
{ \
(pointer) = mbedtls_calloc(sizeof(*(pointer)), \
#define TEST_CALLOC_OR_FAIL(pointer, length) \
do { \
TEST_ASSERT((pointer) == NULL); \
if ((length) != 0) { \
(pointer) = mbedtls_calloc(sizeof(*(pointer)), \
(length)); \
TEST_ASSERT((pointer) != NULL); \
} \
} \
while (0)
TEST_ASSERT((pointer) != NULL); \
} \
} while (0)
/* For backwards compatibility */
#define ASSERT_ALLOC(pointer, length) TEST_CALLOC_OR_FAIL(pointer, length)
/** Allocate memory dynamically. If the allocation fails, skip the test case.
*
* This macro behaves like #ASSERT_ALLOC, except that if the allocation
* This macro behaves like #TEST_CALLOC_OR_FAIL, except that if the allocation
* fails, it marks the test as skipped rather than failed.
*/
#define ASSERT_ALLOC_WEAK(pointer, length) \