blob: 9f2b13e2634914231c3e2ff721da30ba171b070c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include <ccan/strset/strset.h>
#include <ccan/strset/strset.c>
#include <ccan/tap/tap.h>
static bool found = false;
/* Make sure const args work. */
static bool find_string(const char *str, const char *cmp)
{
if (strcmp(str, cmp) == 0)
found = true;
return true;
}
int main(void)
{
struct strset set;
plan_tests(3);
strset_init(&set);
ok1(strset_add(&set, "hello"));
ok1(strset_add(&set, "world"));
strset_iterate(&set, find_string, (const char *)"hello");
ok1(found);
strset_clear(&set);
/* This exits depending on whether all tests passed */
return exit_status();
}
|