Joey's array module.
[ccan] / ccan / array / test / run.c
1 #include <stdio.h>
2 #include <tap/tap.h>
3 #include "array/array.h"
4
5 #define countof(array...) (sizeof(array)/sizeof(*(array)))
6 #include "lotsOfNumbers.h"
7
8 int main(void) {
9         Array(long) array = NewArray();
10         size_t i;
11         
12         plan_tests(3);
13         
14         {
15                 for (i=0; i<countof(lotsOfNumbers); i++)
16                         AAppend(array, lotsOfNumbers[i]);
17                 ok1(array.size == countof(lotsOfNumbers));
18                 ok1(array.allocSize >= array.size);
19                 ok1(!memcmp(array.item, lotsOfNumbers, sizeof(lotsOfNumbers)));
20         }
21         AFree(array);
22         AInit(array);
23         
24         return 0;
25 }