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