From 030fd0a428faaeed2f7dd3186a617a9f3f63bb57 Mon Sep 17 00:00:00 2001 From: Vladimir Davydov <vdavydov@tarantool.org> Date: Thu, 24 Aug 2023 15:31:51 +0300 Subject: [PATCH] test: drop ok/is/isnt message from unit/xmalloc test Just to demonstrate that the format argument of ok/is/isnt macros is now optional. NO_DOC=test NO_CHANGELOG=test (cherry picked from commit e13f2bf5715fa8ccd9eea217cf48981fa095cd4b) --- test/unit/xmalloc.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/test/unit/xmalloc.c b/test/unit/xmalloc.c index 9c836de539..3d9c37ed3b 100644 --- a/test/unit/xmalloc.c +++ b/test/unit/xmalloc.c @@ -12,7 +12,7 @@ test_xmalloc(void) plan(1); const int size = 9000; char *p = xmalloc(size); - isnt(p, NULL, "p != NULL"); + isnt(p, NULL); if (p != NULL) { memset(p, 'x', size); free(p); @@ -29,14 +29,14 @@ test_xcalloc(void) const int nmemb = 42; const int size = 9000; char *p = xcalloc(nmemb, size); - isnt(p, NULL, "p != NULL"); + isnt(p, NULL); if (p != NULL) { bool is_zeroed = true; for (int i = 0; i < nmemb * size && is_zeroed; i++) { if (p[i] != 0) is_zeroed = false; } - ok(is_zeroed, "p is zeroed"); + ok(is_zeroed); free(p); } check_plan(); @@ -50,18 +50,18 @@ test_xrealloc(void) plan(3); const int size = 9000; char *p = xrealloc(NULL, size); - isnt(p, NULL, "p != NULL on alloc"); + isnt(p, NULL); if (p != NULL) memset(p, 'x', size); p = xrealloc(p, size * 2); - isnt(p, NULL, "p != NULL on realloc"); + isnt(p, NULL); if (p != NULL) { bool is_same = true; for (int i = 0; i < size && is_same; i++) { if (p[i] != 'x') is_same = false; } - ok(is_same, "p is same after realloc"); + ok(is_same); memset(p, 'x', size * 2); free(p); } @@ -76,14 +76,14 @@ test_xstrdup(void) plan(3); const int size = 9000; char *s = xmalloc(size); - isnt(s, NULL, "s != NULL"); + isnt(s, NULL); if (s != NULL) { memset(s, 'x', size); s[size - 1] = 0; char *copy = xstrdup(s); - isnt(copy, NULL, "copy != NULL"); + isnt(copy, NULL); if (copy != NULL) { - is(strcmp(s, copy), 0, "strcmp(s, copy) == 0"); + is(strcmp(s, copy), 0); free(copy); } free(s); @@ -100,18 +100,17 @@ test_xstrndup(void) const int size = 9000; const int n = size / 2; char *s = xmalloc(size); - isnt(s, NULL, "s != NULL"); + isnt(s, NULL); if (s != NULL) { memset(s, 'x', size); s[size - 1] = 0; char *copy = xstrndup(s, n); - isnt(copy, NULL, "copy != NULL"); + isnt(copy, NULL); if (copy != NULL) { - is(strlen(copy), (size_t)n, "strlen(copy) == n"); - is(strncmp(s, copy, n), 0, "strncmp(s, copy, n) == 0"); - ok(strncmp(s, copy, n + 1) > 0, - "strncmp(s, copy, n + 1) > 0"); - ok(strcmp(s, copy) > 0, "strcmp(s, copy) > 0"); + is(strlen(copy), (size_t)n); + is(strncmp(s, copy, n), 0); + ok(strncmp(s, copy, n + 1) > 0); + ok(strcmp(s, copy) > 0); free(copy); } free(s); -- GitLab