2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
20 namespace c_glib TTest
21 namespace cpp thrift.test.debug
22 namespace java thrift.test
23 namespace rb thrift.test
40 4: i16 integer16 = 0x7fff,
42 6: i64 integer64 = 10000000000,
43 7: double double_precision,
44 8: string some_characters,
45 9: string zomg_unicode,
48 12: list<i8> byte_list = [1, 2, 3],
49 13: list<i16> i16_list = [1,2,3],
50 14: list<i64> i64_list = [1,2,3]
64 1: list<OneOfEach> big,
65 2: set<list<string> (python.immutable = "")> contain,
66 3: map<string,list<Bonk>> bonks,
76 python.immutable = "",
82 python.immutable = "",
90 5: list<i32> myintlist,
91 6: map<i32,Wrapper> maps,
106 struct CompactProtoTestStruct {
117 10: Empty empty_struct_field;
119 // primitives in lists
120 11: list<i8> byte_list;
121 12: list<i16> i16_list;
122 13: list<i32> i32_list;
123 14: list<i64> i64_list;
124 15: list<double> double_list;
125 16: list<string> string_list;
126 17: list<binary> binary_list;
127 18: list<bool> boolean_list;
128 19: list<Empty> struct_list;
130 // primitives in sets
131 20: set<i8> byte_set;
132 21: set<i16> i16_set;
133 22: set<i32> i32_set;
134 23: set<i64> i64_set;
135 24: set<double> double_set;
136 25: set<string> string_set;
137 26: set<binary> binary_set;
138 27: set<bool> boolean_set;
139 28: set<Empty> struct_set;
142 // primitives as keys
143 29: map<i8, i8> byte_byte_map;
144 30: map<i16, i8> i16_byte_map;
145 31: map<i32, i8> i32_byte_map;
146 32: map<i64, i8> i64_byte_map;
147 33: map<double, i8> double_byte_map;
148 34: map<string, i8> string_byte_map;
149 35: map<binary, i8> binary_byte_map;
150 36: map<bool, i8> boolean_byte_map;
151 // primitives as values
152 37: map<i8, i16> byte_i16_map;
153 38: map<i8, i32> byte_i32_map;
154 39: map<i8, i64> byte_i64_map;
155 40: map<i8, double> byte_double_map;
156 41: map<i8, string> byte_string_map;
157 42: map<i8, binary> byte_binary_map;
158 43: map<i8, bool> byte_boolean_map;
159 // collections as keys
160 44: map<list<i8> (python.immutable = ""), i8> list_byte_map;
161 45: map<set<i8> (python.immutable = ""), i8> set_byte_map;
162 46: map<map<i8,i8> (python.immutable = ""), i8> map_byte_map;
163 // collections as values
164 47: map<i8, map<i8,i8>> byte_map_map;
165 48: map<i8, set<i8>> byte_set_map;
166 49: map<i8, list<i8>> byte_list_map;
170 5000 : i64 field5000;
171 20000 : i64 field20000;
174 // To be used to test the serialization of an empty map
175 struct SingleMapTestStruct {
176 1: required map<i32, i32> i32_map;
179 const CompactProtoTestStruct COMPACT_TEST = {
182 'a_i32' : 1000000000,
183 'a_i64' : 0xffffffffff,
185 'a_string' : "my string",
189 'empty_struct_field' : {},
190 'byte_list' : [-127, -1, 0, 1, 127],
191 'i16_list' : [-1, 0, 1, 0x7fff],
192 'i32_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff],
193 'i64_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
194 'double_list' : [0.1, 0.2, 0.3],
195 'string_list' : ["first", "second", "third"],
197 'boolean_list' : [1, 1, 1, 0, 0, 0],
198 'struct_list' : [{}, {}],
199 'byte_set' : [-127, -1, 0, 1, 127],
200 'i16_set' : [-1, 0, 1, 0x7fff],
201 'i32_set' : [1, 2, 3],
202 'i64_set' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff],
203 'double_set' : [0.1, 0.2, 0.3],
204 'string_set' : ["first", "second", "third"],
206 'boolean_set' : [1, 0],
208 'byte_byte_map' : {1 : 2},
209 'i16_byte_map' : {1 : 1, -1 : 1, 0x7fff : 1},
210 'i32_byte_map' : {1 : 1, -1 : 1, 0x7fffffff : 1},
211 'i64_byte_map' : {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1},
212 'double_byte_map' : {-1.1 : 1, 1.1 : 1},
213 'string_byte_map' : {"first" : 1, "second" : 2, "third" : 3, "" : 0},
215 'boolean_byte_map' : {1 : 1, 0 : 0},
216 'byte_i16_map' : {1 : 1, 2 : -1, 3 : 0x7fff},
217 'byte_i32_map' : {1 : 1, 2 : -1, 3 : 0x7fffffff},
218 'byte_i64_map' : {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff},
219 'byte_double_map' : {1 : 0.1, 2 : -0.1, 3 : 1000000.1},
220 'byte_string_map' : {1 : "", 2 : "blah", 3 : "loooooooooooooong string"},
222 'byte_boolean_map' : {1 : 1, 2 : 0},
223 'list_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
224 'set_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0},
225 'map_byte_map' : {{1 : 1} : 1, {2 : 2} : 2, {} : 0},
226 'byte_map_map' : {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}},
227 'byte_set_map' : {0 : [], 1 : [1], 2 : [1, 2]},
228 'byte_list_map' : {0 : [], 1 : [1], 2 : [1, 2]},
232 'field20000' : 20000,
236 const i32 MYCONST = 2
239 exception ExceptionWithAMap {
241 2: map<string, string> map_field;
244 service ServiceForExceptionWithAMap {
245 void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap);
249 i32 Janky(1: i32 arg);
251 // return type only methods
254 i32 primitiveMethod();
255 CompactProtoTestStruct structMethod();
257 void methodWithDefaultArgs(1: i32 something = MYCONST);
259 oneway void onewayMethod();
261 bool declaredExceptionMethod(1: bool shouldThrow) throws (1: ExceptionWithAMap xwamap);
264 service Inherited extends Srv {
265 i32 identity(1: i32 arg)
268 service EmptyService {}
270 // The only purpose of this thing is to increase the size of the generated code
271 // so that ZlibTest has more highly compressible data to play with.
273 1: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b1;
274 2: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b2;
275 3: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b3;
276 4: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b4;
280 struct ReverseOrderStruct {
287 service ReverseOrderService {
288 void myMethod(4: string first, 3: i16 second, 2: i32 third, 1: i64 fourth);
296 /** This is a docstring on a constant! */
297 const SomeEnum MY_SOME_ENUM = SomeEnum.ONE
299 const SomeEnum MY_SOME_ENUM_1 = 1
300 /*const SomeEnum MY_SOME_ENUM_2 = 7*/
302 const map<SomeEnum,SomeEnum> MY_ENUM_MAP = {
303 SomeEnum.ONE : SomeEnum.TWO
306 struct StructWithSomeEnum {
310 const map<SomeEnum,StructWithSomeEnum> EXTRA_CRAZY_MAP = {
311 SomeEnum.ONE : {"blah" : SomeEnum.TWO}
318 1: string string_field;
320 3: OneOfEach struct_field;
321 4: list<RandomStuff> struct_list;
322 5: i32 other_i32_field;
323 6: SomeEnum enum_field;
325 8: map<i32, i32> i32_map;
328 union TestUnionMinusStringField {
330 3: OneOfEach struct_field;
331 4: list<RandomStuff> struct_list;
332 5: i32 other_i32_field;
333 6: SomeEnum enum_field;
335 8: map<i32, i32> i32_map;
338 union ComparableUnion {
339 1: string string_field;
340 2: binary binary_field;
343 struct StructWithAUnion {
344 1: TestUnion test_union;
347 struct PrimitiveThenStruct {
353 typedef map<i32,i32> SomeMap
355 struct StructWithASomemap {
356 1: required SomeMap somemap_field;
359 struct BigFieldIdStruct {
364 struct BreaksRubyCompactProtocol {
366 2: BigFieldIdStruct field2;
370 struct TupleProtocolTestStruct {
380 optional i32 field10;
381 optional i32 field11;
382 optional i32 field12;
385 struct ListDoublePerf {
386 1: list<double> field;