From 9593fc545950782ed75f12f53238b07885559b2b Mon Sep 17 00:00:00 2001 From: William Casarin Date: Mon, 9 Jul 2018 22:28:25 -0700 Subject: remove ccan for now --- ccan/tal/test/run-destructor.c | 68 ------------------------------------------ 1 file changed, 68 deletions(-) delete mode 100644 ccan/tal/test/run-destructor.c (limited to 'ccan/tal/test/run-destructor.c') diff --git a/ccan/tal/test/run-destructor.c b/ccan/tal/test/run-destructor.c deleted file mode 100644 index 7183f7c..0000000 --- a/ccan/tal/test/run-destructor.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include -#include - -static char *parent, *child; -static int destroy_count; - -/* Parent gets destroyed first. */ -static void destroy_parent(char *p) -{ - ok1(p == parent); - ok1(destroy_count == 0); - /* Can still access child. */ - *child = '1'; - destroy_count++; -} - -static void destroy_child(char *p) -{ - ok1(p == child); - ok1(destroy_count == 1); - /* Can still access parent (though destructor has been called). */ - *parent = '1'; - destroy_count++; -} - -static void destroy_inc(char *p UNNEEDED) -{ - destroy_count++; -} - -int main(void) -{ - char *child2; - - plan_tests(18); - - destroy_count = 0; - parent = tal(NULL, char); - child = tal(parent, char); - ok1(tal_add_destructor(parent, destroy_parent)); - ok1(tal_add_destructor(child, destroy_child)); - tal_free(parent); - ok1(destroy_count == 2); - - destroy_count = 0; - parent = tal(NULL, char); - child = tal(parent, char); - ok1(tal_add_destructor(parent, destroy_parent)); - ok1(tal_add_destructor(child, destroy_child)); - ok1(tal_del_destructor(child, destroy_child)); - tal_free(parent); - ok1(destroy_count == 1); - - destroy_count = 0; - parent = tal(NULL, char); - child = tal(parent, char); - child2 = tal(parent, char); - ok1(tal_add_destructor(parent, destroy_inc)); - ok1(tal_add_destructor(parent, destroy_inc)); - ok1(tal_add_destructor(child, destroy_inc)); - ok1(tal_add_destructor(child2, destroy_inc)); - tal_free(parent); - ok1(destroy_count == 4); - - tal_cleanup(); - return exit_status(); -} -- cgit v1.2.3