David Reiss | ea2cba8 | 2009-03-30 21:35:00 +0000 | [diff] [blame] | 1 | /* |
| 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 |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 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 |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
Roger Meier | 213a664 | 2010-10-27 12:30:11 +0000 | [diff] [blame] | 20 | namespace c_glib TTest |
David Reiss | 2a4bfd6 | 2008-04-07 23:45:00 +0000 | [diff] [blame] | 21 | namespace cpp thrift.test.debug |
David Reiss | 3b15ebc | 2008-03-02 06:29:19 +0000 | [diff] [blame] | 22 | namespace java thrift.test |
Jens Geyer | 123258b | 2015-10-02 00:38:17 +0200 | [diff] [blame] | 23 | namespace rb thrift.test |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 24 | |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 25 | struct Doubles { |
| 26 | 1: double nan, |
| 27 | 2: double inf, |
| 28 | 3: double neginf, |
| 29 | 4: double repeating, |
| 30 | 5: double big, |
Roger Meier | 22888ce | 2014-02-09 11:31:02 +0100 | [diff] [blame] | 31 | 6: double tiny, |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 32 | 7: double zero, |
| 33 | 8: double negzero, |
| 34 | } |
| 35 | |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 36 | struct OneOfEach { |
| 37 | 1: bool im_true, |
| 38 | 2: bool im_false, |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 39 | 3: i8 a_bite = 0x7f, |
Christian Lavoie | cbf87cb | 2010-11-28 14:34:26 +0000 | [diff] [blame] | 40 | 4: i16 integer16 = 0x7fff, |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 41 | 5: i32 integer32, |
David Reiss | a8efac8 | 2008-12-16 20:28:13 +0000 | [diff] [blame] | 42 | 6: i64 integer64 = 10000000000, |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 43 | 7: double double_precision, |
| 44 | 8: string some_characters, |
| 45 | 9: string zomg_unicode, |
| 46 | 10: bool what_who, |
David Reiss | db0ea15 | 2008-02-18 01:49:37 +0000 | [diff] [blame] | 47 | 11: binary base64, |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 48 | 12: list<i8> byte_list = [1, 2, 3], |
David Reiss | a8efac8 | 2008-12-16 20:28:13 +0000 | [diff] [blame] | 49 | 13: list<i16> i16_list = [1,2,3], |
| 50 | 14: list<i64> i64_list = [1,2,3] |
Jens Geyer | 62445c1 | 2022-06-29 00:00:00 +0200 | [diff] [blame] | 51 | 15: uuid rfc4122_uuid |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | struct Bonk { |
| 55 | 1: i32 type, |
| 56 | 2: string message, |
| 57 | } |
| 58 | |
| 59 | struct Nesting { |
| 60 | 1: Bonk my_bonk, |
| 61 | 2: OneOfEach my_ooe, |
| 62 | } |
| 63 | |
| 64 | struct HolyMoley { |
| 65 | 1: list<OneOfEach> big, |
Nobuaki Sukegawa | 7b89469 | 2015-12-23 21:45:06 +0900 | [diff] [blame] | 66 | 2: set<list<string> (python.immutable = "")> contain, |
David Reiss | 00dcccf | 2007-07-21 01:18:10 +0000 | [diff] [blame] | 67 | 3: map<string,list<Bonk>> bonks, |
| 68 | } |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 69 | |
| 70 | struct Backwards { |
| 71 | 2: i32 first_tag2, |
| 72 | 1: i32 second_tag1, |
| 73 | } |
| 74 | |
| 75 | struct Empty { |
Nobuaki Sukegawa | e841b3d | 2015-11-17 11:01:17 +0900 | [diff] [blame] | 76 | } ( |
| 77 | python.immutable = "", |
| 78 | ) |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 79 | |
| 80 | struct Wrapper { |
| 81 | 1: Empty foo |
Nobuaki Sukegawa | e841b3d | 2015-11-17 11:01:17 +0900 | [diff] [blame] | 82 | } ( |
| 83 | python.immutable = "", |
| 84 | ) |
David Reiss | 382fc30 | 2007-08-25 18:01:30 +0000 | [diff] [blame] | 85 | |
| 86 | struct RandomStuff { |
| 87 | 1: i32 a, |
| 88 | 2: i32 b, |
| 89 | 3: i32 c, |
| 90 | 4: i32 d, |
| 91 | 5: list<i32> myintlist, |
| 92 | 6: map<i32,Wrapper> maps, |
| 93 | 7: i64 bigint, |
| 94 | 8: double triple, |
| 95 | } |
| 96 | |
David Reiss | 4a8f46c | 2008-03-07 20:12:07 +0000 | [diff] [blame] | 97 | struct Base64 { |
| 98 | 1: i32 a, |
| 99 | 2: binary b1, |
| 100 | 3: binary b2, |
| 101 | 4: binary b3, |
| 102 | 5: binary b4, |
| 103 | 6: binary b5, |
| 104 | 7: binary b6, |
| 105 | } |
| 106 | |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 107 | struct CompactProtoTestStruct { |
| 108 | // primitive fields |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 109 | 1: i8 a_byte; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 110 | 2: i16 a_i16; |
| 111 | 3: i32 a_i32; |
| 112 | 4: i64 a_i64; |
| 113 | 5: double a_double; |
| 114 | 6: string a_string; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 115 | 7: binary a_binary; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 116 | 8: bool true_field; |
| 117 | 9: bool false_field; |
| 118 | 10: Empty empty_struct_field; |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 119 | |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 120 | // primitives in lists |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 121 | 11: list<i8> byte_list; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 122 | 12: list<i16> i16_list; |
| 123 | 13: list<i32> i32_list; |
| 124 | 14: list<i64> i64_list; |
| 125 | 15: list<double> double_list; |
| 126 | 16: list<string> string_list; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 127 | 17: list<binary> binary_list; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 128 | 18: list<bool> boolean_list; |
| 129 | 19: list<Empty> struct_list; |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 130 | |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 131 | // primitives in sets |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 132 | 20: set<i8> byte_set; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 133 | 21: set<i16> i16_set; |
| 134 | 22: set<i32> i32_set; |
| 135 | 23: set<i64> i64_set; |
| 136 | 24: set<double> double_set; |
| 137 | 25: set<string> string_set; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 138 | 26: set<binary> binary_set; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 139 | 27: set<bool> boolean_set; |
| 140 | 28: set<Empty> struct_set; |
Jens Geyer | aaa8947 | 2014-10-03 20:22:28 +0200 | [diff] [blame] | 141 | |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 142 | // maps |
| 143 | // primitives as keys |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 144 | 29: map<i8, i8> byte_byte_map; |
| 145 | 30: map<i16, i8> i16_byte_map; |
| 146 | 31: map<i32, i8> i32_byte_map; |
| 147 | 32: map<i64, i8> i64_byte_map; |
| 148 | 33: map<double, i8> double_byte_map; |
| 149 | 34: map<string, i8> string_byte_map; |
| 150 | 35: map<binary, i8> binary_byte_map; |
| 151 | 36: map<bool, i8> boolean_byte_map; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 152 | // primitives as values |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 153 | 37: map<i8, i16> byte_i16_map; |
| 154 | 38: map<i8, i32> byte_i32_map; |
| 155 | 39: map<i8, i64> byte_i64_map; |
| 156 | 40: map<i8, double> byte_double_map; |
| 157 | 41: map<i8, string> byte_string_map; |
| 158 | 42: map<i8, binary> byte_binary_map; |
| 159 | 43: map<i8, bool> byte_boolean_map; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 160 | // collections as keys |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 161 | 44: map<list<i8> (python.immutable = ""), i8> list_byte_map; |
| 162 | 45: map<set<i8> (python.immutable = ""), i8> set_byte_map; |
| 163 | 46: map<map<i8,i8> (python.immutable = ""), i8> map_byte_map; |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 164 | // collections as values |
Nobuaki Sukegawa | eb344a8 | 2016-03-25 09:37:18 +0900 | [diff] [blame] | 165 | 47: map<i8, map<i8,i8>> byte_map_map; |
| 166 | 48: map<i8, set<i8>> byte_set_map; |
| 167 | 49: map<i8, list<i8>> byte_list_map; |
Jens Geyer | a715f70 | 2019-08-28 22:56:13 +0200 | [diff] [blame] | 168 | |
| 169 | // large field IDs |
| 170 | 500 : i64 field500; |
| 171 | 5000 : i64 field5000; |
| 172 | 20000 : i64 field20000; |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 173 | } |
| 174 | |
Bryan Duxbury | e80a194 | 2011-09-20 18:45:56 +0000 | [diff] [blame] | 175 | // To be used to test the serialization of an empty map |
| 176 | struct SingleMapTestStruct { |
| 177 | 1: required map<i32, i32> i32_map; |
| 178 | } |
David Reiss | fe5b77d | 2009-04-07 20:51:48 +0000 | [diff] [blame] | 179 | |
| 180 | const CompactProtoTestStruct COMPACT_TEST = { |
| 181 | 'a_byte' : 127, |
| 182 | 'a_i16' : 32000, |
| 183 | 'a_i32' : 1000000000, |
| 184 | 'a_i64' : 0xffffffffff, |
| 185 | 'a_double' : 5.6789, |
| 186 | 'a_string' : "my string", |
| 187 | //'a_binary,' |
| 188 | 'true_field' : 1, |
| 189 | 'false_field' : 0, |
| 190 | 'empty_struct_field' : {}, |
| 191 | 'byte_list' : [-127, -1, 0, 1, 127], |
| 192 | 'i16_list' : [-1, 0, 1, 0x7fff], |
| 193 | 'i32_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0x7fffffff], |
| 194 | 'i64_list' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff], |
| 195 | 'double_list' : [0.1, 0.2, 0.3], |
| 196 | 'string_list' : ["first", "second", "third"], |
| 197 | //'binary_list,' |
| 198 | 'boolean_list' : [1, 1, 1, 0, 0, 0], |
| 199 | 'struct_list' : [{}, {}], |
| 200 | 'byte_set' : [-127, -1, 0, 1, 127], |
| 201 | 'i16_set' : [-1, 0, 1, 0x7fff], |
| 202 | 'i32_set' : [1, 2, 3], |
| 203 | 'i64_set' : [-1, 0, 0xff, 0xffff, 0xffffff, 0xffffffff, 0xffffffffff, 0xffffffffffff, 0xffffffffffffff, 0x7fffffffffffffff], |
| 204 | 'double_set' : [0.1, 0.2, 0.3], |
| 205 | 'string_set' : ["first", "second", "third"], |
| 206 | //'binary_set,' |
| 207 | 'boolean_set' : [1, 0], |
| 208 | 'struct_set' : [{}], |
| 209 | 'byte_byte_map' : {1 : 2}, |
| 210 | 'i16_byte_map' : {1 : 1, -1 : 1, 0x7fff : 1}, |
| 211 | 'i32_byte_map' : {1 : 1, -1 : 1, 0x7fffffff : 1}, |
| 212 | 'i64_byte_map' : {0 : 1, 1 : 1, -1 : 1, 0x7fffffffffffffff : 1}, |
| 213 | 'double_byte_map' : {-1.1 : 1, 1.1 : 1}, |
| 214 | 'string_byte_map' : {"first" : 1, "second" : 2, "third" : 3, "" : 0}, |
| 215 | //'binary_byte_map,' |
| 216 | 'boolean_byte_map' : {1 : 1, 0 : 0}, |
| 217 | 'byte_i16_map' : {1 : 1, 2 : -1, 3 : 0x7fff}, |
| 218 | 'byte_i32_map' : {1 : 1, 2 : -1, 3 : 0x7fffffff}, |
| 219 | 'byte_i64_map' : {1 : 1, 2 : -1, 3 : 0x7fffffffffffffff}, |
| 220 | 'byte_double_map' : {1 : 0.1, 2 : -0.1, 3 : 1000000.1}, |
| 221 | 'byte_string_map' : {1 : "", 2 : "blah", 3 : "loooooooooooooong string"}, |
| 222 | //'byte_binary_map,' |
| 223 | 'byte_boolean_map' : {1 : 1, 2 : 0}, |
| 224 | 'list_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}, |
| 225 | 'set_byte_map' : {[1, 2, 3] : 1, [0, 1] : 2, [] : 0}, |
| 226 | 'map_byte_map' : {{1 : 1} : 1, {2 : 2} : 2, {} : 0}, |
| 227 | 'byte_map_map' : {0 : {}, 1 : {1 : 1}, 2 : {1 : 1, 2 : 2}}, |
| 228 | 'byte_set_map' : {0 : [], 1 : [1], 2 : [1, 2]}, |
| 229 | 'byte_list_map' : {0 : [], 1 : [1], 2 : [1, 2]}, |
Jens Geyer | 8ff8abd | 2019-09-10 00:30:05 +0200 | [diff] [blame] | 230 | |
| 231 | 'field500' : 500, |
| 232 | 'field5000' : 5000, |
| 233 | 'field20000' : 20000, |
Bryan Duxbury | 538e344 | 2009-02-10 04:49:39 +0000 | [diff] [blame] | 234 | } |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 235 | |
| 236 | |
Bryan Duxbury | 2d80470 | 2009-12-18 19:41:11 +0000 | [diff] [blame] | 237 | const i32 MYCONST = 2 |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 238 | |
Bryan Duxbury | 986d50f | 2009-12-31 18:18:00 +0000 | [diff] [blame] | 239 | |
| 240 | exception ExceptionWithAMap { |
| 241 | 1: string blah; |
| 242 | 2: map<string, string> map_field; |
| 243 | } |
| 244 | |
Elvis Pranskevichus | 9c43962 | 2019-12-11 16:47:52 -0500 | [diff] [blame] | 245 | exception MutableException { |
| 246 | 1: string msg; |
| 247 | } (python.immutable = "false") |
| 248 | |
Neil Williams | 055fe67 | 2021-02-16 15:12:15 -0800 | [diff] [blame] | 249 | exception ExceptionWithoutFields {} |
| 250 | |
Bryan Duxbury | 986d50f | 2009-12-31 18:18:00 +0000 | [diff] [blame] | 251 | service ServiceForExceptionWithAMap { |
| 252 | void methodThatThrowsAnException() throws (1: ExceptionWithAMap xwamap); |
| 253 | } |
| 254 | |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 255 | service Srv { |
David Reiss | 689c9ad | 2009-04-02 19:24:02 +0000 | [diff] [blame] | 256 | i32 Janky(1: i32 arg); |
Bryan Duxbury | d58ccec | 2010-05-26 16:34:48 +0000 | [diff] [blame] | 257 | |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 258 | // return type only methods |
Bryan Duxbury | d58ccec | 2010-05-26 16:34:48 +0000 | [diff] [blame] | 259 | |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 260 | void voidMethod(); |
| 261 | i32 primitiveMethod(); |
| 262 | CompactProtoTestStruct structMethod(); |
Bryan Duxbury | d58ccec | 2010-05-26 16:34:48 +0000 | [diff] [blame] | 263 | |
Bryan Duxbury | 2d80470 | 2009-12-18 19:41:11 +0000 | [diff] [blame] | 264 | void methodWithDefaultArgs(1: i32 something = MYCONST); |
Bryan Duxbury | d58ccec | 2010-05-26 16:34:48 +0000 | [diff] [blame] | 265 | |
| 266 | oneway void onewayMethod(); |
John Sirois | bd964c7 | 2016-02-08 13:04:36 -0700 | [diff] [blame] | 267 | |
| 268 | bool declaredExceptionMethod(1: bool shouldThrow) throws (1: ExceptionWithAMap xwamap); |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 269 | } |
| 270 | |
| 271 | service Inherited extends Srv { |
David Reiss | 689c9ad | 2009-04-02 19:24:02 +0000 | [diff] [blame] | 272 | i32 identity(1: i32 arg) |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | service EmptyService {} |
| 276 | |
| 277 | // The only purpose of this thing is to increase the size of the generated code |
| 278 | // so that ZlibTest has more highly compressible data to play with. |
| 279 | struct BlowUp { |
Nobuaki Sukegawa | 7b89469 | 2015-12-23 21:45:06 +0900 | [diff] [blame] | 280 | 1: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b1; |
| 281 | 2: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b2; |
| 282 | 3: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b3; |
| 283 | 4: map<list<i32>(python.immutable = ""),set<map<i32,string> (python.immutable = "")>> b4; |
Bryan Duxbury | 5b8b484 | 2009-04-01 20:10:15 +0000 | [diff] [blame] | 284 | } |
| 285 | |
Bryan Duxbury | ff219ac | 2009-04-10 21:51:00 +0000 | [diff] [blame] | 286 | |
| 287 | struct ReverseOrderStruct { |
| 288 | 4: string first; |
| 289 | 3: i16 second; |
| 290 | 2: i32 third; |
| 291 | 1: i64 fourth; |
| 292 | } |
| 293 | |
| 294 | service ReverseOrderService { |
| 295 | void myMethod(4: string first, 3: i16 second, 2: i32 third, 1: i64 fourth); |
Bryan Duxbury | ab3666e | 2009-09-01 23:03:47 +0000 | [diff] [blame] | 296 | } |
| 297 | |
Bryan Duxbury | 9af23d9 | 2009-11-19 17:26:38 +0000 | [diff] [blame] | 298 | enum SomeEnum { |
Bryan Duxbury | 2d80470 | 2009-12-18 19:41:11 +0000 | [diff] [blame] | 299 | ONE = 1 |
| 300 | TWO = 2 |
| 301 | } |
| 302 | |
Bryan Duxbury | d4235e0 | 2010-09-13 16:28:53 +0000 | [diff] [blame] | 303 | /** This is a docstring on a constant! */ |
Bryan Duxbury | 6e05e25 | 2010-09-12 15:22:49 +0000 | [diff] [blame] | 304 | const SomeEnum MY_SOME_ENUM = SomeEnum.ONE |
Bryan Duxbury | 2d80470 | 2009-12-18 19:41:11 +0000 | [diff] [blame] | 305 | |
| 306 | const SomeEnum MY_SOME_ENUM_1 = 1 |
| 307 | /*const SomeEnum MY_SOME_ENUM_2 = 7*/ |
| 308 | |
| 309 | const map<SomeEnum,SomeEnum> MY_ENUM_MAP = { |
Bryan Duxbury | 6e05e25 | 2010-09-12 15:22:49 +0000 | [diff] [blame] | 310 | SomeEnum.ONE : SomeEnum.TWO |
Bryan Duxbury | 2d80470 | 2009-12-18 19:41:11 +0000 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | struct StructWithSomeEnum { |
| 314 | 1: SomeEnum blah; |
| 315 | } |
| 316 | |
| 317 | const map<SomeEnum,StructWithSomeEnum> EXTRA_CRAZY_MAP = { |
Bryan Duxbury | 6e05e25 | 2010-09-12 15:22:49 +0000 | [diff] [blame] | 318 | SomeEnum.ONE : {"blah" : SomeEnum.TWO} |
Bryan Duxbury | 9af23d9 | 2009-11-19 17:26:38 +0000 | [diff] [blame] | 319 | } |
| 320 | |
Bryan Duxbury | ab3666e | 2009-09-01 23:03:47 +0000 | [diff] [blame] | 321 | union TestUnion { |
| 322 | /** |
| 323 | * A doc string |
| 324 | */ |
| 325 | 1: string string_field; |
| 326 | 2: i32 i32_field; |
| 327 | 3: OneOfEach struct_field; |
| 328 | 4: list<RandomStuff> struct_list; |
| 329 | 5: i32 other_i32_field; |
Bryan Duxbury | 9af23d9 | 2009-11-19 17:26:38 +0000 | [diff] [blame] | 330 | 6: SomeEnum enum_field; |
Bryan Duxbury | 162b3ac | 2010-06-23 21:17:48 +0000 | [diff] [blame] | 331 | 7: set<i32> i32_set; |
| 332 | 8: map<i32, i32> i32_map; |
Bryan Duxbury | ab3666e | 2009-09-01 23:03:47 +0000 | [diff] [blame] | 333 | } |
| 334 | |
Bryan Duxbury | c2ec7ca | 2009-12-31 18:59:15 +0000 | [diff] [blame] | 335 | union TestUnionMinusStringField { |
| 336 | 2: i32 i32_field; |
| 337 | 3: OneOfEach struct_field; |
| 338 | 4: list<RandomStuff> struct_list; |
| 339 | 5: i32 other_i32_field; |
| 340 | 6: SomeEnum enum_field; |
Bryan Duxbury | 162b3ac | 2010-06-23 21:17:48 +0000 | [diff] [blame] | 341 | 7: set<i32> i32_set; |
| 342 | 8: map<i32, i32> i32_map; |
Bryan Duxbury | c2ec7ca | 2009-12-31 18:59:15 +0000 | [diff] [blame] | 343 | } |
| 344 | |
Bryan Duxbury | e2e4ea1 | 2009-11-11 21:01:35 +0000 | [diff] [blame] | 345 | union ComparableUnion { |
| 346 | 1: string string_field; |
| 347 | 2: binary binary_field; |
| 348 | } |
| 349 | |
Bryan Duxbury | ab3666e | 2009-09-01 23:03:47 +0000 | [diff] [blame] | 350 | struct StructWithAUnion { |
| 351 | 1: TestUnion test_union; |
Bryan Duxbury | 51f2880 | 2009-10-01 20:53:45 +0000 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | struct PrimitiveThenStruct { |
| 355 | 1: i32 blah; |
| 356 | 2: i32 blah2; |
| 357 | 3: Backwards bw; |
Bryan Duxbury | 2845b16 | 2009-11-09 15:55:22 +0000 | [diff] [blame] | 358 | } |
| 359 | |
| 360 | typedef map<i32,i32> SomeMap |
| 361 | |
| 362 | struct StructWithASomemap { |
| 363 | 1: required SomeMap somemap_field; |
Bryan Duxbury | 986d50f | 2009-12-31 18:18:00 +0000 | [diff] [blame] | 364 | } |
Bryan Duxbury | 35565a4 | 2010-01-06 23:12:09 +0000 | [diff] [blame] | 365 | |
| 366 | struct BigFieldIdStruct { |
| 367 | 1: string field1; |
| 368 | 45: string field2; |
| 369 | } |
| 370 | |
| 371 | struct BreaksRubyCompactProtocol { |
| 372 | 1: string field1; |
| 373 | 2: BigFieldIdStruct field2; |
| 374 | 3: i32 field3; |
Bryan Duxbury | 162b3ac | 2010-06-23 21:17:48 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Bryan Duxbury | 40d51a2 | 2011-09-26 21:29:15 +0000 | [diff] [blame] | 377 | struct TupleProtocolTestStruct { |
| 378 | optional i32 field1; |
| 379 | optional i32 field2; |
| 380 | optional i32 field3; |
| 381 | optional i32 field4; |
| 382 | optional i32 field5; |
| 383 | optional i32 field6; |
| 384 | optional i32 field7; |
| 385 | optional i32 field8; |
| 386 | optional i32 field9; |
| 387 | optional i32 field10; |
| 388 | optional i32 field11; |
| 389 | optional i32 field12; |
Ben Craig | 384f976 | 2015-07-08 20:33:03 -0500 | [diff] [blame] | 390 | } |
| 391 | |
| 392 | struct ListDoublePerf { |
| 393 | 1: list<double> field; |
| 394 | } |