]>
git.proxmox.com Git - mirror_qemu.git/blob - tests/check-qlit.c
d2422bbaf078853f4790af78638d7653502d82ce
4 * Copyright (C) 2017 Red Hat Inc.
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
10 #include "qemu/osdep.h"
12 #include "qapi/qmp/qbool.h"
13 #include "qapi/qmp/qdict.h"
14 #include "qapi/qmp/qlit.h"
15 #include "qapi/qmp/qnum.h"
16 #include "qapi/qmp/qstring.h"
18 static QLitObject qlit
= QLIT_QDICT(((QLitDictEntry
[]) {
19 { "foo", QLIT_QNUM(42) },
20 { "bar", QLIT_QSTR("hello world") },
21 { "baz", QLIT_QNULL
},
22 { "bee", QLIT_QLIST(((QLitObject
[]) {
31 static QObject
*make_qobject(void)
33 QDict
*qdict
= qdict_new();
34 QList
*list
= qlist_new();
36 qdict_put_int(qdict
, "foo", 42);
37 qdict_put_str(qdict
, "bar", "hello world");
38 qdict_put_null(qdict
, "baz");
40 qlist_append_int(list
, 43);
41 qlist_append_int(list
, 44);
42 qlist_append_bool(list
, true);
43 qdict_put(qdict
, "bee", list
);
45 return QOBJECT(qdict
);
48 static void qlit_equal_qobject_test(void)
50 QObject
*qobj
= make_qobject();
52 g_assert(qlit_equal_qobject(&qlit
, qobj
));
57 int main(int argc
, char **argv
)
59 g_test_init(&argc
, &argv
, NULL
);
61 g_test_add_func("/qlit/equal_qobject", qlit_equal_qobject_test
);