diff options
author | Markus Armbruster <armbru@redhat.com> | 2017-02-17 21:38:22 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2017-02-22 19:52:11 +0100 |
commit | 8978b34af3250354e0b67340a7e920f909beda13 (patch) | |
tree | 75069682843ff04004f7b11c76607e961be1e510 /tests/test-qobject-output-visitor.c | |
parent | 0abfc4b885566eb41c3a4e1de5e2e105bdc062d9 (diff) | |
download | qemu-8978b34af3250354e0b67340a7e920f909beda13.zip qemu-8978b34af3250354e0b67340a7e920f909beda13.tar.gz qemu-8978b34af3250354e0b67340a7e920f909beda13.tar.bz2 |
tests: Don't check qobject_type() before qobject_to_qfloat()
qobject_to_qfloat(obj) returns NULL when obj isn't a QFloat. Check
that instead of qobject_type(obj) == QTYPE_QFLOAT.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1487363905-9480-12-git-send-email-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'tests/test-qobject-output-visitor.c')
-rw-r--r-- | tests/test-qobject-output-visitor.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c index 50b807e..5617fd3 100644 --- a/tests/test-qobject-output-visitor.c +++ b/tests/test-qobject-output-visitor.c @@ -84,13 +84,13 @@ static void test_visitor_out_number(TestOutputVisitorData *data, const void *unused) { double value = 3.14; - QObject *obj; + QFloat *qfloat; visit_type_number(data->ov, NULL, &value, &error_abort); - obj = visitor_get(data); - g_assert(qobject_type(obj) == QTYPE_QFLOAT); - g_assert(qfloat_get_double(qobject_to_qfloat(obj)) == value); + qfloat = qobject_to_qfloat(visitor_get(data)); + g_assert(qfloat); + g_assert(qfloat_get_double(qfloat) == value); } static void test_visitor_out_string(TestOutputVisitorData *data, |