From 733d7601d7f75b70bb0bf3315c5a282a7d699b67 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 10 Sep 2021 20:11:28 -0400 Subject: Be explicit about the sign of defined integer constants --- test/bitset_test.c | 2 +- test/ring_test.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/bitset_test.c b/test/bitset_test.c index dda59d3..27f1d2d 100644 --- a/test/bitset_test.c +++ b/test/bitset_test.c @@ -21,7 +21,7 @@ #include #include -#define N_BITS 256 +#define N_BITS 256u #define N_ELEMS (ZIX_BITSET_ELEMS(N_BITS)) #define MIN(a, b) (((a) < (b)) ? (a) : (b)) diff --git a/test/ring_test.c b/test/ring_test.c index 7616346..c11d998 100644 --- a/test/ring_test.c +++ b/test/ring_test.c @@ -25,7 +25,7 @@ #include #include -#define MSG_SIZE 20 +#define MSG_SIZE 20u static ZixRing* ring = 0; static unsigned n_writes = 0; @@ -46,7 +46,7 @@ failure(const char* fmt, ...) static int gen_msg(int* msg, int start) { - for (int i = 0; i < MSG_SIZE; ++i) { + for (unsigned i = 0u; i < MSG_SIZE; ++i) { msg[i] = start; start = (start + 1) % INT_MAX; } @@ -56,9 +56,9 @@ gen_msg(int* msg, int start) static int cmp_msg(int* msg1, int* msg2) { - for (int i = 0; i < MSG_SIZE; ++i) { + for (unsigned i = 0u; i < MSG_SIZE; ++i) { if (msg1[i] != msg2[i]) { - return !failure("%d != %d @ %d\n", msg1[i], msg2[i], i); + return !failure("%d != %d @ %u\n", msg1[i], msg2[i], i); } } @@ -131,7 +131,7 @@ main(int argc, char** argv) zix_ring_free(NULL); - printf("Testing %u writes of %d ints to a %u int ring...\n", + printf("Testing %u writes of %u ints to a %u int ring...\n", n_writes, MSG_SIZE, size); -- cgit v1.2.1