From: Elias Fleckenstein Date: Sun, 24 Apr 2022 15:01:42 +0000 (+0200) Subject: Use proper format for size_t printf X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=7d8cdeeb49fc6fa0b4b7ac9c3bb3e1fb27f4f0bf;p=dragonstd.git Use proper format for size_t printf --- diff --git a/test/test_array.c b/test/test_array.c index a6c8e19..db10964 100644 --- a/test/test_array.c +++ b/test/test_array.c @@ -47,10 +47,10 @@ int main() i = 2; array_put(&arr, &i, 1); i = 5; array_put(&arr, &i, arr.siz); - printf("testing siz: exp: 5 got: %lu\n", arr.siz); + printf("testing siz: exp: 5 got: %zu\n", arr.siz); assert(arr.siz == 5); - printf("testing cap: exp: 5 got: %lu\n", arr.cap); + printf("testing cap: exp: 5 got: %zu\n", arr.cap); assert(arr.cap == 5); printf("testing contents: exp: 1,2,3,4,5 got: "); dump(&arr); printf("\n"); @@ -73,44 +73,44 @@ int main() printf("testing ini after clr\n"); array_ini(&arr, sizeof(int), 5); - printf("testing cap: exp: 0 got: %lu\n", arr.cap); + printf("testing cap: exp: 0 got: %zu\n", arr.cap); assert(arr.cap == 0); printf("testing overallocation\n"); i = 50; array_apd(&arr, &i); - printf("testing cap: exp: 0 got: %lu\n", arr.cap); + printf("testing cap: exp: 0 got: %zu\n", arr.cap); assert(arr.siz == 1); - printf("testing cap: exp: 6 got: %lu\n", arr.cap); + printf("testing cap: exp: 6 got: %zu\n", arr.cap); assert(arr.cap == 6); for (int j = 0; j < 7; j++) { i = rand() % 100; array_apd(&arr, &i); } - printf("testing siz: exp: 8 got: %lu\n", arr.cap); + printf("testing siz: exp: 8 got: %zu\n", arr.cap); assert(arr.siz == 8); - printf("testing cap: exp: 12 got: %lu\n", arr.cap); + printf("testing cap: exp: 12 got: %zu\n", arr.cap); assert(arr.cap == 12); printf("testing grw\n"); array_grw(&arr, 5); - printf("testing siz: exp: 13 got: %lu\n", arr.cap); + printf("testing siz: exp: 13 got: %zu\n", arr.cap); assert(arr.siz == 13); - printf("testing cap: exp: 18 got: %lu\n", arr.cap); + printf("testing cap: exp: 18 got: %zu\n", arr.cap); assert(arr.cap == 18); printf("testing shr\n"); array_shr(&arr, 5); - printf("testing siz: exp: 8 got: %lu\n", arr.cap); + printf("testing siz: exp: 8 got: %zu\n", arr.cap); assert(arr.siz == 8); - printf("testing cap: exp: 8 got: %lu\n", arr.cap); + printf("testing cap: exp: 8 got: %zu\n", arr.cap); assert(arr.cap == 8); printf("testing srt\n"); @@ -123,12 +123,12 @@ int main() i = ((int *) arr.ptr)[j]; ssize_t s = array_fnd(&arr, &i, NULL, &cmp_int); - printf("testing fnd at index %lu: exp: >=0 got: %ld\n", j, s); + printf("testing fnd at index %zu: exp: >=0 got: %ld\n", j, s); assert(s >= 0); int k = ((int *) arr.ptr)[s]; - printf("testing fnd at index %lu: exp: %d got: %d\n", j, i, k); + printf("testing fnd at index %zu: exp: %d got: %d\n", j, i, k); assert(k == i); }