compiler: RETURNS_NONNULL macro
[ccan] / ccan / tal / test / run-resizez.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         char *parent, *c;
8         int i;
9
10         plan_tests(1 + 3 * 100 + 98);
11
12         parent = tal(NULL, char);
13         ok1(parent);
14
15         for (i = 0; i < 100; i++) {
16                 c = tal_arr(parent, char, 1);
17                 ok1(tal_resizez(&c, i));
18                 ok1(tal_count(c) == i);
19                 ok1(tal_parent(c) == parent);
20                 if (i > 1)
21                         ok1(c[i-1] == '\0');
22         }
23         tal_free(parent);
24
25         tal_cleanup();
26         return exit_status();
27 }