1 #include <ccan/tal/tal.h>
2 #include <ccan/tal/tal.c>
3 #include <ccan/tap/tap.h>
11 parent = tal(NULL, char);
14 c = tal_strdup(parent, "hello");
15 ok1(strcmp(c, "hello") == 0);
16 ok1(tal_parent(c) == parent);
18 c = tal_strndup(parent, "hello", 3);
19 ok1(strcmp(c, "hel") == 0);
20 ok1(tal_parent(c) == parent);
22 c = tal_memdup(parent, "hello", 6);
23 ok1(strcmp(c, "hello") == 0);
24 ok1(tal_parent(c) == parent);
26 c = tal_asprintf(parent, "hello %s", "there");
27 ok1(strcmp(c, "hello there") == 0);
28 ok1(tal_parent(c) == parent);