1/***
2  This file is part of PulseAudio.
3
4  PulseAudio is free software; you can redistribute it and/or modify
5  it under the terms of the GNU Lesser General Public License as published
6  by the Free Software Foundation; either version 2.1 of the License,
7  or (at your option) any later version.
8
9  PulseAudio is distributed in the hope that it will be useful, but
10  WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  General Public License for more details.
13
14  You should have received a copy of the GNU Lesser General Public License
15  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
16***/
17
18#ifdef HAVE_CONFIG_H
19#include <config.h>
20#endif
21
22#include <stdio.h>
23
24#include <check.h>
25
26#include <pulse/proplist.h>
27#include <pulse/xmalloc.h>
28#include <pulsecore/macro.h>
29#include <pulsecore/core-util.h>
30#include <pulsecore/modargs.h>
31
32START_TEST (proplist_modargs_test) {
33    pa_modargs *ma;
34    pa_proplist *a;
35    char *v;
36    const char *x[] = { "foo", NULL };
37
38    ma = pa_modargs_new("foo='foobar=waldo foo2=\"lj\\\"dhflh\" foo3=\"kjlskj\\'\"'", x);
39    fail_unless(ma != NULL);
40    a = pa_proplist_new();
41    fail_unless(a != NULL);
42
43    fail_unless(pa_modargs_get_proplist(ma, "foo", a, PA_UPDATE_REPLACE) >= 0);
44
45    pa_log_debug("%s", v = pa_proplist_to_string(a));
46    pa_xfree(v);
47
48    pa_proplist_free(a);
49    pa_modargs_free(ma);
50}
51END_TEST
52
53int main(int argc, char *argv[]) {
54    int failed = 0;
55    Suite *s;
56    TCase *tc;
57    SRunner *sr;
58
59    if (!getenv("MAKE_CHECK"))
60        pa_log_set_level(PA_LOG_DEBUG);
61
62    s = suite_create("Property List");
63    tc = tcase_create("propertylist");
64    tcase_add_test(tc, proplist_modargs_test);
65    suite_add_tcase(s, tc);
66
67    sr = srunner_create(s);
68    srunner_run_all(sr, CK_NORMAL);
69    failed = srunner_ntests_failed(sr);
70    srunner_free(sr);
71
72    return (failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
73}
74