From 3c7169fcf531b807cfe276e43fabe2cf65a33a91 Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Sat, 5 Jun 2021 14:47:24 +0200 Subject: [PATCH] Change formatter for size_t from %d to %zu in tests --- tests/base32.c | 6 +++--- tests/base64.c | 6 +++--- tests/dns.c | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/base32.c b/tests/base32.c index 96ba9a4..5e83b90 100644 --- a/tests/base32.c +++ b/tests/base32.c @@ -103,8 +103,8 @@ START_TEST(test_base32_blksize) val = base32_ops.encode(encbuf, &enclen, rawbuf, rawlen); - ck_assert_msg(rawlen == 5, "raw length was %d not 5", rawlen); - ck_assert_msg(enclen == 5, "encoded %d bytes, not 5", enclen); + ck_assert_msg(rawlen == 5, "raw length was %zu not 5", rawlen); + ck_assert_msg(enclen == 5, "encoded %zu bytes, not 5", enclen); ck_assert_msg(val == 8, "encoded string %s was length %d", encbuf, val); memset(rawbuf, 0, rawlen + 16); @@ -112,7 +112,7 @@ START_TEST(test_base32_blksize) enclen = val; val = base32_ops.decode(rawbuf, &rawlen, encbuf, enclen); - ck_assert_msg(rawlen == 5, "raw length was %d not 5", rawlen); + ck_assert_msg(rawlen == 5, "raw length was %zu not 5", rawlen); ck_assert_msg(val == 5, "val was not 5 but %d", val); for (i = 0; i < rawlen; i++) { ck_assert(rawbuf[i] == 'A'); diff --git a/tests/base64.c b/tests/base64.c index 327fd29..63aad42 100644 --- a/tests/base64.c +++ b/tests/base64.c @@ -116,8 +116,8 @@ START_TEST(test_base64_blksize) val = base64_ops.encode(encbuf, &enclen, rawbuf, rawlen); - ck_assert_msg(rawlen == 3, "raw length was %d not 3", rawlen); - ck_assert_msg(enclen == 3, "encoded %d bytes, not 3", enclen); + ck_assert_msg(rawlen == 3, "raw length was %zu not 3", rawlen); + ck_assert_msg(enclen == 3, "encoded %zu bytes, not 3", enclen); ck_assert_msg(val == 4, "encoded string %s was length %d", encbuf, val); memset(rawbuf, 0, rawlen + 16); @@ -125,7 +125,7 @@ START_TEST(test_base64_blksize) enclen = val; val = base64_ops.decode(rawbuf, &rawlen, encbuf, enclen); - ck_assert_msg(rawlen == 3, "raw length was %d not 3", rawlen); + ck_assert_msg(rawlen == 3, "raw length was %zu not 3", rawlen); ck_assert(val == 3); for (i = 0; i < rawlen; i++) { ck_assert(rawbuf[i] == 'A'); diff --git a/tests/dns.c b/tests/dns.c index 50bbad4..7127a15 100644 --- a/tests/dns.c +++ b/tests/dns.c @@ -103,7 +103,7 @@ START_TEST(test_encode_query) ck_assert_msg(strncmp(query_packet, buf, sizeof(query_packet)) == 0, "Did not compile expected packet"); ck_assert_msg(ret == len, - "Bad packet length: %d, expected %d", ret, len); + "Bad packet length: %d, expected %zu", ret, len); } END_TEST @@ -129,7 +129,7 @@ START_TEST(test_decode_query) ck_assert_msg(strncmp(buf, innerData, strlen(innerData)) == 0, "Did not extract expected host: '%s'", buf); ck_assert_msg(strlen(buf) == strlen(innerData), - "Bad host length: %d, expected %d: '%s'", + "Bad host length: %zu, expected %zu: '%s'", strlen(buf), strlen(innerData), buf); } END_TEST @@ -171,7 +171,7 @@ START_TEST(test_decode_response) ret = dns_decode(buf, len, &q, QR_ANSWER, answer_packet, sizeof(answer_packet)-1); ck_assert_msg(ret == strlen(msgData), - "Bad data length: %d, expected %d", ret, strlen(msgData)); + "Bad data length: %d, expected %zu", ret, strlen(msgData)); ck_assert_msg(strncmp(msgData, buf, strlen(msgData)) == 0, "Did not extract expected data"); ck_assert(q.id == 0x0539); @@ -190,7 +190,7 @@ START_TEST(test_decode_response_with_high_trans_id) ret = dns_decode(buf, len, &q, QR_ANSWER, answer_packet_high_trans_id, sizeof(answer_packet_high_trans_id)-1); ck_assert_msg(ret == strlen(msgData), - "Bad data length: %d, expected %d", ret, strlen(msgData)); + "Bad data length: %d, expected %zu", ret, strlen(msgData)); ck_assert_msg(strncmp(msgData, buf, strlen(msgData)) == 0, "Did not extract expected data"); ck_assert_msg(q.id == 0x8539,