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");
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");
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);
}