summaryrefslogtreecommitdiffstats
path: root/test/unit/util.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2016-05-12 21:51:07 (GMT)
committerJason Evans <jasone@canonware.com>2016-05-12 21:53:25 (GMT)
commitf70a254d44c8d30af2cd5d30531fb18fdabaae6d (patch)
tree4e226a1bd0d56d742ca0950f69829ed7f0216e62 /test/unit/util.c
parente02b83cc5e3c4d30f93dba945162e3aa58d962d6 (diff)
parent09f8585ce8a57baa387cc0327e51c0baffbdce6f (diff)
downloadjemalloc-4.2.0.zip
jemalloc-4.2.0.tar.gz
jemalloc-4.2.0.tar.bz2
Merge branch 'dev'4.2.0
Diffstat (limited to 'test/unit/util.c')
-rw-r--r--test/unit/util.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/unit/util.c b/test/unit/util.c
index 2f65aad..c958dc0 100644
--- a/test/unit/util.c
+++ b/test/unit/util.c
@@ -4,27 +4,27 @@
unsigned i, pow2; \
t x; \
\
- assert_zu_eq(pow2_ceil_##suf(0), 0, "Unexpected result"); \
+ assert_##suf##_eq(pow2_ceil_##suf(0), 0, "Unexpected result"); \
\
for (i = 0; i < sizeof(t) * 8; i++) { \
- assert_zu_eq(pow2_ceil_##suf(((t)1) << i), ((t)1) << i, \
- "Unexpected result"); \
+ assert_##suf##_eq(pow2_ceil_##suf(((t)1) << i), ((t)1) \
+ << i, "Unexpected result"); \
} \
\
for (i = 2; i < sizeof(t) * 8; i++) { \
- assert_zu_eq(pow2_ceil_##suf((((t)1) << i) - 1), \
+ assert_##suf##_eq(pow2_ceil_##suf((((t)1) << i) - 1), \
((t)1) << i, "Unexpected result"); \
} \
\
for (i = 0; i < sizeof(t) * 8 - 1; i++) { \
- assert_zu_eq(pow2_ceil_##suf((((t)1) << i) + 1), \
+ assert_##suf##_eq(pow2_ceil_##suf((((t)1) << i) + 1), \
((t)1) << (i+1), "Unexpected result"); \
} \
\
for (pow2 = 1; pow2 < 25; pow2++) { \
for (x = (((t)1) << (pow2-1)) + 1; x <= ((t)1) << pow2; \
x++) { \
- assert_zu_eq(pow2_ceil_##suf(x), \
+ assert_##suf##_eq(pow2_ceil_##suf(x), \
((t)1) << pow2, \
"Unexpected result, x=%"pri, x); \
} \
@@ -160,14 +160,14 @@ TEST_BEGIN(test_malloc_snprintf_truncated)
{
#define BUFLEN 15
char buf[BUFLEN];
- int result;
+ size_t result;
size_t len;
-#define TEST(expected_str_untruncated, ...) do { \
+#define TEST(expected_str_untruncated, ...) do { \
result = malloc_snprintf(buf, len, __VA_ARGS__); \
assert_d_eq(strncmp(buf, expected_str_untruncated, len-1), 0, \
"Unexpected string inequality (\"%s\" vs \"%s\")", \
- buf, expected_str_untruncated); \
- assert_d_eq(result, strlen(expected_str_untruncated), \
+ buf, expected_str_untruncated); \
+ assert_zu_eq(result, strlen(expected_str_untruncated), \
"Unexpected result"); \
} while (0)
@@ -193,11 +193,11 @@ TEST_BEGIN(test_malloc_snprintf)
{
#define BUFLEN 128
char buf[BUFLEN];
- int result;
+ size_t result;
#define TEST(expected_str, ...) do { \
result = malloc_snprintf(buf, sizeof(buf), __VA_ARGS__); \
assert_str_eq(buf, expected_str, "Unexpected output"); \
- assert_d_eq(result, strlen(expected_str), "Unexpected result"); \
+ assert_zu_eq(result, strlen(expected_str), "Unexpected result");\
} while (0)
TEST("hello", "hello");