]> git.ozlabs.org Git - ccan/blob - container_of/test/run.c
Include all the tools under ccan_tools dir, hacked to work for me.
[ccan] / container_of / test / run.c
1 #include "container_of/container_of.h"
2 #include "tap.h"
3
4 struct foo {
5         int a;
6         char b;
7 };
8
9 int main(int argc, char *argv[])
10 {
11         struct foo foo = { .a = 1, .b = 2 };
12         int *intp = &foo.a;
13         char *charp = &foo.b;
14
15         plan_tests(2);
16         ok1(container_of(intp, struct foo, a) == &foo);
17         ok1(container_of(charp, struct foo, b) == &foo);
18         return exit_status();
19 }