1 #include <ccan/autodata/autodata.h>
2 /* Include the C files directly. */
3 #include <ccan/autodata/autodata.c>
4 #include <ccan/tap/tap.h>
6 AUTODATA_TYPE(autostrings, char);
8 AUTODATA(autostrings, "genuine");
10 #if !HAVE_SECTION_START_STOP
11 /* These are all fake, to test the various failure paths. */
12 /* Hopefully fake_alpha or fake_omega will test run-past-end. */
13 static const void *NEEDED fake_alpha[] = { (void *)AUTODATA_MAGIC };
15 /* Wrong magic in the middle. */
16 static const void *NEEDED fake1[] = { (void *)(AUTODATA_MAGIC ^ 0x10000),
19 (void *)"autostrings" };
21 /* Wrong self pointer. */
22 static const void *NEEDED fake2[] = { (void *)AUTODATA_MAGIC,
25 (void *)"autostrings" };
28 static const void *NEEDED fake3[] = { (void *)AUTODATA_MAGIC,
31 (void *)"autostrings2" };
33 /* Invalid self-pointer. */
34 static const void *NEEDED fake4[] = { (void *)AUTODATA_MAGIC,
37 (void *)"autostrings" };
39 /* Invalid name pointer */
40 static const void *NEEDED fake5[] = { (void *)AUTODATA_MAGIC,
45 /* Invalid contents pointer */
46 static const void *NEEDED fake6[] = { (void *)AUTODATA_MAGIC,
49 (void *)"autostrings" };
51 static const void *NEEDED fake_omega[] = { (void *)AUTODATA_MAGIC };
59 /* This is how many tests you plan to run */
62 table = autodata_get(autostrings, &num);
64 ok1((!strcmp(table[0], "genuine") && !strcmp(table[1], "helper"))
65 || (!strcmp(table[1], "genuine") && !strcmp(table[0], "helper")));
69 /* This exits depending on whether all tests passed */