3 #include <ccan/coroutine/coroutine.h>
4 #include <ccan/tap/tap.h>
8 static void trivial_fn(void *p)
10 struct coroutine_state *ret = (struct coroutine_state *)p;
17 static void test_trivial(struct coroutine_stack *stack)
19 struct coroutine_state t, master;
21 if (!COROUTINE_AVAILABLE) {
22 skip(1, "Coroutines not available");
26 coroutine_init(&t, trivial_fn, &master, stack);
27 coroutine_switch(&master, &t);
35 char buf[COROUTINE_MIN_STKSZ + COROUTINE_STK_OVERHEAD];
36 struct coroutine_stack *stack;
38 /* This is how many tests you plan to run */
41 stack = coroutine_stack_init(buf, sizeof(buf), 0);
43 ok1(coroutine_stack_check(stack, NULL) == stack);
44 ok1(coroutine_stack_size(stack) == COROUTINE_MIN_STKSZ);
48 coroutine_stack_release(stack, 0);
50 /* This exits depending on whether all tests passed */