aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-08-24 10:46:08 +0200
committerMarkus Armbruster <armbru@redhat.com>2017-09-04 13:09:13 +0200
commit977c736f80c232de7c6476d793ed575359c049d8 (patch)
tree986bf327e75929660aa367008574343e59818ee4 /tests
parent5b5f825d44306b18509cd10ba9ac6983e90d6e0f (diff)
downloadqemu-977c736f80c232de7c6476d793ed575359c049d8.zip
qemu-977c736f80c232de7c6476d793ed575359c049d8.tar.gz
qemu-977c736f80c232de7c6476d793ed575359c049d8.tar.bz2
qapi: Mechanically convert FOO_lookup[...] to FOO_str(...)
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1503564371-26090-14-git-send-email-armbru@redhat.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/test-qapi-util.c2
-rw-r--r--tests/test-qobject-input-visitor.c4
-rw-r--r--tests/test-qobject-output-visitor.c2
-rw-r--r--tests/test-string-input-visitor.c2
-rw-r--r--tests/test-string-output-visitor.c4
5 files changed, 7 insertions, 7 deletions
diff --git a/tests/test-qapi-util.c b/tests/test-qapi-util.c
index 7e1be1d..0992bdb 100644
--- a/tests/test-qapi-util.c
+++ b/tests/test-qapi-util.c
@@ -31,7 +31,7 @@ static void test_qapi_enum_parse(void)
ret = qapi_enum_parse(QType_lookup, "none", -1, &error_abort);
g_assert_cmpint(ret, ==, QTYPE_NONE);
- ret = qapi_enum_parse(QType_lookup, QType_lookup[QTYPE__MAX - 1],
+ ret = qapi_enum_parse(QType_lookup, QType_str(QTYPE__MAX - 1),
QTYPE__MAX - 1, &error_abort);
g_assert_cmpint(ret, ==, QTYPE__MAX - 1);
}
diff --git a/tests/test-qobject-input-visitor.c b/tests/test-qobject-input-visitor.c
index 5bbfb65..f8720aa 100644
--- a/tests/test-qobject-input-visitor.c
+++ b/tests/test-qobject-input-visitor.c
@@ -385,7 +385,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
for (i = 0; i < ENUM_ONE__MAX; i++) {
EnumOne res = -1;
- v = visitor_input_test_init(data, "%s", EnumOne_lookup[i]);
+ v = visitor_input_test_init(data, "%s", EnumOne_str(i));
visit_type_EnumOne(v, NULL, &res, &error_abort);
g_assert_cmpint(i, ==, res);
@@ -699,7 +699,7 @@ static void test_native_list_integer_helper(TestInputVisitorData *data,
}
}
g_string_append_printf(gstr_union, "{ 'type': '%s', 'data': [ %s ] }",
- UserDefNativeListUnionKind_lookup[kind],
+ UserDefNativeListUnionKind_str(kind),
gstr_list->str);
v = visitor_input_test_init_raw(data, gstr_union->str);
diff --git a/tests/test-qobject-output-visitor.c b/tests/test-qobject-output-visitor.c
index 7eb1620..d375100 100644
--- a/tests/test-qobject-output-visitor.c
+++ b/tests/test-qobject-output-visitor.c
@@ -133,7 +133,7 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
qstr = qobject_to_qstring(visitor_get(data));
g_assert(qstr);
- g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_lookup[i]);
+ g_assert_cmpstr(qstring_get_str(qstr), ==, EnumOne_str(i));
visitor_reset(data);
}
}
diff --git a/tests/test-string-input-visitor.c b/tests/test-string-input-visitor.c
index e7a7b80..4f9c36b 100644
--- a/tests/test-string-input-visitor.c
+++ b/tests/test-string-input-visitor.c
@@ -282,7 +282,7 @@ static void test_visitor_in_enum(TestInputVisitorData *data,
for (i = 0; i < ENUM_ONE__MAX; i++) {
EnumOne res = -1;
- v = visitor_input_test_init(data, EnumOne_lookup[i]);
+ v = visitor_input_test_init(data, EnumOne_str(i));
visit_type_EnumOne(v, NULL, &res, &err);
g_assert(!err);
diff --git a/tests/test-string-output-visitor.c b/tests/test-string-output-visitor.c
index e736db3..385cddb 100644
--- a/tests/test-string-output-visitor.c
+++ b/tests/test-string-output-visitor.c
@@ -194,12 +194,12 @@ static void test_visitor_out_enum(TestOutputVisitorData *data,
str = visitor_get(data);
if (data->human) {
- char *str_human = g_strdup_printf("\"%s\"", EnumOne_lookup[i]);
+ char *str_human = g_strdup_printf("\"%s\"", EnumOne_str(i));
g_assert_cmpstr(str, ==, str_human);
g_free(str_human);
} else {
- g_assert_cmpstr(str, ==, EnumOne_lookup[i]);
+ g_assert_cmpstr(str, ==, EnumOne_str(i));
}
visitor_reset(data);
}