]> git.ozlabs.org Git - ccan/blobdiff - ccan/structeq/test/run.c
structeq: new module.
[ccan] / ccan / structeq / test / run.c
diff --git a/ccan/structeq/test/run.c b/ccan/structeq/test/run.c
new file mode 100644 (file)
index 0000000..9ecb4b7
--- /dev/null
@@ -0,0 +1,27 @@
+#include <ccan/structeq/structeq.h>
+#include <ccan/tap/tap.h>
+
+struct mydata {
+       int start, end;
+};
+
+int main(void)
+{
+       struct mydata a, b;
+
+       /* This is how many tests you plan to run */
+       plan_tests(3);
+
+       a.start = 0;
+       a.end = 100;
+       ok1(structeq(&a, &a));
+
+       b = a;
+       ok1(structeq(&a, &b));
+
+       b.end++;
+       ok1(!structeq(&a, &b));
+
+       /* This exits depending on whether all tests passed */
+       return exit_status();
+}