tests: simplify code

Use error_abort instead of open-coded assert.
Cleaner and shorter.

Reported-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Michael S. Tsirkin 2014-06-18 17:52:52 +03:00
parent c210ee95f2
commit 6ffa169576

View File

@ -69,14 +69,12 @@ static void test_visitor_in_intList(TestInputVisitorData *data,
{ {
int64_t value[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20}; int64_t value[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20};
int16List *res = NULL, *tmp; int16List *res = NULL, *tmp;
Error *errp = NULL;
Visitor *v; Visitor *v;
int i = 0; int i = 0;
v = visitor_input_test_init(data, "1,2,0,2-4,20,5-9,1-8"); v = visitor_input_test_init(data, "1,2,0,2-4,20,5-9,1-8");
visit_type_int16List(v, &res, NULL, &errp); visit_type_int16List(v, &res, NULL, &error_abort);
g_assert(errp == NULL);
tmp = res; tmp = res;
while (i < sizeof(value) / sizeof(value[0])) { while (i < sizeof(value) / sizeof(value[0])) {
g_assert(tmp); g_assert(tmp);