summaryrefslogtreecommitdiffstats
path: root/src/tests/strlist-test.c
blob: 2bd1645c0436bca7c30358794b06ca5817ea744f (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
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>

#include <pulse/xmalloc.h>
#include <pulse/gccmacro.h>

#include <pulsecore/strlist.h>

int main(PA_GCC_UNUSED int argc, PA_GCC_UNUSED char* argv[]) {
    char *t, *u;
    pa_strlist *l = NULL;

    l = pa_strlist_prepend(l, "e");
    l = pa_strlist_prepend(l, "d");
    l = pa_strlist_prepend(l, "c");
    l = pa_strlist_prepend(l, "b");
    l = pa_strlist_prepend(l, "a");

    t = pa_strlist_tostring(l);
    pa_strlist_free(l);

    fprintf(stderr, "1: %s\n", t);

    l = pa_strlist_parse(t);
    pa_xfree(t);

    t = pa_strlist_tostring(l);
    fprintf(stderr, "2: %s\n", t);
    pa_xfree(t);

    l = pa_strlist_pop(l, &u);
    fprintf(stderr, "3: %s\n", u);
    pa_xfree(u);

    l = pa_strlist_remove(l, "c");

    t = pa_strlist_tostring(l);
    fprintf(stderr, "4: %s\n", t);
    pa_xfree(t);

    pa_strlist_free(l);

    return 0;
}