]> code.delx.au - pulseaudio/blob - src/tests/strlist-test.c
415c94e6afa4d715bc2cfbf35057dbc0b4cb0f5f
[pulseaudio] / src / tests / strlist-test.c
1 #include <stdio.h>
2
3 #include <polyp/xmalloc.h>
4 #include <polypcore/strlist.h>
5 #include <polypcore/gccmacro.h>
6
7 int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
8 char *t, *u;
9 pa_strlist *l = NULL;
10
11 l = pa_strlist_prepend(l, "e");
12 l = pa_strlist_prepend(l, "d");
13 l = pa_strlist_prepend(l, "c");
14 l = pa_strlist_prepend(l, "b");
15 l = pa_strlist_prepend(l, "a");
16
17 t = pa_strlist_tostring(l);
18 pa_strlist_free(l);
19
20 fprintf(stderr, "1: %s\n", t);
21
22 l = pa_strlist_parse(t);
23 pa_xfree(t);
24
25 t = pa_strlist_tostring(l);
26 fprintf(stderr, "2: %s\n", t);
27 pa_xfree(t);
28
29 l = pa_strlist_pop(l, &u);
30 fprintf(stderr, "3: %s\n", u);
31 pa_xfree(u);
32
33 l = pa_strlist_remove(l, "c");
34
35 t = pa_strlist_tostring(l);
36 fprintf(stderr, "4: %s\n", t);
37 pa_xfree(t);
38
39 pa_strlist_free(l);
40
41 return 0;
42 }