From 01b2ffcedd94ad7b42bc870e4c6936c87ad03429 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Wed, 7 Jun 2017 20:35:58 +0400 Subject: qapi: merge QInt and QFloat in QNum MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Message-Id: <20170607163635.17635-7-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster [parse_stats_intervals() simplified a bit, comment in test_visitor_in_int_overflow() tidied up, suppress bogus warnings] Signed-off-by: Markus Armbruster --- tests/test-qmp-commands.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'tests/test-qmp-commands.c') 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); -- cgit v1.2.3-59-g8ed1b