1 #include <ccan/tap/tap.h>
2 #include <ccan/opt/opt.c>
3 #include <ccan/opt/usage.c>
4 #include <ccan/opt/helpers.c>
5 #include <ccan/opt/parse.c>
7 /* Test consume_words helper. */
8 int main(int argc, char *argv[])
14 /* Every line over width. */
15 len = consume_words("hello world", 1, &start);
17 ok1(len == strlen("hello"));
18 len = consume_words(" world", 1, &start);
20 ok1(len == strlen("world"));
21 ok1(consume_words("", 1, &start) == 0);
23 /* Same with width where won't both fit. */
24 len = consume_words("hello world", 5, &start);
26 ok1(len == strlen("hello"));
27 len = consume_words(" world", 5, &start);
29 ok1(len == strlen("world"));
30 ok1(consume_words("", 5, &start) == 0);
32 len = consume_words("hello world", 11, &start);
34 ok1(len == strlen("hello world"));
35 ok1(consume_words("", 11, &start) == 0);