1 #include <ccan/tal/tal.h>
2 #include <ccan/tal/tal.c>
3 #include <ccan/tap/tap.h>
12 p[0] = tal(NULL, char);
13 for (i = 1; i < 5; i++)
14 p[i] = tal(p[i-1], char);
16 tal_check(NULL, "check");
17 /* Steal node with no children. */
18 ok1(tal_steal(p[0], p[4]) == p[4]);
19 tal_check(NULL, "check");
21 ok1(tal_steal(p[0], p[4]) == p[4]);
22 tal_check(NULL, "check");
23 /* Steal with children. */
24 ok1(tal_steal(p[0], p[1]) == p[1]);
25 tal_check(NULL, "check");
27 ok1(tal_steal(p[0], p[1]) == p[1]);
28 tal_check(NULL, "check");
29 /* Steal from direct child. */
30 ok1(tal_steal(p[0], p[2]) == p[2]);
31 tal_check(NULL, "check");
33 ok1(tal_parent(p[1]) == p[0]);
34 ok1(tal_parent(p[2]) == p[0]);
35 ok1(tal_parent(p[3]) == p[2]);
36 ok1(tal_parent(p[4]) == p[0]);