]> git.ozlabs.org Git - ccan/blobdiff - container_of/test/run.c
New variant of container_of: container_of_var, for list.h
[ccan] / container_of / test / run.c
index dab462bc4a5bf1541eddb9267caf252339757f20..d08b06a667d17dbee81725e579c238a501396956 100644 (file)
@@ -1,5 +1,5 @@
 #include "container_of/container_of.h"
-#include "tap/tap.h"
+#include "tap.h"
 
 struct foo {
        int a;
@@ -12,8 +12,10 @@ int main(int argc, char *argv[])
        int *intp = &foo.a;
        char *charp = &foo.b;
 
-       plan_tests(2);
+       plan_tests(4);
        ok1(container_of(intp, struct foo, a) == &foo);
        ok1(container_of(charp, struct foo, b) == &foo);
+       ok1(container_of_var(intp, &foo, a) == &foo);
+       ok1(container_of_var(charp, &foo, b) == &foo);
        return exit_status();
 }