aboutsummaryrefslogtreecommitdiff
path: root/tests/test-qmp-input-strict.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test-qmp-input-strict.c')
-rw-r--r--tests/test-qmp-input-strict.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/tests/test-qmp-input-strict.c b/tests/test-qmp-input-strict.c
index d5360c6..486848e 100644
--- a/tests/test-qmp-input-strict.c
+++ b/tests/test-qmp-input-strict.c
@@ -1,7 +1,7 @@
/*
* QMP Input Visitor unit-tests (strict mode).
*
- * Copyright (C) 2011-2012 Red Hat Inc.
+ * Copyright (C) 2011-2012, 2015 Red Hat Inc.
*
* Authors:
* Luiz Capitulino <lcapitulino@redhat.com>
@@ -141,18 +141,18 @@ static void test_validate_list(TestInputVisitorData *data,
qapi_free_UserDefOneList(head);
}
-static void test_validate_union(TestInputVisitorData *data,
- const void *unused)
+static void test_validate_union_native_list(TestInputVisitorData *data,
+ const void *unused)
{
- UserDefUnion *tmp = NULL;
+ UserDefNativeListUnion *tmp = NULL;
Visitor *v;
Error *err = NULL;
- v = validate_test_init(data, "{ 'type': 'b', 'integer': 41, 'data' : { 'integer': 42 } }");
+ v = validate_test_init(data, "{ 'type': 'integer', 'data' : [ 1, 2 ] }");
- visit_type_UserDefUnion(v, &tmp, NULL, &err);
+ visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err);
g_assert(!err);
- qapi_free_UserDefUnion(tmp);
+ qapi_free_UserDefNativeListUnion(tmp);
}
static void test_validate_union_flat(TestInputVisitorData *data,
@@ -232,18 +232,19 @@ static void test_validate_fail_list(TestInputVisitorData *data,
qapi_free_UserDefOneList(head);
}
-static void test_validate_fail_union(TestInputVisitorData *data,
- const void *unused)
+static void test_validate_fail_union_native_list(TestInputVisitorData *data,
+ const void *unused)
{
- UserDefUnion *tmp = NULL;
+ UserDefNativeListUnion *tmp = NULL;
Error *err = NULL;
Visitor *v;
- v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 } }");
+ v = validate_test_init(data,
+ "{ 'type': 'integer', 'data' : [ 'string' ] }");
- visit_type_UserDefUnion(v, &tmp, NULL, &err);
+ visit_type_UserDefNativeListUnion(v, &tmp, NULL, &err);
g_assert(err);
- qapi_free_UserDefUnion(tmp);
+ qapi_free_UserDefNativeListUnion(tmp);
}
static void test_validate_fail_union_flat(TestInputVisitorData *data,
@@ -304,31 +305,31 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
validate_test_add("/visitor/input-strict/pass/struct",
- &testdata, test_validate_struct);
+ &testdata, test_validate_struct);
validate_test_add("/visitor/input-strict/pass/struct-nested",
- &testdata, test_validate_struct_nested);
+ &testdata, test_validate_struct_nested);
validate_test_add("/visitor/input-strict/pass/list",
- &testdata, test_validate_list);
- validate_test_add("/visitor/input-strict/pass/union",
- &testdata, test_validate_union);
+ &testdata, test_validate_list);
validate_test_add("/visitor/input-strict/pass/union-flat",
- &testdata, test_validate_union_flat);
+ &testdata, test_validate_union_flat);
validate_test_add("/visitor/input-strict/pass/union-anon",
- &testdata, test_validate_union_anon);
+ &testdata, test_validate_union_anon);
+ validate_test_add("/visitor/input-strict/pass/union-native-list",
+ &testdata, test_validate_union_native_list);
validate_test_add("/visitor/input-strict/fail/struct",
- &testdata, test_validate_fail_struct);
+ &testdata, test_validate_fail_struct);
validate_test_add("/visitor/input-strict/fail/struct-nested",
- &testdata, test_validate_fail_struct_nested);
+ &testdata, test_validate_fail_struct_nested);
validate_test_add("/visitor/input-strict/fail/list",
- &testdata, test_validate_fail_list);
- validate_test_add("/visitor/input-strict/fail/union",
- &testdata, test_validate_fail_union);
+ &testdata, test_validate_fail_list);
validate_test_add("/visitor/input-strict/fail/union-flat",
- &testdata, test_validate_fail_union_flat);
+ &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);
+ &testdata, test_validate_fail_union_flat_no_discrim);
validate_test_add("/visitor/input-strict/fail/union-anon",
- &testdata, test_validate_fail_union_anon);
+ &testdata, test_validate_fail_union_anon);
+ validate_test_add("/visitor/input-strict/fail/union-native-list",
+ &testdata, test_validate_fail_union_native_list);
g_test_run();