summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2021-09-10 20:11:28 -0400
committerDavid Robillard <d@drobilla.net>2021-09-10 20:11:28 -0400
commit733d7601d7f75b70bb0bf3315c5a282a7d699b67 (patch)
tree08631b160906f413866655be0327341d451d5a2b /test
parentb45b6b442f0e3f821921a48f957944f485adfd1b (diff)
downloadzix-733d7601d7f75b70bb0bf3315c5a282a7d699b67.tar.gz
zix-733d7601d7f75b70bb0bf3315c5a282a7d699b67.tar.bz2
zix-733d7601d7f75b70bb0bf3315c5a282a7d699b67.zip
Be explicit about the sign of defined integer constants
Diffstat (limited to 'test')
-rw-r--r--test/bitset_test.c2
-rw-r--r--test/ring_test.c10
2 files changed, 6 insertions, 6 deletions
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 <stdarg.h>
#include <stdio.h>
-#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 <stdio.h>
#include <stdlib.h>
-#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);