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