[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 7/9] test-string-input-visitor: Use virtual walk
From: |
David Hildenbrand |
Subject: |
[Qemu-devel] [PATCH v2 7/9] test-string-input-visitor: Use virtual walk |
Date: |
Tue, 20 Nov 2018 10:25:40 +0100 |
We now support virtual walks, so use that instead.
Reviewed-by: Markus Armbruster <address@hidden>
Signed-off-by: David Hildenbrand <address@hidden>
---
tests/test-string-input-visitor.c | 36 +++++++++++--------------------
1 file changed, 12 insertions(+), 24 deletions(-)
diff --git a/tests/test-string-input-visitor.c
b/tests/test-string-input-visitor.c
index c5379365a6..718d9a03c3 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -115,7 +115,6 @@ static void test_visitor_in_intList(TestInputVisitorData
*data,
uint64_t expect5[] = { UINT64_MAX };
Error *err = NULL;
int64List *res = NULL;
- int64List *tail;
Visitor *v;
int64_t val;
@@ -188,39 +187,28 @@ static void test_visitor_in_intList(TestInputVisitorData
*data,
v = visitor_input_test_init(data, "0,2-3");
- /* Would be simpler if the visitor genuinely supported virtual walks */
- visit_start_list(v, NULL, (GenericList **)&res, sizeof(*res),
- &error_abort);
- tail = res;
- visit_type_int64(v, NULL, &tail->value, &error_abort);
- g_assert_cmpint(tail->value, ==, 0);
- tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
- g_assert(tail);
- visit_type_int64(v, NULL, &tail->value, &error_abort);
- g_assert_cmpint(tail->value, ==, 2);
- tail = (int64List *)visit_next_list(v, (GenericList *)tail, sizeof(*res));
- g_assert(tail);
+ visit_start_list(v, NULL, NULL, 0, &error_abort);
+ visit_type_int64(v, NULL, &val, &error_abort);
+ g_assert_cmpint(val, ==, 0);
+ visit_type_int64(v, NULL, &val, &error_abort);
+ g_assert_cmpint(val, ==, 2);
visit_check_list(v, &err);
error_free_or_abort(&err);
- visit_end_list(v, (void **)&res);
-
- qapi_free_int64List(res);
+ visit_end_list(v, NULL);
/* Visit beyond end of list */
+
v = visitor_input_test_init(data, "0");
- visit_start_list(v, NULL, (GenericList **)&res, sizeof(*res),
- &error_abort);
- tail = res;
- visit_type_int64(v, NULL, &tail->value, &err);
- g_assert_cmpint(tail->value, ==, 0);
+ visit_start_list(v, NULL, NULL, 0, &error_abort);
+ visit_type_int64(v, NULL, &val, &err);
+ g_assert_cmpint(val, ==, 0);
visit_type_int64(v, NULL, &val, &err);
error_free_or_abort(&err);
- visit_check_list(v, &error_abort);
- visit_end_list(v, (void **)&res);
- qapi_free_int64List(res);
+ visit_check_list(v, &error_abort);
+ visit_end_list(v, NULL);
}
static void test_visitor_in_bool(TestInputVisitorData *data,
--
2.17.2
- Re: [Qemu-devel] [PATCH v2 5/9] test-string-input-visitor: Add more tests, (continued)
[Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, David Hildenbrand, 2018/11/20
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Eric Blake, 2018/11/20
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Markus Armbruster, 2018/11/20
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Eric Blake, 2018/11/20
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, David Hildenbrand, 2018/11/21
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Markus Armbruster, 2018/11/21
- Re: [Qemu-devel] [PATCH v2 2/9] cutils: Fix qemu_strtosz() & friends to reject non-finite sizes, Eric Blake, 2018/11/21
[Qemu-devel] [PATCH v2 7/9] test-string-input-visitor: Use virtual walk,
David Hildenbrand <=
[Qemu-devel] [PATCH v2 6/9] qapi: Rewrite string-input-visitor, David Hildenbrand, 2018/11/20
[Qemu-devel] [PATCH v2 9/9] test-string-input-visitor: Add range overflow tests, David Hildenbrand, 2018/11/20
[Qemu-devel] [PATCH v2 8/9] test-string-input-visitor: Split off uint64 list tests, David Hildenbrand, 2018/11/20