summaryrefslogtreecommitdiff
path: root/tests/test-realloc-gnu.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-05-14 15:35:24 +0200
committerBruno Haible <bruno@clisp.org>2021-05-14 15:53:31 +0200
commitf6b9c58618ec757924cb987457243756cd68fa5d (patch)
tree5eca638efc46a9d47f064f182821648b8b935e76 /tests/test-realloc-gnu.c
parent37f49aa5bbfd4a18af1455f26bc5ef870be23017 (diff)
downloadgnulib-f6b9c58618ec757924cb987457243756cd68fa5d.tar.gz
*alloc-gnu tests: Use ASSERT macro.
* tests/test-malloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-calloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-realloc-gnu.c: Include "macros.h". (main): Use ASSERT. * tests/test-reallocarray.c: Include "macros.h". (main): Use ASSERT. * modules/malloc-gnu-tests (Files): Add tests/macros.h. * modules/calloc-gnu-tests (Files): Likewise. * modules/realloc-gnu-tests (Files): Likewise. * modules/reallocarray-tests (Files): Likewise.
Diffstat (limited to 'tests/test-realloc-gnu.c')
-rw-r--r--tests/test-realloc-gnu.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test-realloc-gnu.c b/tests/test-realloc-gnu.c
index a36673888b..3a787ed91f 100644
--- a/tests/test-realloc-gnu.c
+++ b/tests/test-realloc-gnu.c
@@ -16,18 +16,20 @@
#include <config.h>
+/* Specification. */
#include <stdlib.h>
#include <errno.h>
#include <stdint.h>
+#include "macros.h"
+
int
main (int argc, char **argv)
{
/* Check that realloc (NULL, 0) is not a NULL pointer. */
void *volatile p = realloc (NULL, 0);
- if (p == NULL)
- return 1;
+ ASSERT (p != NULL);
/* Check that realloc (p, n) fails when p is non-null and n exceeds
PTRDIFF_MAX. */
@@ -35,8 +37,8 @@ main (int argc, char **argv)
{
size_t one = argc != 12345;
p = realloc (p, PTRDIFF_MAX + one);
- if (!(p == NULL && errno == ENOMEM))
- return 1;
+ ASSERT (p == NULL);
+ ASSERT (errno == ENOMEM);
}
free (p);