1 #include <ccan/invbloom/invbloom.h>
2 /* Include the C files directly. */
3 #include <ccan/invbloom/invbloom.c>
4 #include <ccan/tap/tap.h>
8 struct invbloom *ib1, *ib2;
9 const tal_t *ctx = tal(NULL, char);
10 int val = 1, val2 = 2, *ip;
12 /* This is how many tests you plan to run */
15 ib1 = invbloom_new(ctx, int, 1024, 0);
16 ib2 = invbloom_new(ctx, int, 1024, 0);
17 invbloom_insert(ib1, &val);
18 invbloom_insert(ib2, &val2);
20 invbloom_subtract(ib1, ib2);
22 ip = invbloom_extract(ctx, ib1);
24 ok1(tal_parent(ip) == ctx);
27 ip = invbloom_extract(ctx, ib1);
30 ip = invbloom_extract_negative(ctx, ib1);
32 ok1(tal_parent(ip) == ctx);
35 ip = invbloom_extract_negative(ctx, ib1);
40 /* This exits depending on whether all tests passed */