Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [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 | |
| 20 | % don't rename this thrift_test, it clobbers generated files |
| 21 | -module(thrift_test_test). |
Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [diff] [blame] | 22 | |
| 23 | -include_lib("eunit/include/eunit.hrl"). |
| 24 | |
Nobuaki Sukegawa | 826ea99 | 2015-10-28 22:19:45 +0900 | [diff] [blame] | 25 | -include("gen-erl/thrift_test_constants.hrl"). |
Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [diff] [blame] | 26 | |
| 27 | constant_test_() -> |
Sergei Elin | 4576409 | 2022-09-23 23:21:31 +0300 | [diff] [blame^] | 28 | [ |
| 29 | {"myNumberz equals 1", ?_assertEqual(1, ?THRIFT_TEST_MYNUMBERZ)} |
| 30 | ]. |
Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [diff] [blame] | 31 | |
| 32 | record_generation_test_() -> |
Sergei Elin | 4576409 | 2022-09-23 23:21:31 +0300 | [diff] [blame^] | 33 | [ |
| 34 | {"Bonk record", |
| 35 | ?_assertMatch( |
| 36 | {'thrift.test.Bonk', _, _}, |
| 37 | #'thrift.test.Bonk'{message = null, type = null} |
| 38 | )}, |
| 39 | {"Bools record", |
| 40 | ?_assertMatch( |
| 41 | {'thrift.test.Bools', _, _}, |
| 42 | #'thrift.test.Bools'{im_true = null, im_false = null} |
| 43 | )}, |
| 44 | {"Xtruct record", |
| 45 | ?_assertMatch( |
| 46 | {'thrift.test.Xtruct', _, _, _, _}, |
| 47 | #'thrift.test.Xtruct'{ |
| 48 | string_thing = null, byte_thing = null, i32_thing = null, i64_thing = null |
| 49 | } |
| 50 | )}, |
| 51 | {"Xtruct2 record", |
| 52 | ?_assertMatch( |
| 53 | {'thrift.test.Xtruct2', _, _, _}, |
| 54 | #'thrift.test.Xtruct2'{byte_thing = null, struct_thing = null, i32_thing = null} |
| 55 | )}, |
| 56 | {"Xtruct3 record", |
| 57 | ?_assertMatch( |
| 58 | {'thrift.test.Xtruct3', _, _, _, _}, |
| 59 | #'thrift.test.Xtruct3'{ |
| 60 | string_thing = null, changed = null, i32_thing = null, i64_thing = null |
| 61 | } |
| 62 | )}, |
| 63 | {"Insanity record", |
| 64 | ?_assertMatch( |
| 65 | {'thrift.test.Insanity', _, _}, |
| 66 | #'thrift.test.Insanity'{userMap = null, xtructs = null} |
| 67 | )}, |
| 68 | {"CrazyNesting record", |
| 69 | ?_assertMatch( |
| 70 | {'thrift.test.CrazyNesting', _, _, _, _}, |
| 71 | #'thrift.test.CrazyNesting'{ |
| 72 | string_field = null, |
| 73 | set_field = null, |
| 74 | list_field = null, |
| 75 | binary_field = null |
| 76 | } |
| 77 | )}, |
| 78 | {"Xception record", |
| 79 | ?_assertMatch( |
| 80 | {'thrift.test.Xception', _, _}, |
| 81 | #'thrift.test.Xception'{errorCode = null, message = null} |
| 82 | )}, |
| 83 | {"Xception2 record", |
| 84 | ?_assertMatch( |
| 85 | {'thrift.test.Xception2', _, _}, |
| 86 | #'thrift.test.Xception2'{errorCode = null, struct_thing = null} |
| 87 | )}, |
| 88 | {"EmptyStruct record", |
| 89 | ?_assertMatch({'thrift.test.EmptyStruct'}, #'thrift.test.EmptyStruct'{})}, |
| 90 | {"OneField record", |
| 91 | ?_assertMatch({'thrift.test.OneField', _}, #'thrift.test.OneField'{field = null})}, |
| 92 | {"VersioningTestV1 record", |
| 93 | ?_assertMatch( |
| 94 | {'thrift.test.VersioningTestV1', _, _, _}, |
| 95 | #'thrift.test.VersioningTestV1'{ |
| 96 | begin_in_both = null, old_string = null, end_in_both = null |
| 97 | } |
| 98 | )}, |
| 99 | {"VersioningTestV2 record", |
| 100 | ?_assertMatch( |
| 101 | {'thrift.test.VersioningTestV2', _, _, _, _, _, _, _, _, _, _, _, _}, |
| 102 | #'thrift.test.VersioningTestV2'{ |
| 103 | begin_in_both = null, |
| 104 | newint = null, |
| 105 | newbyte = null, |
| 106 | newshort = null, |
| 107 | newlong = null, |
| 108 | newdouble = null, |
| 109 | newstruct = null, |
| 110 | newlist = null, |
| 111 | newset = null, |
| 112 | newmap = null, |
| 113 | newstring = null, |
| 114 | end_in_both = null |
| 115 | } |
| 116 | )}, |
| 117 | {"ListTypeVersioningV1 record", |
| 118 | ?_assertMatch( |
| 119 | {'thrift.test.ListTypeVersioningV1', _, _}, |
| 120 | #'thrift.test.ListTypeVersioningV1'{myints = null, hello = null} |
| 121 | )}, |
| 122 | {"ListTypeVersioningV2 record", |
| 123 | ?_assertMatch( |
| 124 | {'thrift.test.ListTypeVersioningV2', _, _}, |
| 125 | #'thrift.test.ListTypeVersioningV2'{strings = null, hello = null} |
| 126 | )}, |
| 127 | {"GuessProtocolStruct record", |
| 128 | ?_assertMatch( |
| 129 | {'thrift.test.GuessProtocolStruct', _}, |
| 130 | #'thrift.test.GuessProtocolStruct'{map_field = null} |
| 131 | )}, |
| 132 | {"LargeDeltas record", |
| 133 | ?_assertMatch( |
| 134 | {'thrift.test.LargeDeltas', _, _, _, _, _, _, _, _, _, _}, |
| 135 | #'thrift.test.LargeDeltas'{ |
| 136 | b1 = null, |
| 137 | b10 = null, |
| 138 | b100 = null, |
| 139 | check_true = null, |
| 140 | b1000 = null, |
| 141 | check_false = null, |
| 142 | vertwo2000 = null, |
| 143 | a_set2500 = null, |
| 144 | vertwo3000 = null, |
| 145 | big_numbers = null |
| 146 | } |
| 147 | )}, |
| 148 | {"NestedListsI32x2 record", |
| 149 | ?_assertMatch( |
| 150 | {'thrift.test.NestedListsI32x2', _}, |
| 151 | #'thrift.test.NestedListsI32x2'{integerlist = null} |
| 152 | )}, |
| 153 | {"NestedListsI32x3 record", |
| 154 | ?_assertMatch( |
| 155 | {'thrift.test.NestedListsI32x3', _}, |
| 156 | #'thrift.test.NestedListsI32x3'{integerlist = null} |
| 157 | )}, |
| 158 | {"NestedMixedx2 record", |
| 159 | ?_assertMatch( |
| 160 | {'thrift.test.NestedMixedx2', _, _, _}, |
| 161 | #'thrift.test.NestedMixedx2'{ |
| 162 | int_set_list = null, |
| 163 | map_int_strset = null, |
| 164 | map_int_strset_list = null |
| 165 | } |
| 166 | )}, |
| 167 | {"ListBonks record", |
| 168 | ?_assertMatch({'thrift.test.ListBonks', _}, #'thrift.test.ListBonks'{bonk = null})}, |
| 169 | {"NestedListsBonk record", |
| 170 | ?_assertMatch( |
| 171 | {'thrift.test.NestedListsBonk', _}, |
| 172 | #'thrift.test.NestedListsBonk'{bonk = null} |
| 173 | )}, |
| 174 | {"BoolTest record", |
| 175 | ?_assertMatch( |
| 176 | {'thrift.test.BoolTest', _, _}, |
| 177 | #'thrift.test.BoolTest'{b = null, s = null} |
| 178 | )}, |
| 179 | {"StructA record", |
| 180 | ?_assertMatch({'thrift.test.StructA', _}, #'thrift.test.StructA'{s = null})}, |
| 181 | {"StructB record", |
| 182 | ?_assertMatch( |
| 183 | {'thrift.test.StructB', _, _}, |
| 184 | #'thrift.test.StructB'{aa = null, ab = null} |
| 185 | )} |
| 186 | ]. |
Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [diff] [blame] | 187 | |
| 188 | struct_info_test_() -> |
Sergei Elin | 4576409 | 2022-09-23 23:21:31 +0300 | [diff] [blame^] | 189 | [ |
| 190 | {"Bonk definition (short version)", |
| 191 | ?_assertEqual( |
| 192 | {struct, [{1, string}, {2, i32}]}, |
| 193 | thrift_test_types:struct_info('thrift.test.Bonk') |
| 194 | )}, |
| 195 | {"Bonk definition", |
| 196 | ?_assertEqual( |
| 197 | {struct, [ |
| 198 | {1, undefined, string, message, undefined}, |
| 199 | {2, undefined, i32, type, undefined} |
| 200 | ]}, |
| 201 | thrift_test_types:struct_info_ext('thrift.test.Bonk') |
| 202 | )}, |
| 203 | {"Bools definition", |
| 204 | ?_assertEqual( |
| 205 | {struct, [ |
| 206 | {1, undefined, bool, im_true, undefined}, |
| 207 | {2, undefined, bool, im_false, undefined} |
| 208 | ]}, |
| 209 | thrift_test_types:struct_info_ext('thrift.test.Bools') |
| 210 | )}, |
| 211 | {"Xtruct definition", |
| 212 | ?_assertEqual( |
| 213 | {struct, [ |
| 214 | {1, undefined, string, string_thing, undefined}, |
| 215 | {4, undefined, byte, byte_thing, undefined}, |
| 216 | {9, undefined, i32, i32_thing, undefined}, |
| 217 | {11, undefined, i64, i64_thing, undefined} |
| 218 | ]}, |
| 219 | thrift_test_types:struct_info_ext('thrift.test.Xtruct') |
| 220 | )}, |
| 221 | {"Xtruct2 definition", |
| 222 | ?_assertEqual( |
| 223 | {struct, [ |
| 224 | {1, undefined, byte, byte_thing, undefined}, |
| 225 | {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, |
| 226 | struct_thing, #'thrift.test.Xtruct'{}}, |
| 227 | {3, undefined, i32, i32_thing, undefined} |
| 228 | ]}, |
| 229 | thrift_test_types:struct_info_ext('thrift.test.Xtruct2') |
| 230 | )}, |
| 231 | {"Xtruct3 definition", |
| 232 | ?_assertEqual( |
| 233 | {struct, [ |
| 234 | {1, undefined, string, string_thing, undefined}, |
| 235 | {4, undefined, i32, changed, undefined}, |
| 236 | {9, undefined, i32, i32_thing, undefined}, |
| 237 | {11, undefined, i64, i64_thing, undefined} |
| 238 | ]}, |
| 239 | thrift_test_types:struct_info_ext('thrift.test.Xtruct3') |
| 240 | )}, |
| 241 | {"Insanity definition", |
| 242 | ?_assertEqual( |
| 243 | {struct, [ |
| 244 | {1, undefined, {map, i32, i64}, userMap, dict:new()}, |
| 245 | {2, undefined, {list, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}}, |
| 246 | xtructs, []} |
| 247 | ]}, |
| 248 | thrift_test_types:struct_info_ext('thrift.test.Insanity') |
| 249 | )}, |
| 250 | {"CrazyNesting definition", |
| 251 | ?_assertEqual( |
| 252 | {struct, [ |
| 253 | {1, undefined, string, string_field, undefined}, |
| 254 | {2, optional, {set, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}, |
| 255 | set_field, sets:new()}, |
| 256 | {3, required, |
| 257 | {list, |
| 258 | {map, {set, i32}, |
| 259 | {map, i32, |
| 260 | {set, |
| 261 | {list, |
| 262 | {map, |
| 263 | {struct, |
| 264 | {'thrift_test_types', 'thrift.test.Insanity'}}, |
| 265 | string}}}}}}, |
| 266 | list_field, []}, |
| 267 | {4, undefined, string, binary_field, undefined} |
| 268 | ]}, |
| 269 | thrift_test_types:struct_info_ext('thrift.test.CrazyNesting') |
| 270 | )}, |
| 271 | {"Xception definition", |
| 272 | ?_assertEqual( |
| 273 | {struct, [ |
| 274 | {1, undefined, i32, errorCode, undefined}, |
| 275 | {2, undefined, string, message, undefined} |
| 276 | ]}, |
| 277 | thrift_test_types:struct_info_ext('thrift.test.Xception') |
| 278 | )}, |
| 279 | {"Xception2 definition", |
| 280 | ?_assertEqual( |
| 281 | {struct, [ |
| 282 | {1, undefined, i32, errorCode, undefined}, |
| 283 | {2, undefined, {struct, {'thrift_test_types', 'thrift.test.Xtruct'}}, |
| 284 | struct_thing, #'thrift.test.Xtruct'{}} |
| 285 | ]}, |
| 286 | thrift_test_types:struct_info_ext('thrift.test.Xception2') |
| 287 | )}, |
| 288 | {"EmptyStruct definition", |
| 289 | ?_assertEqual( |
| 290 | {struct, []}, |
| 291 | thrift_test_types:struct_info_ext('thrift.test.EmptyStruct') |
| 292 | )}, |
| 293 | {"OneField definition", |
| 294 | ?_assertEqual( |
| 295 | {struct, [ |
| 296 | {1, undefined, {struct, {'thrift_test_types', 'thrift.test.EmptyStruct'}}, |
| 297 | field, #'thrift.test.EmptyStruct'{}} |
| 298 | ]}, |
| 299 | thrift_test_types:struct_info_ext('thrift.test.OneField') |
| 300 | )}, |
| 301 | {"VersioningTestV1 definition", |
| 302 | ?_assertEqual( |
| 303 | {struct, [ |
| 304 | {1, undefined, i32, begin_in_both, undefined}, |
| 305 | {3, undefined, string, old_string, undefined}, |
| 306 | {12, undefined, i32, end_in_both, undefined} |
| 307 | ]}, |
| 308 | thrift_test_types:struct_info_ext('thrift.test.VersioningTestV1') |
| 309 | )}, |
| 310 | {"VersioningTestV2 definition", |
| 311 | ?_assertEqual( |
| 312 | {struct, [ |
| 313 | {1, undefined, i32, begin_in_both, undefined}, |
| 314 | {2, undefined, i32, newint, undefined}, |
| 315 | {3, undefined, byte, newbyte, undefined}, |
| 316 | {4, undefined, i16, newshort, undefined}, |
| 317 | {5, undefined, i64, newlong, undefined}, |
| 318 | {6, undefined, double, newdouble, undefined}, |
| 319 | {7, undefined, {struct, {thrift_test_types, 'thrift.test.Bonk'}}, newstruct, |
| 320 | #'thrift.test.Bonk'{}}, |
| 321 | {8, undefined, {list, i32}, newlist, []}, |
| 322 | {9, undefined, {set, i32}, newset, sets:new()}, |
| 323 | {10, undefined, {map, i32, i32}, newmap, dict:new()}, |
| 324 | {11, undefined, string, newstring, undefined}, |
| 325 | {12, undefined, i32, end_in_both, undefined} |
| 326 | ]}, |
| 327 | thrift_test_types:struct_info_ext('thrift.test.VersioningTestV2') |
| 328 | )}, |
| 329 | {"ListTypeVersioningV1 definition", |
| 330 | ?_assertEqual( |
| 331 | {struct, [ |
| 332 | {1, undefined, {list, i32}, myints, []}, |
| 333 | {2, undefined, string, hello, undefined} |
| 334 | ]}, |
| 335 | thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV1') |
| 336 | )}, |
| 337 | {"ListTypeVersioningV2 definition", |
| 338 | ?_assertEqual( |
| 339 | {struct, [ |
| 340 | {1, undefined, {list, string}, strings, []}, |
| 341 | {2, undefined, string, hello, undefined} |
| 342 | ]}, |
| 343 | thrift_test_types:struct_info_ext('thrift.test.ListTypeVersioningV2') |
| 344 | )}, |
| 345 | {"GuessProtocolStruct definition", |
| 346 | ?_assertEqual( |
| 347 | {struct, [ |
| 348 | {7, undefined, {map, string, string}, map_field, dict:new()} |
| 349 | ]}, |
| 350 | thrift_test_types:struct_info_ext('thrift.test.GuessProtocolStruct') |
| 351 | )}, |
| 352 | {"LargeDeltas definition", |
| 353 | ?_assertEqual( |
| 354 | {struct, [ |
| 355 | {1, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1, |
| 356 | #'thrift.test.Bools'{}}, |
| 357 | {10, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b10, |
| 358 | #'thrift.test.Bools'{}}, |
| 359 | {100, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b100, |
| 360 | #'thrift.test.Bools'{}}, |
| 361 | {500, undefined, bool, check_true, undefined}, |
| 362 | {1000, undefined, {struct, {thrift_test_types, 'thrift.test.Bools'}}, b1000, |
| 363 | #'thrift.test.Bools'{}}, |
| 364 | {1500, undefined, bool, check_false, undefined}, |
| 365 | {2000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, |
| 366 | vertwo2000, #'thrift.test.VersioningTestV2'{}}, |
| 367 | {2500, undefined, {set, string}, a_set2500, sets:new()}, |
| 368 | {3000, undefined, {struct, {thrift_test_types, 'thrift.test.VersioningTestV2'}}, |
| 369 | vertwo3000, #'thrift.test.VersioningTestV2'{}}, |
| 370 | {4000, undefined, {list, i32}, big_numbers, []} |
| 371 | ]}, |
| 372 | thrift_test_types:struct_info_ext('thrift.test.LargeDeltas') |
| 373 | )}, |
| 374 | {"NestedListsI32x2 definition", |
| 375 | ?_assertEqual( |
| 376 | {struct, [ |
| 377 | {1, undefined, {list, {list, i32}}, integerlist, []} |
| 378 | ]}, |
| 379 | thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x2') |
| 380 | )}, |
| 381 | {"NestedListsI32x3 definition", |
| 382 | ?_assertEqual( |
| 383 | {struct, [ |
| 384 | {1, undefined, {list, {list, {list, i32}}}, integerlist, []} |
| 385 | ]}, |
| 386 | thrift_test_types:struct_info_ext('thrift.test.NestedListsI32x3') |
| 387 | )}, |
| 388 | {"NestedMixedx2 definition", |
| 389 | ?_assertEqual( |
| 390 | {struct, [ |
| 391 | {1, undefined, {list, {set, i32}}, int_set_list, []}, |
| 392 | {2, undefined, {map, i32, {set, string}}, map_int_strset, dict:new()}, |
| 393 | {3, undefined, {list, {map, i32, {set, string}}}, map_int_strset_list, []} |
| 394 | ]}, |
| 395 | thrift_test_types:struct_info_ext('thrift.test.NestedMixedx2') |
| 396 | )}, |
| 397 | {"ListBonks definition", |
| 398 | ?_assertEqual( |
| 399 | {struct, [ |
| 400 | {1, undefined, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}, bonk, |
| 401 | []} |
| 402 | ]}, |
| 403 | thrift_test_types:struct_info_ext('thrift.test.ListBonks') |
| 404 | )}, |
| 405 | {"NestedListsBonk definition", |
| 406 | ?_assertEqual( |
| 407 | {struct, [ |
| 408 | {1, undefined, |
| 409 | {list, {list, {list, {struct, {thrift_test_types, 'thrift.test.Bonk'}}}}}, |
| 410 | bonk, []} |
| 411 | ]}, |
| 412 | thrift_test_types:struct_info_ext('thrift.test.NestedListsBonk') |
| 413 | )}, |
| 414 | {"BoolTest definition", |
| 415 | ?_assertEqual( |
| 416 | {struct, [ |
| 417 | {1, optional, bool, b, true}, |
| 418 | {2, optional, string, s, "true"} |
| 419 | ]}, |
| 420 | thrift_test_types:struct_info_ext('thrift.test.BoolTest') |
| 421 | )}, |
| 422 | {"StructA definition", |
| 423 | ?_assertEqual( |
| 424 | {struct, [{1, required, string, s, undefined}]}, |
| 425 | thrift_test_types:struct_info_ext('thrift.test.StructA') |
| 426 | )}, |
| 427 | {"StructB definition", |
| 428 | ?_assertEqual( |
| 429 | {struct, [ |
| 430 | {1, optional, {struct, {thrift_test_types, 'thrift.test.StructA'}}, aa, |
| 431 | #'thrift.test.StructA'{}}, |
| 432 | {2, required, {struct, {thrift_test_types, 'thrift.test.StructA'}}, ab, |
| 433 | #'thrift.test.StructA'{}} |
| 434 | ]}, |
| 435 | thrift_test_types:struct_info_ext('thrift.test.StructB') |
| 436 | )} |
| 437 | ]. |
Jens Geyer | 6d15c30 | 2014-10-02 10:03:09 +0200 | [diff] [blame] | 438 | |
| 439 | service_info_test_() -> |
Sergei Elin | 4576409 | 2022-09-23 23:21:31 +0300 | [diff] [blame^] | 440 | [ |
| 441 | {"testVoid params", |
| 442 | ?_assertEqual( |
| 443 | {struct, []}, |
| 444 | thrift_test_thrift:function_info(testVoid, params_type) |
| 445 | )}, |
| 446 | {"testVoid reply", |
| 447 | ?_assertEqual( |
| 448 | {struct, []}, |
| 449 | thrift_test_thrift:function_info(testVoid, reply_type) |
| 450 | )}, |
| 451 | {"testVoid exceptions", |
| 452 | ?_assertEqual( |
| 453 | {struct, []}, |
| 454 | thrift_test_thrift:function_info(testVoid, exceptions) |
| 455 | )}, |
| 456 | {"testString params", |
| 457 | ?_assertEqual( |
| 458 | {struct, [{1, string}]}, |
| 459 | thrift_test_thrift:function_info(testString, params_type) |
| 460 | )}, |
| 461 | {"testString reply", |
| 462 | ?_assertEqual( |
| 463 | string, |
| 464 | thrift_test_thrift:function_info(testString, reply_type) |
| 465 | )}, |
| 466 | {"testString exceptions", |
| 467 | ?_assertEqual( |
| 468 | {struct, []}, |
| 469 | thrift_test_thrift:function_info(testString, exceptions) |
| 470 | )}, |
| 471 | {"testByte params", |
| 472 | ?_assertEqual( |
| 473 | {struct, [{1, byte}]}, |
| 474 | thrift_test_thrift:function_info(testByte, params_type) |
| 475 | )}, |
| 476 | {"testByte reply", |
| 477 | ?_assertEqual( |
| 478 | byte, |
| 479 | thrift_test_thrift:function_info(testByte, reply_type) |
| 480 | )}, |
| 481 | {"testByte exceptions", |
| 482 | ?_assertEqual( |
| 483 | {struct, []}, |
| 484 | thrift_test_thrift:function_info(testByte, exceptions) |
| 485 | )}, |
| 486 | {"testI32 params", |
| 487 | ?_assertEqual( |
| 488 | {struct, [{1, i32}]}, |
| 489 | thrift_test_thrift:function_info(testI32, params_type) |
| 490 | )}, |
| 491 | {"testI32 reply", |
| 492 | ?_assertEqual( |
| 493 | i32, |
| 494 | thrift_test_thrift:function_info(testI32, reply_type) |
| 495 | )}, |
| 496 | {"testI32 exceptions", |
| 497 | ?_assertEqual( |
| 498 | {struct, []}, |
| 499 | thrift_test_thrift:function_info(testI32, exceptions) |
| 500 | )}, |
| 501 | {"testI64 params", |
| 502 | ?_assertEqual( |
| 503 | {struct, [{1, i64}]}, |
| 504 | thrift_test_thrift:function_info(testI64, params_type) |
| 505 | )}, |
| 506 | {"testI64 reply", |
| 507 | ?_assertEqual( |
| 508 | i64, |
| 509 | thrift_test_thrift:function_info(testI64, reply_type) |
| 510 | )}, |
| 511 | {"testI64 exceptions", |
| 512 | ?_assertEqual( |
| 513 | {struct, []}, |
| 514 | thrift_test_thrift:function_info(testI64, exceptions) |
| 515 | )}, |
| 516 | {"testDouble params", |
| 517 | ?_assertEqual( |
| 518 | {struct, [{1, double}]}, |
| 519 | thrift_test_thrift:function_info(testDouble, params_type) |
| 520 | )}, |
| 521 | {"testDouble reply", |
| 522 | ?_assertEqual( |
| 523 | double, |
| 524 | thrift_test_thrift:function_info(testDouble, reply_type) |
| 525 | )}, |
| 526 | {"testDouble exceptions", |
| 527 | ?_assertEqual( |
| 528 | {struct, []}, |
| 529 | thrift_test_thrift:function_info(testDouble, exceptions) |
| 530 | )}, |
| 531 | {"testStruct params", |
| 532 | ?_assertEqual( |
| 533 | {struct, [ |
| 534 | {1, {struct, {thrift_test_types, 'thrift.test.Xtruct'}}} |
| 535 | ]}, |
| 536 | thrift_test_thrift:function_info(testStruct, params_type) |
| 537 | )}, |
| 538 | {"testStruct reply", |
| 539 | ?_assertEqual( |
| 540 | {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, |
| 541 | thrift_test_thrift:function_info(testStruct, reply_type) |
| 542 | )}, |
| 543 | {"testStruct exceptions", |
| 544 | ?_assertEqual( |
| 545 | {struct, []}, |
| 546 | thrift_test_thrift:function_info(testStruct, exceptions) |
| 547 | )}, |
| 548 | {"testNest params", |
| 549 | ?_assertEqual( |
| 550 | {struct, [ |
| 551 | {1, {struct, {thrift_test_types, 'thrift.test.Xtruct2'}}} |
| 552 | ]}, |
| 553 | thrift_test_thrift:function_info(testNest, params_type) |
| 554 | )}, |
| 555 | {"testNest reply", |
| 556 | ?_assertEqual( |
| 557 | {struct, {thrift_test_types, 'thrift.test.Xtruct2'}}, |
| 558 | thrift_test_thrift:function_info(testNest, reply_type) |
| 559 | )}, |
| 560 | {"testNest exceptions", |
| 561 | ?_assertEqual( |
| 562 | {struct, []}, |
| 563 | thrift_test_thrift:function_info(testNest, exceptions) |
| 564 | )}, |
| 565 | {"testMap params", |
| 566 | ?_assertEqual( |
| 567 | {struct, [ |
| 568 | {1, {map, i32, i32}} |
| 569 | ]}, |
| 570 | thrift_test_thrift:function_info(testMap, params_type) |
| 571 | )}, |
| 572 | {"testMap reply", |
| 573 | ?_assertEqual( |
| 574 | {map, i32, i32}, |
| 575 | thrift_test_thrift:function_info(testMap, reply_type) |
| 576 | )}, |
| 577 | {"testMap exceptions", |
| 578 | ?_assertEqual( |
| 579 | {struct, []}, |
| 580 | thrift_test_thrift:function_info(testMap, exceptions) |
| 581 | )}, |
| 582 | {"testStringMap params", |
| 583 | ?_assertEqual( |
| 584 | {struct, [ |
| 585 | {1, {map, string, string}} |
| 586 | ]}, |
| 587 | thrift_test_thrift:function_info(testStringMap, params_type) |
| 588 | )}, |
| 589 | {"testStringMap reply", |
| 590 | ?_assertEqual( |
| 591 | {map, string, string}, |
| 592 | thrift_test_thrift:function_info(testStringMap, reply_type) |
| 593 | )}, |
| 594 | {"testStringMap exceptions", |
| 595 | ?_assertEqual( |
| 596 | {struct, []}, |
| 597 | thrift_test_thrift:function_info(testStringMap, exceptions) |
| 598 | )}, |
| 599 | {"testSet params", |
| 600 | ?_assertEqual( |
| 601 | {struct, [ |
| 602 | {1, {set, i32}} |
| 603 | ]}, |
| 604 | thrift_test_thrift:function_info(testSet, params_type) |
| 605 | )}, |
| 606 | {"testSet reply", |
| 607 | ?_assertEqual( |
| 608 | {set, i32}, |
| 609 | thrift_test_thrift:function_info(testSet, reply_type) |
| 610 | )}, |
| 611 | {"testSet exceptions", |
| 612 | ?_assertEqual( |
| 613 | {struct, []}, |
| 614 | thrift_test_thrift:function_info(testSet, exceptions) |
| 615 | )}, |
| 616 | {"testList params", |
| 617 | ?_assertEqual( |
| 618 | {struct, [ |
| 619 | {1, {list, i32}} |
| 620 | ]}, |
| 621 | thrift_test_thrift:function_info(testList, params_type) |
| 622 | )}, |
| 623 | {"testList reply", |
| 624 | ?_assertEqual( |
| 625 | {list, i32}, |
| 626 | thrift_test_thrift:function_info(testList, reply_type) |
| 627 | )}, |
| 628 | {"testList exceptions", |
| 629 | ?_assertEqual( |
| 630 | {struct, []}, |
| 631 | thrift_test_thrift:function_info(testList, exceptions) |
| 632 | )}, |
| 633 | {"testEnum params", |
| 634 | ?_assertEqual( |
| 635 | {struct, [ |
| 636 | {1, i32} |
| 637 | ]}, |
| 638 | thrift_test_thrift:function_info(testEnum, params_type) |
| 639 | )}, |
| 640 | {"testEnum reply", |
| 641 | ?_assertEqual( |
| 642 | i32, |
| 643 | thrift_test_thrift:function_info(testEnum, reply_type) |
| 644 | )}, |
| 645 | {"testEnum exceptions", |
| 646 | ?_assertEqual( |
| 647 | {struct, []}, |
| 648 | thrift_test_thrift:function_info(testEnum, exceptions) |
| 649 | )}, |
| 650 | {"testTypedef params", |
| 651 | ?_assertEqual( |
| 652 | {struct, [{1, i64}]}, |
| 653 | thrift_test_thrift:function_info(testTypedef, params_type) |
| 654 | )}, |
| 655 | {"testTypedef reply", |
| 656 | ?_assertEqual( |
| 657 | i64, |
| 658 | thrift_test_thrift:function_info(testTypedef, reply_type) |
| 659 | )}, |
| 660 | {"testTypedef exceptions", |
| 661 | ?_assertEqual( |
| 662 | {struct, []}, |
| 663 | thrift_test_thrift:function_info(testTypedef, exceptions) |
| 664 | )}, |
| 665 | {"testMapMap params", |
| 666 | ?_assertEqual( |
| 667 | {struct, [ |
| 668 | {1, i32} |
| 669 | ]}, |
| 670 | thrift_test_thrift:function_info(testMapMap, params_type) |
| 671 | )}, |
| 672 | {"testMapMap reply", |
| 673 | ?_assertEqual( |
| 674 | {map, i32, {map, i32, i32}}, |
| 675 | thrift_test_thrift:function_info(testMapMap, reply_type) |
| 676 | )}, |
| 677 | {"testMapMap exceptions", |
| 678 | ?_assertEqual( |
| 679 | {struct, []}, |
| 680 | thrift_test_thrift:function_info(testMapMap, exceptions) |
| 681 | )}, |
| 682 | {"testInsanity params", |
| 683 | ?_assertEqual( |
| 684 | {struct, [ |
| 685 | {1, {struct, {thrift_test_types, 'thrift.test.Insanity'}}} |
| 686 | ]}, |
| 687 | thrift_test_thrift:function_info(testInsanity, params_type) |
| 688 | )}, |
| 689 | {"testInsanity reply", |
| 690 | ?_assertEqual( |
| 691 | {map, i64, {map, i32, {struct, {'thrift_test_types', 'thrift.test.Insanity'}}}}, |
| 692 | thrift_test_thrift:function_info(testInsanity, reply_type) |
| 693 | )}, |
| 694 | {"testInsanity exceptions", |
| 695 | ?_assertEqual( |
| 696 | {struct, []}, |
| 697 | thrift_test_thrift:function_info(testInsanity, exceptions) |
| 698 | )}, |
| 699 | {"testMulti params", |
| 700 | ?_assertEqual( |
| 701 | {struct, [ |
| 702 | {1, byte}, |
| 703 | {2, i32}, |
| 704 | {3, i64}, |
| 705 | {4, {map, i16, string}}, |
| 706 | {5, i32}, |
| 707 | {6, i64} |
| 708 | ]}, |
| 709 | thrift_test_thrift:function_info(testMulti, params_type) |
| 710 | )}, |
| 711 | {"testMulti reply", |
| 712 | ?_assertEqual( |
| 713 | {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, |
| 714 | thrift_test_thrift:function_info(testMulti, reply_type) |
| 715 | )}, |
| 716 | {"testMulti exceptions", |
| 717 | ?_assertEqual( |
| 718 | {struct, []}, |
| 719 | thrift_test_thrift:function_info(testMulti, exceptions) |
| 720 | )}, |
| 721 | {"testException params", |
| 722 | ?_assertEqual( |
| 723 | {struct, [{1, string}]}, |
| 724 | thrift_test_thrift:function_info(testException, params_type) |
| 725 | )}, |
| 726 | {"testException reply", |
| 727 | ?_assertEqual( |
| 728 | {struct, []}, |
| 729 | thrift_test_thrift:function_info(testException, reply_type) |
| 730 | )}, |
| 731 | {"testException exceptions", |
| 732 | ?_assertEqual( |
| 733 | {struct, [ |
| 734 | {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}} |
| 735 | ]}, |
| 736 | thrift_test_thrift:function_info(testException, exceptions) |
| 737 | )}, |
| 738 | {"testMultiException params", |
| 739 | ?_assertEqual( |
| 740 | {struct, [{1, string}, {2, string}]}, |
| 741 | thrift_test_thrift:function_info(testMultiException, params_type) |
| 742 | )}, |
| 743 | {"testMultiException reply", |
| 744 | ?_assertEqual( |
| 745 | {struct, {thrift_test_types, 'thrift.test.Xtruct'}}, |
| 746 | thrift_test_thrift:function_info(testMultiException, reply_type) |
| 747 | )}, |
| 748 | {"testMultiException exceptions", |
| 749 | ?_assertEqual( |
| 750 | {struct, [ |
| 751 | {1, {struct, {thrift_test_types, 'thrift.test.Xception'}}}, |
| 752 | {2, {struct, {thrift_test_types, 'thrift.test.Xception2'}}} |
| 753 | ]}, |
| 754 | thrift_test_thrift:function_info(testMultiException, exceptions) |
| 755 | )}, |
| 756 | {"testOneway params", |
| 757 | ?_assertEqual( |
| 758 | {struct, [{1, i32}]}, |
| 759 | thrift_test_thrift:function_info(testOneway, params_type) |
| 760 | )}, |
| 761 | {"testOneway reply", |
| 762 | ?_assertEqual( |
| 763 | oneway_void, |
| 764 | thrift_test_thrift:function_info(testOneway, reply_type) |
| 765 | )}, |
| 766 | {"testOneway exceptions", |
| 767 | ?_assertEqual( |
| 768 | {struct, []}, |
| 769 | thrift_test_thrift:function_info(testOneway, exceptions) |
| 770 | )}, |
| 771 | {"secondtestString params", |
| 772 | ?_assertEqual( |
| 773 | {struct, [{1, string}]}, |
| 774 | second_service_thrift:function_info(secondtestString, params_type) |
| 775 | )}, |
| 776 | {"secondtestString reply", |
| 777 | ?_assertEqual( |
| 778 | string, |
| 779 | second_service_thrift:function_info(secondtestString, reply_type) |
| 780 | )}, |
| 781 | {"secondtestString exceptions", |
| 782 | ?_assertEqual( |
| 783 | {struct, []}, |
| 784 | second_service_thrift:function_info(secondtestString, exceptions) |
| 785 | )} |
| 786 | ]. |