aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qmp-commands.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-06-07 20:35:58 +0400
committerMarkus Armbruster <armbru@redhat.com>2017-06-20 14:31:31 +0200
commit01b2ffcedd94ad7b42bc870e4c6936c87ad03429 (patch)
tree39bbadfbbaa229bfbda245840a256fe0132b2390 /tests/test-qmp-commands.c
parent58634047b7deeab36e4b07c4744e44d698975561 (diff)
qapi: merge QInt and QFloat in QNum
We would like to use a same QObject type to represent numbers, whether they are int, uint, or floats. Getters will allow some compatibility between the various types if the number fits other representations. Add a few more tests while at it. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20170607163635.17635-7-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [parse_stats_intervals() simplified a bit, comment in test_visitor_in_int_overflow() tidied up, suppress bogus warnings] Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-qmp-commands.c')
-rw-r--r--tests/test-qmp-commands.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/tests/test-qmp-commands.c b/tests/test-qmp-commands.c
index acdded4d67..904c89d4d4 100644
--- a/tests/test-qmp-commands.c
+++ b/tests/test-qmp-commands.c
@@ -162,7 +162,8 @@ static void test_dispatch_cmd_io(void)
QDict *ud1b = qdict_new();
QDict *ret, *ret_dict, *ret_dict_dict, *ret_dict_dict_userdef;
QDict *ret_dict_dict2, *ret_dict_dict2_userdef;
- QInt *ret3;
+ QNum *ret3;
+ int64_t val;
qdict_put_int(ud1a, "integer", 42);
qdict_put_str(ud1a, "string", "hello");
@@ -194,8 +195,9 @@ static void test_dispatch_cmd_io(void)
qdict_put(req, "arguments", args3);
qdict_put_str(req, "execute", "guest-get-time");
- ret3 = qobject_to_qint(test_qmp_dispatch(req));
- assert(qint_get_int(ret3) == 66);
+ ret3 = qobject_to_qnum(test_qmp_dispatch(req));
+ g_assert(qnum_get_try_int(ret3, &val));
+ g_assert_cmpint(val, ==, 66);
QDECREF(ret3);
QDECREF(req);