1 #include <ccan/cdump/cdump.h>
2 /* Include the C files directly. */
3 #include <ccan/cdump/cdump.c>
4 #include <ccan/tap/tap.h>
8 struct cdump_definitions *defs;
9 const struct cdump_type *t;
12 /* This is how many tests you plan to run */
15 defs = cdump_extract(NULL, "enum foo { BAR, BAZ, };", &problems);
19 ok1(strmap_empty(&defs->structs));
20 ok1(strmap_empty(&defs->unions));
21 t = strmap_get(&defs->enums, "foo");
23 ok1(t->kind == CDUMP_ENUM);
24 ok1(streq(t->name, "foo"));
25 ok1(tal_count(t->u.enum_vals) == 2);
26 ok1(streq(t->u.enum_vals[0].name, "BAR"));
27 ok1(!t->u.enum_vals[0].value);
28 ok1(streq(t->u.enum_vals[1].name, "BAZ"));
29 ok1(!t->u.enum_vals[1].value);
32 /* This exits depending on whether all tests passed */