[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 10/19] qlit: Support all types of QNums
From: |
Markus Armbruster |
Subject: |
Re: [PATCH v3 10/19] qlit: Support all types of QNums |
Date: |
Tue, 24 Nov 2020 10:55:22 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
Eduardo Habkost <ehabkost@redhat.com> writes:
> Add two new macros to support other types of QNums:
> QLIT_QNUM_UINT, and QLIT_QNUM_DOUBLE, and include them
> in the qlit_equal_qobject_test() test case.
>
> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
> ---
> Changes v2 -> v3:
> * QLIT_QNUM macro doesn't exist anymore
> * Addition of the QNumValue field to QLitObject is
> now in a separate patch ("qlit: Use QNumValue to represent QNums")
> * check-qjson test case changes dropped.
> Instead, I'm only extending the qlit_equal_qobject_test() test
> case.
>
> Changes v1 -> v2:
> * Coding style fix at qlit_equal_qobject()
> ---
> include/qapi/qmp/qlit.h | 4 ++++
> tests/check-qlit.c | 5 +++++
> 2 files changed, 9 insertions(+)
>
> diff --git a/include/qapi/qmp/qlit.h b/include/qapi/qmp/qlit.h
> index a240cdd299..a2881b7f42 100644
> --- a/include/qapi/qmp/qlit.h
> +++ b/include/qapi/qmp/qlit.h
> @@ -42,6 +42,10 @@ struct QLitDictEntry {
> { .type = QTYPE_QBOOL, .value.qbool = (val) }
> #define QLIT_QNUM_INT(val) \
> { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_INT(val) }
> +#define QLIT_QNUM_UINT(val) \
> + { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_UINT(val) }
> +#define QLIT_QNUM_DOUBLE(val) \
> + { .type = QTYPE_QNUM, .value.qnum = QNUM_VAL_DOUBLE(val) }
> #define QLIT_QSTR(val) \
> { .type = QTYPE_QSTRING, .value.qstr = (val) }
> #define QLIT_QDICT(val) \
> diff --git a/tests/check-qlit.c b/tests/check-qlit.c
> index 5a9260b93f..31e90f8965 100644
> --- a/tests/check-qlit.c
> +++ b/tests/check-qlit.c
> @@ -58,6 +58,11 @@ static void qlit_equal_qobject_test(void)
> QLIT_QNUM_INT(1),
> QLIT_QNUM_INT(INT64_MIN),
> QLIT_QNUM_INT(INT64_MAX),
> + QLIT_QNUM_UINT(UINT64_MAX),
> + /* Larger than UINT64_MAX: */
> + QLIT_QNUM_DOUBLE(18446744073709552e3),
> + /* Smaller than INT64_MIN: */
> + QLIT_QNUM_DOUBLE(-92233720368547758e2),
Why "larger than UINT64_MAX" and "smaller than INT64_MIN"?
> QLIT_QSTR(""),
> QLIT_QSTR("foo"),
> qlit,
- [PATCH v3 00/19] qom: Use qlit to represent property defaults, Eduardo Habkost, 2020/11/23
- [PATCH v3 01/19] qnum: Make qnum_get_double() get const pointer, Eduardo Habkost, 2020/11/23
- [PATCH v3 02/19] qnum: Make num_x/num_y variables at qnum_is_equal() const, Eduardo Habkost, 2020/11/23
- [PATCH v3 04/19] qnum: qnum_value_is_equal() function, Eduardo Habkost, 2020/11/23
- [PATCH v3 07/19] qlit: Use QNumValue to represent QNums, Eduardo Habkost, 2020/11/23
- [PATCH v3 05/19] qlit: Use qnum_value_is_equal() when comparing QNums, Eduardo Habkost, 2020/11/23
- [PATCH v3 03/19] qnum: QNumValue type for QNum value literals, Eduardo Habkost, 2020/11/23
- [PATCH v3 06/19] qlit: Rename QLIT_QNUM to QLIT_QNUM_INT, Eduardo Habkost, 2020/11/23
- [PATCH v3 10/19] qlit: Support all types of QNums, Eduardo Habkost, 2020/11/23
- Re: [PATCH v3 10/19] qlit: Support all types of QNums,
Markus Armbruster <=
[PATCH v3 09/19] qlit: Add more test literals to qlit_equal_qobject() test case, Eduardo Habkost, 2020/11/23
[PATCH v3 08/19] qlit: Move qlit_equal_qobject() reference values to array, Eduardo Habkost, 2020/11/23
[PATCH v3 11/19] qom: field_prop_set_default_value() helper, Eduardo Habkost, 2020/11/23