1 #include <ccan/cdump/cdump.h>
2 /* Include the C files directly. */
3 #include <ccan/cdump/cdump.c>
4 #include <ccan/tap/tap.h>
10 unsigned u = 0xdeadbeef;
15 struct cdump_string *s;
17 /* This is how many tests you plan to run */
20 s = talloc(NULL, struct cdump_string);
24 ok1(cdump_bundle_char(s, &c, 0));
25 ok1(strcmp(s->s, "65") == 0);
26 ok1(s->length == strlen(s->s));
27 ok1(cdump_unbundle_char(NULL, &c, s->s));
32 ok1(cdump_bundle_unsigned_char(s, &uc, 0));
33 ok1(strcmp(s->s, "66") == 0);
34 ok1(s->length == strlen(s->s));
35 ok1(cdump_unbundle_unsigned_char(NULL, &uc, s->s));
40 ok1(cdump_bundle_int(s, &i, 0));
41 ok1(strcmp(s->s, "-54") == 0);
42 ok1(s->length == strlen(s->s));
43 ok1(cdump_unbundle_int(NULL, &i, s->s));
48 ok1(cdump_bundle_unsigned(s, &u, 0));
49 ok1(strcmp(s->s, "3735928559") == 0);
50 ok1(s->length == strlen(s->s));
51 ok1(cdump_unbundle_unsigned(NULL, &u, s->s));
56 ok1(cdump_bundle_time_t(s, &t, 0));
57 ok1(strcmp(s->s, "1000000") == 0);
58 ok1(s->length == strlen(s->s));
59 ok1(cdump_unbundle_time_t(NULL, &t, s->s));
64 ok1(cdump_bundle_double(s, &d, 0));
65 ok1(strcmp(s->s, "3") == 0);
66 ok1(s->length == strlen(s->s));
67 ok1(cdump_unbundle_double(NULL, &d, s->s));
72 ok1(cdump_bundle_float(s, &f, 0));
73 ok1(strcmp(s->s, "2") == 0);
74 ok1(s->length == strlen(s->s));
75 ok1(cdump_unbundle_float(NULL, &f, s->s));
80 /* Everything should have been allocated off this, so no leaks. */
83 /* This exits depending on whether all tests passed */