[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit()
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit() |
Date: |
Wed, 13 Sep 2017 08:51:28 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 |
On 09/11/2017 06:05 AM, Marc-André Lureau wrote:
> Instanciate a QObject* form a literal QLitObject.
s/Instanciate/Instantiate/
s/form/from/
>
> Signed-off-by: Marc-André Lureau <address@hidden>
> ---
> include/qapi/qmp/qlit.h | 2 ++
> qobject/qlit.c | 36 ++++++++++++++++++++++++++++++++++++
> tests/check-qlit.c | 26 ++++++++++++++++++++++++++
> 3 files changed, 64 insertions(+)
> +QObject *qobject_from_qlit(const QLitObject *qlit)
> +{
> + switch (qlit->type) {
> + case QTYPE_QNULL:
> + return QOBJECT(qnull());
> + case QTYPE_QNUM:
> + return QOBJECT(qnum_from_int(qlit->value.qnum));
Is this going to work for all QNum values?
> +++ b/tests/check-qlit.c
> @@ -64,11 +64,37 @@ static void qlit_equal_qobject_test(void)
> qobject_decref(qobj);
> }
>
> +static void qobject_from_qlit_test(void)
> +{
> + QObject *obj, *qobj = qobject_from_qlit(&qlit);
> + QDict *qdict;
> + QList *bee;
> +
> + qdict = qobject_to_qdict(qobj);
> + g_assert_cmpint(qdict_get_int(qdict, "foo"), ==, 42);
> + g_assert_cmpstr(qdict_get_str(qdict, "bar"), ==, "hello world");
> + g_assert(qobject_type(qdict_get(qdict, "baz")) == QTYPE_QNULL);
Related to my question above - you pass because there are no floating
point values in qlit. Is that something we want supported?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 00/50] Hi,, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 03/50] qapi2texi: minor python code simplification, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 02/50] qapi: generate a literal qobject for introspection, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit(), Marc-André Lureau, 2017/09/11
- Re: [Qemu-devel] [PATCH v3 01/50] qlit: add qobject_from_qlit(),
Eric Blake <=
- [Qemu-devel] [PATCH v3 04/50] qapi: add 'if' to top-level expressions, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 05/50] qapi: add tests for invalid 'if', Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 07/50] qapi: add 'ifcond' to visitor methods, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 06/50] qapi: pass 'if' condition into QAPISchemaEntity objects, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 08/50] qapi: mcgen() shouldn't indent # lines, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 10/50] qapi-introspect: modify to_qlit() to append ', ' on level > 0, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 11/50] qapi-introspect: modify to_qlit() to generate #if code, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 09/50] qapi: add #if/#endif helpers, Marc-André Lureau, 2017/09/11
- [Qemu-devel] [PATCH v3 12/50] qapi-introspect: add preprocessor conditions to generated QLit, Marc-André Lureau, 2017/09/11