]> git.ozlabs.org Git - ccan/blobdiff - ccan/tcon/test/run-wrap.c
tcon: Add an alternate way of building type canaries
[ccan] / ccan / tcon / test / run-wrap.c
diff --git a/ccan/tcon/test/run-wrap.c b/ccan/tcon/test/run-wrap.c
new file mode 100644 (file)
index 0000000..0d5cfef
--- /dev/null
@@ -0,0 +1,18 @@
+#include <ccan/tcon/tcon.h>
+#include <ccan/tap/tap.h>
+#include <stdlib.h>
+
+typedef TCON_WRAP(int, char *canary) canaried_int;
+
+int main(int argc, char *argv[])
+{
+       canaried_int ci = TCON_WRAP_INIT(0);
+
+       plan_tests(2);
+
+       ok1(*tcon_unwrap(&ci) == 0);
+       *tcon_unwrap(&ci) = 17;
+       ok1(*tcon_unwrap(&ci) == 17);
+
+       return exit_status();
+}