aboutsummaryrefslogtreecommitdiff
path: root/tests/check-qjson.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2018-08-23 18:40:08 +0200
committerMarkus Armbruster <armbru@redhat.com>2018-08-24 20:26:37 +0200
commit53a0d616fecab09870411573afc58fd24ffb8648 (patch)
tree78368fb74f977d94098a3a06a25b2eaf375d657f /tests/check-qjson.c
parentf7617d45d4652ae10d38bd0c917d7488d155cccb (diff)
downloadqemu-53a0d616fecab09870411573afc58fd24ffb8648.zip
qemu-53a0d616fecab09870411573afc58fd24ffb8648.tar.gz
qemu-53a0d616fecab09870411573afc58fd24ffb8648.tar.bz2
json: Replace %I64d, %I64u by %PRId64, %PRIu64
Support for %I64d got added in commit 2c0d4b36e7f "json: fix PRId64 on Win32". We had to hard-code I64d because we used the lexer's finite state machine to check interpolations. No more, so clean this up. Additional conversion specifications would be easy enough to implement when needed. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180823164025.12553-42-armbru@redhat.com>
Diffstat (limited to 'tests/check-qjson.c')
-rw-r--r--tests/check-qjson.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/check-qjson.c b/tests/check-qjson.c
index 83f8a0e..f344ad9 100644
--- a/tests/check-qjson.c
+++ b/tests/check-qjson.c
@@ -945,9 +945,11 @@ static void keyword_literal(void)
static void interpolation_valid(void)
{
long long value_lld = 0x123456789abcdefLL;
+ int64_t value_d64 = value_lld;
long value_ld = (long)value_lld;
int value_d = (int)value_lld;
unsigned long long value_llu = 0xfedcba9876543210ULL;
+ uint64_t value_u64 = value_llu;
unsigned long value_lu = (unsigned long)value_llu;
unsigned value_u = (unsigned)value_llu;
double value_f = 2.323423423;
@@ -985,6 +987,10 @@ static void interpolation_valid(void)
g_assert_cmpint(qnum_get_int(qnum), ==, value_lld);
qobject_unref(qnum);
+ qnum = qobject_to(QNum, qobject_from_jsonf_nofail("%" PRId64, value_d64));
+ g_assert_cmpint(qnum_get_int(qnum), ==, value_lld);
+ qobject_unref(qnum);
+
qnum = qobject_to(QNum, qobject_from_jsonf_nofail("%u", value_u));
g_assert_cmpuint(qnum_get_uint(qnum), ==, value_u);
qobject_unref(qnum);
@@ -997,6 +1003,10 @@ static void interpolation_valid(void)
g_assert_cmpuint(qnum_get_uint(qnum), ==, value_llu);
qobject_unref(qnum);
+ qnum = qobject_to(QNum, qobject_from_jsonf_nofail("%" PRIu64, value_u64));
+ g_assert_cmpuint(qnum_get_uint(qnum), ==, value_llu);
+ qobject_unref(qnum);
+
qnum = qobject_to(QNum, qobject_from_jsonf_nofail("%f", value_f));
g_assert(qnum_get_double(qnum) == value_f);
qobject_unref(qnum);