3 #include <ccan/array_size/array_size.h>
5 #include <ccan/ptrint/ptrint.h>
6 #include <ccan/tap/tap.h>
8 static ptrdiff_t testvals[] = {
9 -INT_MAX, -1, 0, 1, 2, 17, INT_MAX,
16 /* This is how many tests you plan to run */
17 plan_tests(2 * ARRAY_SIZE(testvals));
19 for (i = 0; i < ARRAY_SIZE(testvals); i++) {
20 ptrdiff_t val = testvals[i];
21 void *ptr = int2ptr(val);
23 ok1(ptr2int(ptr) == val);
27 /* This exits depending on whether all tests passed */