[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 09/32] test-string-input-visitor: Add range overflow
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PULL 09/32] test-string-input-visitor: Add range overflow tests |
Date: |
Thu, 13 Dec 2018 19:43:17 +0100 |
From: David Hildenbrand <address@hidden>
Let's make sure that the range handling code can properly deal with
ranges that end at the biggest possible number.
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
tests/test-string-input-visitor.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/test-string-input-visitor.c
b/tests/test-string-input-visitor.c
index 9b1dd44b2d..34b54dfc89 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -112,6 +112,7 @@ static void test_visitor_in_intList(TestInputVisitorData
*data,
int64_t expect2[] = { 32767, -32768, -32767 };
int64_t expect3[] = { INT64_MIN, INT64_MAX };
int64_t expect4[] = { 1 };
+ int64_t expect5[] = { INT64_MAX - 2, INT64_MAX - 1, INT64_MAX };
Error *err = NULL;
int64List *res = NULL;
Visitor *v;
@@ -132,6 +133,10 @@ static void test_visitor_in_intList(TestInputVisitorData
*data,
v = visitor_input_test_init(data, "1-1");
check_ilist(v, expect4, ARRAY_SIZE(expect4));
+ v = visitor_input_test_init(data,
+ "9223372036854775805-9223372036854775807");
+ check_ilist(v, expect5, ARRAY_SIZE(expect5));
+
/* Value too large */
v = visitor_input_test_init(data, "9223372036854775808");
@@ -216,6 +221,7 @@ static void test_visitor_in_uintList(TestInputVisitorData
*data,
uint64_t expect3[] = { INT64_MIN, INT64_MAX };
uint64_t expect4[] = { 1 };
uint64_t expect5[] = { UINT64_MAX };
+ uint64_t expect6[] = { UINT64_MAX - 2, UINT64_MAX - 1, UINT64_MAX };
Error *err = NULL;
uint64List *res = NULL;
Visitor *v;
@@ -239,6 +245,10 @@ static void test_visitor_in_uintList(TestInputVisitorData
*data,
v = visitor_input_test_init(data, "18446744073709551615");
check_ulist(v, expect5, ARRAY_SIZE(expect5));
+ v = visitor_input_test_init(data,
+ "18446744073709551613-18446744073709551615");
+ check_ulist(v, expect6, ARRAY_SIZE(expect6));
+
/* Value too large */
v = visitor_input_test_init(data, "18446744073709551616");
--
2.17.2
- Re: [Qemu-devel] [PULL 27/32] qapi: add #if conditions to generated code members, (continued)
- [Qemu-devel] [PULL 28/32] qapi: add 'If:' condition to enum values documentation, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 10/32] docs: Update references to JSON RFC, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 17/32] tests: print enum type members more like object type members, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 02/32] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 19/32] qapi: improve reporting of unknown or missing keys, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 30/32] qapi: add condition to variants documentation, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 14/32] qapi: break long lines at 'data' member, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 21/32] qapi: add 'if' to enum members, Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 01/32] cutils: Add qemu_strtod() and qemu_strtod_finite(), Markus Armbruster, 2018/12/13
- [Qemu-devel] [PULL 09/32] test-string-input-visitor: Add range overflow tests,
Markus Armbruster <=
- [Qemu-devel] [PULL 32/32] qapi: add conditions to REPLICATION type/commands on the schema, Markus Armbruster, 2018/12/13
[Qemu-devel] [PULL 26/32] qapi: add 'if' to alternate members, Markus Armbruster, 2018/12/13
[Qemu-devel] [PULL 20/32] qapi: add a dictionary form with 'name' key for enum members, Markus Armbruster, 2018/12/13
[Qemu-devel] [PULL 25/32] qapi: add 'if' to union members, Markus Armbruster, 2018/12/13