]> git.ozlabs.org Git - ccan/blob - ccan/hashtable/test/compile_ok-traverse.c
tap: don't _exit on success
[ccan] / ccan / hashtable / test / compile_ok-traverse.c
1 #include <ccan/hashtable/hashtable.h>
2 #include <ccan/hashtable/hashtable.c>
3
4 struct foo {
5         int i;
6 };
7
8 struct bar {
9         int i;
10 };
11
12 static bool fn_foo_bar(struct foo *foo, struct bar *bar)
13 {
14         return true;
15 }
16
17 static bool fn_const_foo_bar(const struct foo *foo, struct bar *bar)
18 {
19         return true;
20 }
21
22 static bool fn_foo_const_bar(struct foo *foo, const struct bar *bar)
23 {
24         return true;
25 }
26
27 static bool fn_const_foo_const_bar(const struct foo *foo,
28                                    const struct bar *bar)
29 {
30         return true;
31 }
32
33 static bool fn_void_void(void *foo, void *bar)
34 {
35         return true;
36 }
37
38 int main(void)
39 {
40         struct hashtable *ht = NULL;
41         struct bar *bar = NULL;
42
43         hashtable_traverse(ht, struct foo, fn_foo_bar, bar);
44         hashtable_traverse(ht, struct foo, fn_const_foo_bar, bar);
45         hashtable_traverse(ht, struct foo, fn_foo_const_bar, bar);
46         hashtable_traverse(ht, struct foo, fn_const_foo_const_bar, bar);
47         hashtable_traverse(ht, struct foo, fn_void_void, bar);
48         return 0;
49 }