compiler: RETURNS_NONNULL macro
[ccan] / ccan / tal / test / run-expand.c
1 #include <ccan/tal/tal.h>
2 #include <ccan/tal/tal.c>
3 #include <ccan/tap/tap.h>
4
5 int main(void)
6 {
7         int *a;
8         const int arr[] = { 1, 2 };
9
10         plan_tests(13);
11
12         a = tal_arrz(NULL, int, 1);
13         ok1(a);
14
15         ok1(tal_expand(&a, arr, 2));
16         ok1(tal_count(a) == 3);
17         ok1(a[0] == 0);
18         ok1(a[1] == 1);
19         ok1(a[2] == 2);
20
21         ok1(tal_expand(&a, take(tal_arrz(NULL, int, 1)), 1));
22         ok1(tal_count(a) == 4);
23         ok1(a[0] == 0);
24         ok1(a[1] == 1);
25         ok1(a[2] == 2);
26         ok1(a[3] == 0);
27         ok1(tal_first(NULL) == a && !tal_next(a) && !tal_first(a));
28
29         tal_free(a);
30
31         tal_cleanup();
32         return exit_status();
33 }