]> Git Repo - qemu.git/blob - tests/qapi-schema/qapi-schema-test.json
c7e6be8fb60ebeb8d5f64b1239c7fc042631b78e
[qemu.git] / tests / qapi-schema / qapi-schema-test.json
1 # *-*- Mode: Python -*-*
2
3 # for testing enums
4 { 'enum': 'EnumOne',
5   'data': [ 'value1', 'value2', 'value3' ] }
6 { 'type': 'NestedEnumsOne',
7   'data': { 'enum1': 'EnumOne', '*enum2': 'EnumOne', 'enum3': 'EnumOne', '*enum4': 'EnumOne' } }
8
9 # for testing nested structs
10 { 'type': 'UserDefZero',
11   'data': { 'integer': 'int' } }
12
13 { 'type': 'UserDefOne',
14   'base': 'UserDefZero',
15   'data': { 'string': 'str', '*enum1': 'EnumOne' } }
16
17 { 'type': 'UserDefTwo',
18   'data': { 'string': 'str',
19             'dict': { 'string': 'str',
20                       'dict': { 'userdef': 'UserDefOne', 'string': 'str' },
21                       '*dict2': { 'userdef': 'UserDefOne', 'string': 'str' } } } }
22
23 { 'type': 'UserDefNested',
24   'data': { 'string0': 'str',
25             'dict1': { 'string1': 'str',
26                        'dict2': { 'userdef1': 'UserDefOne', 'string2': 'str' },
27                        '*dict3': { 'userdef2': 'UserDefOne', 'string3': 'str' } } } }
28
29 # for testing unions
30 { 'type': 'UserDefA',
31   'data': { 'boolean': 'bool' } }
32
33 { 'type': 'UserDefB',
34   'data': { 'integer': 'int' } }
35
36 { 'union': 'UserDefUnion',
37   'data': { 'a' : 'UserDefA', 'b' : 'UserDefB' } }
38
39 { 'union': 'UserDefAnonUnion',
40   'discriminator': {},
41   'data': { 'uda': 'UserDefA', 's': 'str', 'i': 'int' } }
42
43 # for testing native lists
44 { 'union': 'UserDefNativeListUnion',
45   'data': { 'integer': ['int'],
46             's8': ['int8'],
47             's16': ['int16'],
48             's32': ['int32'],
49             's64': ['int64'],
50             'u8': ['uint8'],
51             'u16': ['uint16'],
52             'u32': ['uint32'],
53             'u64': ['uint64'],
54             'number': ['number'],
55             'boolean': ['bool'],
56             'string': ['str'] } }
57
58 # testing commands
59 { 'command': 'user_def_cmd', 'data': {} }
60 { 'command': 'user_def_cmd1', 'data': {'ud1a': 'UserDefOne'} }
61 { 'command': 'user_def_cmd2',
62   'data': {'ud1a': 'UserDefOne', '*ud1b': 'UserDefOne'},
63   'returns': 'UserDefTwo' }
64 { 'command': 'user_def_cmd3', 'data': {'a': 'int', '*b': 'int' },
65   'returns': 'int' }
66
67 # For testing integer range flattening in opts-visitor. The following schema
68 # corresponds to the option format:
69 #
70 # -userdef i64=3-6,i64=-5--1,u64=2,u16=1,u16=7-12
71 #
72 # For simplicity, this example doesn't use [type=]discriminator nor optargs
73 # specific to discriminator values.
74 { 'type': 'UserDefOptions',
75   'data': {
76     '*i64' : [ 'int'    ],
77     '*u64' : [ 'uint64' ],
78     '*u16' : [ 'uint16' ],
79     '*i64x':   'int'     ,
80     '*u64x':   'uint64'  } }
This page took 0.01795 seconds and 2 git commands to generate.