#include <ccan/tal/str/str.h>
#include <ccan/tal/str/str.c>
#include <ccan/tap/tap.h>
+#include "helper.h"
int main(void)
{
ok1(tal_parent(c) == parent);
tal_free(c);
+#ifdef TAL_USE_TALLOC
+ c = tal_talloc_typechk_(parent, char *);
+#else
c = tal_typechk_(parent, char *);
- c = tal_dup(parent, char, "hello", 6, 0);
+#endif
+ c = tal_dup_arr(parent, char, "hello", 6, 0);
ok1(strcmp(c, "hello") == 0);
ok1(strcmp(tal_name(c), "char[]") == 0);
ok1(tal_parent(c) == parent);
tal_free(c);
/* Now with an extra byte. */
- c = tal_dup(parent, char, "hello", 6, 1);
+ c = tal_dup_arr(parent, char, "hello", 6, 1);
ok1(strcmp(c, "hello") == 0);
ok1(strcmp(tal_name(c), "char[]") == 0);
ok1(tal_parent(c) == parent);
c = tal_strcat(parent, take(c), " again");
ok1(strcmp(c, "hello there again") == 0);
ok1(tal_parent(c) == parent);
- ok1(tal_first(parent) == c && !tal_next(parent, c));
+ ok1(single_child(parent, c));
c = tal_strcat(parent, "And ", take(c));
ok1(strcmp(c, "And hello there again") == 0);
ok1(tal_parent(c) == parent);
- ok1(tal_first(parent) == c && !tal_next(parent, c));
+ ok1(single_child(parent, c));
/* NULL pass through works... */
c = tal_strcat(parent, take(NULL), take(c));
ok1(!c);
- ok1(!tal_first(parent));
+ ok1(no_children(parent));
c = tal_strcat(parent, take(tal_strdup(parent, "hi")),
take(NULL));
ok1(!c);
- ok1(!tal_first(parent));
+ ok1(no_children(parent));
c = tal_strcat(parent, take(NULL), take(NULL));
ok1(!c);
- ok1(!tal_first(parent));
+ ok1(no_children(parent));
/* Appending formatted strings. */
c = tal_strdup(parent, "hi");