]> xenbits.xensource.com Git - libvirt.git/commitdiff
Test parsing of large numbers in JSON
authorJán Tomko <jtomko@redhat.com>
Wed, 22 Aug 2018 13:12:47 +0000 (15:12 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 4 Sep 2018 08:19:23 +0000 (10:19 +0200)
We expect to get numbers as big as ULLONG_MAX from QEMU,
add a test for them.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
tests/virjsontest.c

index 195d8279f0bcf950638de13572022101f853cf8e..baf1070c5a4404a4bded76282a3a275708b5ab6c 100644 (file)
@@ -589,6 +589,9 @@ mymain(void)
     DO_TEST_PARSE("float without garbage", "[ 1.024e19 ]", "[1.024e19]");
     DO_TEST_PARSE_FAIL("float with garbage", "[ 0.0314159ee+100 ]");
 
+    DO_TEST_PARSE("unsigned minus one", "[ 18446744073709551615 ]", "[18446744073709551615]");
+    DO_TEST_PARSE("another big number", "[ 9223372036854775808 ]", "[9223372036854775808]");
+
     DO_TEST_PARSE("string", "[ \"The meaning of life\" ]",
                   "[\"The meaning of life\"]");
     DO_TEST_PARSE_FAIL("unterminated string", "[ \"The meaning of lif ]");