diff options
author | Eric Blake <eblake@redhat.com> | 2015-05-04 09:05:11 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-05-05 18:39:00 +0200 |
commit | ab045267447d52e63a79c0e18f89ae4411f5420b (patch) | |
tree | be733c614b93d55ead3dd9acfb8dc641ff60f06c | |
parent | 811d04fd0cff1229480d3f5b2e349f646ab6e3c1 (diff) | |
download | qemu-ab045267447d52e63a79c0e18f89ae4411f5420b.zip qemu-ab045267447d52e63a79c0e18f89ae4411f5420b.tar.gz qemu-ab045267447d52e63a79c0e18f89ae4411f5420b.tar.bz2 |
qapi: Rename anonymous union type in test
Reduce churn in the future patch that replaces anonymous unions
with a new metatype 'alternate' by changing 'AnonUnion' to
'Alternate'.
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | tests/qapi-schema/qapi-schema-test.json | 2 | ||||
-rw-r--r-- | tests/qapi-schema/qapi-schema-test.out | 4 | ||||
-rw-r--r-- | tests/test-qmp-input-strict.c | 28 | ||||
-rw-r--r-- | tests/test-qmp-input-visitor.c | 16 | ||||
-rw-r--r-- | tests/test-qmp-output-visitor.c | 16 |
5 files changed, 33 insertions, 33 deletions
diff --git a/tests/qapi-schema/qapi-schema-test.json b/tests/qapi-schema/qapi-schema-test.json index b134f3f..e1d35e1 100644 --- a/tests/qapi-schema/qapi-schema-test.json +++ b/tests/qapi-schema/qapi-schema-test.json @@ -53,7 +53,7 @@ 'discriminator': 'enum1', 'data': { 'value1' : 'UserDefC', 'value2' : 'UserDefB', 'value3' : 'UserDefA' } } -{ 'union': 'UserDefAnonUnion', +{ 'union': 'UserDefAlternate', 'discriminator': {}, 'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } } diff --git a/tests/qapi-schema/qapi-schema-test.out b/tests/qapi-schema/qapi-schema-test.out index 664ae7b..b55ab8d 100644 --- a/tests/qapi-schema/qapi-schema-test.out +++ b/tests/qapi-schema/qapi-schema-test.out @@ -10,7 +10,7 @@ OrderedDict([('type', 'UserDefUnionBase'), ('data', OrderedDict([('string', 'str'), ('enum1', 'EnumOne')]))]), OrderedDict([('union', 'UserDefFlatUnion'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefA'), ('value2', 'UserDefB'), ('value3', 'UserDefB')]))]), OrderedDict([('union', 'UserDefFlatUnion2'), ('base', 'UserDefUnionBase'), ('discriminator', 'enum1'), ('data', OrderedDict([('value1', 'UserDefC'), ('value2', 'UserDefB'), ('value3', 'UserDefA')]))]), - OrderedDict([('union', 'UserDefAnonUnion'), ('discriminator', OrderedDict()), ('data', OrderedDict([('uda', 'UserDefA'), ('s', 'str'), ('i', 'int')]))]), + OrderedDict([('union', 'UserDefAlternate'), ('discriminator', OrderedDict()), ('data', OrderedDict([('uda', 'UserDefA'), ('s', 'str'), ('i', 'int')]))]), OrderedDict([('union', 'UserDefNativeListUnion'), ('data', OrderedDict([('integer', ['int']), ('s8', ['int8']), ('s16', ['int16']), ('s32', ['int32']), ('s64', ['int64']), ('u8', ['uint8']), ('u16', ['uint16']), ('u32', ['uint32']), ('u64', ['uint64']), ('number', ['number']), ('boolean', ['bool']), ('string', ['str']), ('sizes', ['size'])]))]), OrderedDict([('command', 'user_def_cmd'), ('data', OrderedDict())]), OrderedDict([('command', 'user_def_cmd1'), ('data', OrderedDict([('ud1a', 'UserDefOne')]))]), @@ -23,7 +23,7 @@ OrderedDict([('event', 'EVENT_C'), ('data', OrderedDict([('*a', 'int'), ('*b', 'UserDefOne'), ('c', 'str')]))]), OrderedDict([('event', 'EVENT_D'), ('data', OrderedDict([('a', 'EventStructOne'), ('b', 'str'), ('*c', 'str'), ('*enum3', 'EnumOne')]))])] [{'enum_name': 'EnumOne', 'enum_values': ['value1', 'value2', 'value3']}, - {'enum_name': 'UserDefAnonUnionKind', 'enum_values': None}, + {'enum_name': 'UserDefAlternateKind', 'enum_values': None}, {'enum_name': 'UserDefNativeListUnionKind', 'enum_values': None}] [OrderedDict([('type', 'NestedEnumsOne'), ('data', OrderedDict([('enum1', 'EnumOne'), ('*enum2', 'EnumOne'), ('enum3', 'EnumOne'), ('*enum4', 'EnumOne')]))]), OrderedDict([('type', 'UserDefZero'), ('data', OrderedDict([('integer', 'int')]))]), diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c index 486848e..a5f7bf3 100644 --- a/tests/test-qmp-input-strict.c +++ b/tests/test-qmp-input-strict.c @@ -173,18 +173,18 @@ static void test_validate_union_flat(TestInputVisitorData *data, qapi_free_UserDefFlatUnion(tmp); } -static void test_validate_union_anon(TestInputVisitorData *data, - const void *unused) +static void test_validate_alternate(TestInputVisitorData *data, + const void *unused) { - UserDefAnonUnion *tmp = NULL; + UserDefAlternate *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "42"); - visit_type_UserDefAnonUnion(v, &tmp, NULL, &err); + visit_type_UserDefAlternate(v, &tmp, NULL, &err); g_assert(!err); - qapi_free_UserDefAnonUnion(tmp); + qapi_free_UserDefAlternate(tmp); } static void test_validate_fail_struct(TestInputVisitorData *data, @@ -276,18 +276,18 @@ static void test_validate_fail_union_flat_no_discrim(TestInputVisitorData *data, qapi_free_UserDefFlatUnion2(tmp); } -static void test_validate_fail_union_anon(TestInputVisitorData *data, - const void *unused) +static void test_validate_fail_alternate(TestInputVisitorData *data, + const void *unused) { - UserDefAnonUnion *tmp = NULL; + UserDefAlternate *tmp = NULL; Visitor *v; Error *err = NULL; v = validate_test_init(data, "3.14"); - visit_type_UserDefAnonUnion(v, &tmp, NULL, &err); + visit_type_UserDefAlternate(v, &tmp, NULL, &err); g_assert(err); - qapi_free_UserDefAnonUnion(tmp); + qapi_free_UserDefAlternate(tmp); } static void validate_test_add(const char *testpath, @@ -312,8 +312,8 @@ int main(int argc, char **argv) &testdata, test_validate_list); validate_test_add("/visitor/input-strict/pass/union-flat", &testdata, test_validate_union_flat); - validate_test_add("/visitor/input-strict/pass/union-anon", - &testdata, test_validate_union_anon); + validate_test_add("/visitor/input-strict/pass/alternate", + &testdata, test_validate_alternate); validate_test_add("/visitor/input-strict/pass/union-native-list", &testdata, test_validate_union_native_list); validate_test_add("/visitor/input-strict/fail/struct", @@ -326,8 +326,8 @@ int main(int argc, char **argv) &testdata, test_validate_fail_union_flat); validate_test_add("/visitor/input-strict/fail/union-flat-no-discriminator", &testdata, test_validate_fail_union_flat_no_discrim); - validate_test_add("/visitor/input-strict/fail/union-anon", - &testdata, test_validate_fail_union_anon); + validate_test_add("/visitor/input-strict/fail/alternate", + &testdata, test_validate_fail_alternate); validate_test_add("/visitor/input-strict/fail/union-native-list", &testdata, test_validate_fail_union_native_list); diff --git a/tests/test-qmp-input-visitor.c b/tests/test-qmp-input-visitor.c index cc33f64..882359a 100644 --- a/tests/test-qmp-input-visitor.c +++ b/tests/test-qmp-input-visitor.c @@ -315,20 +315,20 @@ static void test_visitor_in_union_flat(TestInputVisitorData *data, qapi_free_UserDefFlatUnion(tmp); } -static void test_visitor_in_union_anon(TestInputVisitorData *data, - const void *unused) +static void test_visitor_in_alternate(TestInputVisitorData *data, + const void *unused) { Visitor *v; Error *err = NULL; - UserDefAnonUnion *tmp; + UserDefAlternate *tmp; v = visitor_input_test_init(data, "42"); - visit_type_UserDefAnonUnion(v, &tmp, NULL, &err); + visit_type_UserDefAlternate(v, &tmp, NULL, &err); g_assert(err == NULL); - g_assert_cmpint(tmp->kind, ==, USER_DEF_ANON_UNION_KIND_I); + g_assert_cmpint(tmp->kind, ==, USER_DEF_ALTERNATE_KIND_I); g_assert_cmpint(tmp->i, ==, 42); - qapi_free_UserDefAnonUnion(tmp); + qapi_free_UserDefAlternate(tmp); } static void test_native_list_integer_helper(TestInputVisitorData *data, @@ -664,8 +664,8 @@ int main(int argc, char **argv) &in_visitor_data, test_visitor_in_list); input_visitor_test_add("/visitor/input/union-flat", &in_visitor_data, test_visitor_in_union_flat); - input_visitor_test_add("/visitor/input/union-anon", - &in_visitor_data, test_visitor_in_union_anon); + input_visitor_test_add("/visitor/input/alternate", + &in_visitor_data, test_visitor_in_alternate); input_visitor_test_add("/visitor/input/errors", &in_visitor_data, test_visitor_in_errors); input_visitor_test_add("/visitor/input/native_list/int", diff --git a/tests/test-qmp-output-visitor.c b/tests/test-qmp-output-visitor.c index ebe6ea3..602bc12 100644 --- a/tests/test-qmp-output-visitor.c +++ b/tests/test-qmp-output-visitor.c @@ -453,24 +453,24 @@ static void test_visitor_out_union_flat(TestOutputVisitorData *data, QDECREF(qdict); } -static void test_visitor_out_union_anon(TestOutputVisitorData *data, - const void *unused) +static void test_visitor_out_alternate(TestOutputVisitorData *data, + const void *unused) { QObject *arg; Error *err = NULL; - UserDefAnonUnion *tmp = g_malloc0(sizeof(UserDefAnonUnion)); - tmp->kind = USER_DEF_ANON_UNION_KIND_I; + UserDefAlternate *tmp = g_malloc0(sizeof(UserDefAlternate)); + tmp->kind = USER_DEF_ALTERNATE_KIND_I; tmp->i = 42; - visit_type_UserDefAnonUnion(data->ov, &tmp, NULL, &err); + visit_type_UserDefAlternate(data->ov, &tmp, NULL, &err); g_assert(err == NULL); arg = qmp_output_get_qobject(data->qov); g_assert(qobject_type(arg) == QTYPE_QINT); g_assert_cmpint(qint_get_int(qobject_to_qint(arg)), ==, 42); - qapi_free_UserDefAnonUnion(tmp); + qapi_free_UserDefAlternate(tmp); } static void test_visitor_out_empty(TestOutputVisitorData *data, @@ -830,8 +830,8 @@ int main(int argc, char **argv) &out_visitor_data, test_visitor_out_list_qapi_free); output_visitor_test_add("/visitor/output/union-flat", &out_visitor_data, test_visitor_out_union_flat); - output_visitor_test_add("/visitor/output/union-anon", - &out_visitor_data, test_visitor_out_union_anon); + output_visitor_test_add("/visitor/output/alternate", + &out_visitor_data, test_visitor_out_alternate); output_visitor_test_add("/visitor/output/empty", &out_visitor_data, test_visitor_out_empty); output_visitor_test_add("/visitor/output/native_list/int", |