tests.rtti.invoketypes.pas 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150
  1. unit tests.rtti.invoketypes;
  2. {$ifdef fpc}
  3. {$mode ObjFPC}{$H+}
  4. {$endif}
  5. interface
  6. uses
  7. Classes, SysUtils, RTTI;
  8. const
  9. SingleArg1: Single = 1.23;
  10. SingleArg2In: Single = 3.21;
  11. SingleArg2Out: Single = 2.34;
  12. SingleArg3Out: Single = 9.87;
  13. SingleArg4: Single = 7.89;
  14. SingleRes: Single = 4.32;
  15. SingleAddArg1 = Single(1.23);
  16. SingleAddArg2 = Single(2.34);
  17. SingleAddArg3 = Single(3.45);
  18. SingleAddArg4 = Single(4.56);
  19. SingleAddArg5 = Single(5.67);
  20. SingleAddArg6 = Single(9.87);
  21. SingleAddArg7 = Single(8.76);
  22. SingleAddArg8 = Single(7.65);
  23. SingleAddArg9 = Single(6.54);
  24. SingleAddArg10 = Single(5.43);
  25. SingleAddRes = SingleAddArg1 + SingleAddArg2 + SingleAddArg3 + SingleAddArg4 + SingleAddArg5 +
  26. SingleAddArg6 + SingleAddArg7 + SingleAddArg8 + SingleAddArg9 + SingleAddArg10;
  27. DoubleArg1: Double = 1.23;
  28. DoubleArg2In: Double = 3.21;
  29. DoubleArg2Out: Double = 2.34;
  30. DoubleArg3Out: Double = 9.87;
  31. DoubleArg4: Double = 7.89;
  32. DoubleRes: Double = 4.32;
  33. DoubleAddArg1 = Double(1.23);
  34. DoubleAddArg2 = Double(2.34);
  35. DoubleAddArg3 = Double(3.45);
  36. DoubleAddArg4 = Double(4.56);
  37. DoubleAddArg5 = Double(5.67);
  38. DoubleAddArg6 = Double(9.87);
  39. DoubleAddArg7 = Double(8.76);
  40. DoubleAddArg8 = Double(7.65);
  41. DoubleAddArg9 = Double(6.54);
  42. DoubleAddArg10 = Double(5.43);
  43. DoubleAddRes = DoubleAddArg1 + DoubleAddArg2 + DoubleAddArg3 + DoubleAddArg4 + DoubleAddArg5 +
  44. DoubleAddArg6 + DoubleAddArg7 + DoubleAddArg8 + DoubleAddArg9 + DoubleAddArg10;
  45. ExtendedArg1: Extended = 1.23;
  46. ExtendedArg2In: Extended = 3.21;
  47. ExtendedArg2Out: Extended = 2.34;
  48. ExtendedArg3Out: Extended = 9.87;
  49. ExtendedArg4: Extended = 7.89;
  50. ExtendedRes: Extended = 4.32;
  51. ExtendedAddArg1 = Extended(1.23);
  52. ExtendedAddArg2 = Extended(2.34);
  53. ExtendedAddArg3 = Extended(3.45);
  54. ExtendedAddArg4 = Extended(4.56);
  55. ExtendedAddArg5 = Extended(5.67);
  56. ExtendedAddArg6 = Extended(9.87);
  57. ExtendedAddArg7 = Extended(8.76);
  58. ExtendedAddArg8 = Extended(7.65);
  59. ExtendedAddArg9 = Extended(6.54);
  60. ExtendedAddArg10 = Extended(5.43);
  61. ExtendedAddRes = ExtendedAddArg1 + ExtendedAddArg2 + ExtendedAddArg3 + ExtendedAddArg4 + ExtendedAddArg5 +
  62. ExtendedAddArg6 + ExtendedAddArg7 + ExtendedAddArg8 + ExtendedAddArg9 + ExtendedAddArg10;
  63. CurrencyArg1: Currency = 1.23;
  64. CurrencyArg2In: Currency = 3.21;
  65. CurrencyArg2Out: Currency = 2.34;
  66. CurrencyArg3Out: Currency = 9.87;
  67. CurrencyArg4: Currency = 7.89;
  68. CurrencyRes: Currency = 4.32;
  69. CurrencyAddArg1 = Currency(1.23);
  70. CurrencyAddArg2 = Currency(2.34);
  71. CurrencyAddArg3 = Currency(3.45);
  72. CurrencyAddArg4 = Currency(4.56);
  73. CurrencyAddArg5 = Currency(5.67);
  74. CurrencyAddArg6 = Currency(9.87);
  75. CurrencyAddArg7 = Currency(8.76);
  76. CurrencyAddArg8 = Currency(7.65);
  77. CurrencyAddArg9 = Currency(6.54);
  78. CurrencyAddArg10 = Currency(5.43);
  79. CurrencyAddRes = CurrencyAddArg1 + CurrencyAddArg2 + CurrencyAddArg3 + CurrencyAddArg4 + CurrencyAddArg5 +
  80. CurrencyAddArg6 + CurrencyAddArg7 + CurrencyAddArg8 + CurrencyAddArg9 + CurrencyAddArg10;
  81. CompArg1: Comp = 123;
  82. CompArg2In: Comp = 321;
  83. CompArg2Out: Comp = 234;
  84. CompArg3Out: Comp = 987;
  85. CompArg4: Comp = 789;
  86. CompRes: Comp = 432;
  87. CompAddArg1 = Comp(123);
  88. CompAddArg2 = Comp(234);
  89. CompAddArg3 = Comp(345);
  90. CompAddArg4 = Comp(456);
  91. CompAddArg5 = Comp(567);
  92. CompAddArg6 = Comp(987);
  93. CompAddArg7 = Comp(876);
  94. CompAddArg8 = Comp(765);
  95. CompAddArg9 = Comp(654);
  96. CompAddArg10 = Comp(543);
  97. CompAddRes = CompAddArg1 + CompAddArg2 + CompAddArg3 + CompAddArg4 + CompAddArg5 +
  98. CompAddArg6 + CompAddArg7 + CompAddArg8 + CompAddArg9 + CompAddArg10;
  99. type
  100. TTestRecord1 = packed record
  101. b: array[0..0] of Byte;
  102. end;
  103. TTestRecord2 = packed record
  104. b: array[0..1] of Byte;
  105. end;
  106. TTestRecord3 = packed record
  107. b: array[0..2] of Byte;
  108. end;
  109. TTestRecord4 = packed record
  110. b: array[0..3] of Byte;
  111. end;
  112. TTestRecord5 = packed record
  113. b: array[0..4] of Byte;
  114. end;
  115. TTestRecord6 = packed record
  116. b: array[0..5] of Byte;
  117. end;
  118. TTestRecord7 = packed record
  119. b: array[0..6] of Byte;
  120. end;
  121. TTestRecord8 = packed record
  122. b: array[0..7] of Byte;
  123. end;
  124. TTestRecord9 = packed record
  125. b: array[0..8] of Byte;
  126. end;
  127. TTestRecord10 = packed record
  128. b: array[0..9] of Byte;
  129. end;
  130. {$M+}
  131. ITestInterface = interface
  132. procedure Test1;
  133. function Test2: SizeInt;
  134. function Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  135. procedure Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  136. function Test5: AnsiString;
  137. function Test6: UnicodeString;
  138. function Test7: WideString;
  139. function Test8: ShortString;
  140. procedure Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  141. procedure Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  142. procedure Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  143. procedure Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  144. function Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  145. function Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  146. function Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  147. function Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  148. function Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  149. function Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  150. function Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  151. function Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  152. function Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  153. function Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  154. function Test23(aArg1 : Variant) : AnsiString;
  155. function TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  156. function TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  157. function TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  158. function TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  159. function TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  160. function TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  161. function TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  162. function TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  163. function TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  164. function TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  165. procedure TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  166. end;
  167. {$M-}
  168. { TTestInterfaceClass }
  169. TTestInterfaceClass = class(TInterfacedObject, ITestInterface)
  170. public
  171. procedure Test1;
  172. function Test2: SizeInt;
  173. function Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  174. procedure Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  175. function Test5: AnsiString;
  176. function Test6: UnicodeString;
  177. function Test7: WideString;
  178. function Test8: ShortString;
  179. procedure Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  180. procedure Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  181. procedure Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  182. procedure Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  183. function Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  184. function Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  185. function Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  186. function Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  187. function Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  188. function Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  189. function Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  190. function Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  191. function Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  192. function Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  193. function Test23(aArg1 : Variant) : AnsiString;
  194. function TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  195. function TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  196. function TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  197. function TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  198. function TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  199. function TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  200. function TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  201. function TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  202. function TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  203. function TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  204. procedure TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  205. public
  206. InputArgs: array of TValue;
  207. OutputArgs: array of TValue;
  208. ExpectedArgs: array of TValue;
  209. OutArgs: array of TValue;
  210. ResultValue: TValue;
  211. CalledMethod: SizeInt;
  212. InOutMapping: array of SizeInt;
  213. procedure Reset;
  214. function DoAddRef : longint;
  215. function DoRelease : longint;
  216. Destructor Destroy; override;
  217. public class var
  218. ProcVarInst: TTestInterfaceClass;
  219. ProcVarRecInst: TTestInterfaceClass;
  220. public const
  221. RecSizeMarker = SizeInt($80000000);
  222. end;
  223. ITestMethodCall = interface
  224. Function Test : String;
  225. end;
  226. {$RTTI EXPLICIT METHODS[vcPrivate,vcProtected,vcPublic,vcPublished]}
  227. { TTestParent }
  228. TTestParent = class
  229. function DoTest : String; virtual;
  230. end;
  231. TTest = Class(TInterfacedObject,ITestMethodCall)
  232. FTestCalled : Boolean;
  233. Function Test : String;
  234. end;
  235. { TTestConstructorCall }
  236. TTestConstructorCall = class(TTestParent)
  237. Private
  238. FTest : ITestMethodCall;
  239. Public
  240. constructor Create({[QueryParam]} aTest: ITestMethodCall);
  241. function DoTest : String; override;
  242. end;
  243. TMethodTest1 = procedure of object;
  244. TMethodTest2 = function: SizeInt of object;
  245. TMethodTest3 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt of object;
  246. TMethodTest4 = procedure(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString) of object;
  247. TMethodTest5 = function: AnsiString of object;
  248. TMethodTest6 = function: UnicodeString of object;
  249. TMethodTest7 = function: WideString of object;
  250. TMethodTest8 = function: ShortString of object;
  251. TMethodTest9 = procedure(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt) of object;
  252. TMethodTest10 = procedure(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString) of object;
  253. TMethodTest11 = procedure(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString) of object;
  254. TMethodTest12 = procedure(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt) of object;
  255. TMethodTest13 = function(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single of object;
  256. TMethodTest14 = function(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double of object;
  257. TMethodTest15 = function(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended of object;
  258. TMethodTest16 = function(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp of object;
  259. TMethodTest17 = function(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency of object;
  260. TMethodTest18 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single of object;
  261. TMethodTest19 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double of object;
  262. TMethodTest20 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended of object;
  263. TMethodTest21 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp of object;
  264. TMethodTest22 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency of object;
  265. TMethodTestRecSize1 = function(aArg1: TTestRecord1): TTestRecord1 of object;
  266. TMethodTestRecSize2 = function(aArg1: TTestRecord2): TTestRecord2 of object;
  267. TMethodTestRecSize3 = function(aArg1: TTestRecord3): TTestRecord3 of object;
  268. TMethodTestRecSize4 = function(aArg1: TTestRecord4): TTestRecord4 of object;
  269. TMethodTestRecSize5 = function(aArg1: TTestRecord5): TTestRecord5 of object;
  270. TMethodTestRecSize6 = function(aArg1: TTestRecord6): TTestRecord6 of object;
  271. TMethodTestRecSize7 = function(aArg1: TTestRecord7): TTestRecord7 of object;
  272. TMethodTestRecSize8 = function(aArg1: TTestRecord8): TTestRecord8 of object;
  273. TMethodTestRecSize9 = function(aArg1: TTestRecord9): TTestRecord9 of object;
  274. TMethodTestRecSize10 = function(aArg1: TTestRecord10): TTestRecord10 of object;
  275. TMethodTestUntyped = procedure(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4) of object;
  276. TProcVarTest1 = procedure;
  277. TProcVarTest2 = function: SizeInt;
  278. TProcVarTest3 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  279. TProcVarTest4 = procedure(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  280. TProcVarTest5 = function: AnsiString;
  281. TProcVarTest6 = function: UnicodeString;
  282. TProcVarTest7 = function: WideString;
  283. TProcVarTest8 = function: ShortString;
  284. TProcVarTest9 = procedure(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  285. TProcVarTest10 = procedure(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  286. TProcVarTest11 = procedure(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  287. TProcVarTest12 = procedure(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  288. TProcVarTest13 = function(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  289. TProcVarTest14 = function(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  290. TProcVarTest15 = function(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  291. TProcVarTest16 = function(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  292. TProcVarTest17 = function(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  293. TProcVarTest18 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  294. TProcVarTest19 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  295. TProcVarTest20 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  296. TProcVarTest21 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  297. TProcVarTest22 = function(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  298. TProcVarTestRecSize1 = function(aArg1: TTestRecord1): TTestRecord1;
  299. TProcVarTestRecSize2 = function(aArg1: TTestRecord2): TTestRecord2;
  300. TProcVarTestRecSize3 = function(aArg1: TTestRecord3): TTestRecord3;
  301. TProcVarTestRecSize4 = function(aArg1: TTestRecord4): TTestRecord4;
  302. TProcVarTestRecSize5 = function(aArg1: TTestRecord5): TTestRecord5;
  303. TProcVarTestRecSize6 = function(aArg1: TTestRecord6): TTestRecord6;
  304. TProcVarTestRecSize7 = function(aArg1: TTestRecord7): TTestRecord7;
  305. TProcVarTestRecSize8 = function(aArg1: TTestRecord8): TTestRecord8;
  306. TProcVarTestRecSize9 = function(aArg1: TTestRecord9): TTestRecord9;
  307. TProcVarTestRecSize10 = function(aArg1: TTestRecord10): TTestRecord10;
  308. TProcVarTestUntyped = procedure(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  309. procedure ProcTest1;
  310. function ProcTest2: SizeInt;
  311. function ProcTest3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  312. procedure ProcTest4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  313. function ProcTest5: AnsiString;
  314. function ProcTest6: UnicodeString;
  315. function ProcTest7: WideString;
  316. function ProcTest8: ShortString;
  317. procedure ProcTest9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  318. procedure ProcTest10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  319. procedure ProcTest11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  320. procedure ProcTest12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  321. function ProcTest13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  322. function ProcTest14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  323. function ProcTest15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  324. function ProcTest16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  325. function ProcTest17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  326. function ProcTest18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  327. function ProcTest19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  328. function ProcTest20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  329. function ProcTest21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  330. function ProcTest22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  331. function ProcTestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  332. function ProcTestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  333. function ProcTestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  334. function ProcTestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  335. function ProcTestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  336. function ProcTestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  337. function ProcTestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  338. function ProcTestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  339. function ProcTestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  340. function ProcTestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  341. procedure ProcTestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  342. implementation
  343. procedure TTestInterfaceClass.Test1;
  344. begin
  345. SetLength(InputArgs, 0);
  346. SetLength(OutputArgs, 0);
  347. ResultValue := TValue.Empty;
  348. CalledMethod := 1;
  349. end;
  350. function TTestInterfaceClass.Test2: SizeInt;
  351. begin
  352. SetLength(InputArgs, 0);
  353. SetLength(OutputArgs, 0);
  354. Result := 42;
  355. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  356. CalledMethod := 2;
  357. end;
  358. function TTestInterfaceClass.Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  359. begin
  360. SetLength(InputArgs, 10);
  361. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  362. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  363. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  364. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  365. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  366. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  367. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  368. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  369. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  370. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  371. SetLength(OutputArgs, 0);
  372. Result := 42;
  373. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  374. CalledMethod := 3;
  375. end;
  376. procedure TTestInterfaceClass.Test4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  377. begin
  378. SetLength(InputArgs, 4);
  379. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  380. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  381. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  382. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  383. SetLength(OutputArgs, 0);
  384. ResultValue := TValue.Empty;
  385. CalledMethod := 4;
  386. end;
  387. function TTestInterfaceClass.Test5: AnsiString;
  388. begin
  389. SetLength(InputArgs, 0);
  390. SetLength(OutputArgs, 0);
  391. Result := 'Hello World';
  392. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  393. CalledMethod := 5;
  394. end;
  395. function TTestInterfaceClass.Test6: UnicodeString;
  396. begin
  397. SetLength(InputArgs, 0);
  398. SetLength(OutputArgs, 0);
  399. Result := 'Hello World';
  400. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  401. CalledMethod := 6;
  402. end;
  403. function TTestInterfaceClass.Test7: WideString;
  404. begin
  405. SetLength(InputArgs, 0);
  406. SetLength(OutputArgs, 0);
  407. Result := 'Hello World';
  408. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  409. CalledMethod := 7;
  410. end;
  411. function TTestInterfaceClass.Test8: ShortString;
  412. begin
  413. SetLength(InputArgs, 0);
  414. SetLength(OutputArgs, 0);
  415. Result := 'Hello World';
  416. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  417. CalledMethod := 8;
  418. end;
  419. procedure TTestInterfaceClass.Test9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  420. begin
  421. SetLength(InputArgs, 4);
  422. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  423. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  424. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  425. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  426. aArg2 := $1234;
  427. aArg3 := $5678;
  428. SetLength(OutputArgs, 2);
  429. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  430. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  431. SetLength(InOutMapping, 2);
  432. InOutMapping[0] := 1;
  433. InOutMapping[1] := 2;
  434. ResultValue := TValue.Empty;
  435. CalledMethod := 9;
  436. end;
  437. procedure TTestInterfaceClass.Test10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  438. begin
  439. SetLength(InputArgs, 4);
  440. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  441. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  442. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  443. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  444. aArg2 := 'Foo';
  445. aArg3 := 'Bar';
  446. SetLength(OutputArgs, 2);
  447. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  448. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  449. SetLength(InOutMapping, 2);
  450. InOutMapping[0] := 1;
  451. InOutMapping[1] := 2;
  452. ResultValue := TValue.Empty;
  453. CalledMethod := 10;
  454. end;
  455. procedure TTestInterfaceClass.Test11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  456. begin
  457. SetLength(InputArgs, 4);
  458. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  459. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  460. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  461. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  462. aArg2 := 'Foo';
  463. aArg3 := 'Bar';
  464. SetLength(OutputArgs, 2);
  465. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  466. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  467. SetLength(InOutMapping, 2);
  468. InOutMapping[0] := 1;
  469. InOutMapping[1] := 2;
  470. ResultValue := TValue.Empty;
  471. CalledMethod := 11;
  472. end;
  473. procedure TTestInterfaceClass.Test12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  474. {$ifdef fpc}
  475. var
  476. i: SizeInt;
  477. start: SizeInt;
  478. {$endif}
  479. begin
  480. {$ifdef fpc}
  481. SetLength(InputArgs, 4);
  482. InputArgs[0] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg1);
  483. InputArgs[1] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg2);
  484. InputArgs[2] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg3);
  485. InputArgs[3] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg4);
  486. SetLength(OutputArgs, 2);
  487. start := $4321;
  488. for i := 0 to High(aArg2) do
  489. aArg2[i] := start + i;
  490. start := $9876;
  491. for i := 0 to High(aArg3) do
  492. aArg3[i] := start + i;
  493. OutputArgs[0] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg2);
  494. OutputArgs[1] := specialize OpenArrayToDynArrayValue<SizeInt>(aArg3);
  495. SetLength(InOutMapping, 2);
  496. InOutMapping[0] := 1;
  497. InOutMapping[1] := 2;
  498. ResultValue := TValue.Empty;
  499. CalledMethod := 12;
  500. {$endif}
  501. end;
  502. function TTestInterfaceClass.Test13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  503. begin
  504. SetLength(InputArgs, 4);
  505. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  506. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  507. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  508. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  509. aArg2 := SingleArg2Out;
  510. aArg3 := SingleArg3Out;
  511. SetLength(OutputArgs, 2);
  512. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  513. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  514. SetLength(InOutMapping, 2);
  515. InOutMapping[0] := 1;
  516. InOutMapping[1] := 2;
  517. Result := SingleRes;
  518. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  519. CalledMethod := 13;
  520. end;
  521. function TTestInterfaceClass.Test14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  522. begin
  523. SetLength(InputArgs, 4);
  524. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  525. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  526. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  527. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  528. aArg2 := DoubleArg2Out;
  529. aArg3 := DoubleArg3Out;
  530. SetLength(OutputArgs, 2);
  531. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  532. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  533. SetLength(InOutMapping, 2);
  534. InOutMapping[0] := 1;
  535. InOutMapping[1] := 2;
  536. Result := DoubleRes;
  537. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  538. CalledMethod := 14;
  539. end;
  540. function TTestInterfaceClass.Test15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  541. begin
  542. SetLength(InputArgs, 4);
  543. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  544. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  545. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  546. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  547. aArg2 := ExtendedArg2Out;
  548. aArg3 := ExtendedArg3Out;
  549. SetLength(OutputArgs, 2);
  550. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  551. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  552. SetLength(InOutMapping, 2);
  553. InOutMapping[0] := 1;
  554. InOutMapping[1] := 2;
  555. Result := ExtendedRes;
  556. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  557. CalledMethod := 15;
  558. end;
  559. function TTestInterfaceClass.Test16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  560. begin
  561. SetLength(InputArgs, 4);
  562. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  563. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  564. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  565. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  566. aArg2 := CompArg2Out;
  567. aArg3 := CompArg3Out;
  568. SetLength(OutputArgs, 2);
  569. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  570. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  571. SetLength(InOutMapping, 2);
  572. InOutMapping[0] := 1;
  573. InOutMapping[1] := 2;
  574. Result := CompRes;
  575. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  576. CalledMethod := 16;
  577. end;
  578. function TTestInterfaceClass.Test17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  579. begin
  580. SetLength(InputArgs, 4);
  581. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  582. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  583. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  584. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  585. aArg2 := CurrencyArg2Out;
  586. aArg3 := CurrencyArg3Out;
  587. SetLength(OutputArgs, 2);
  588. TValue.Make(@aArg2, TypeInfo(aArg2), OutputArgs[0]);
  589. TValue.Make(@aArg3, TypeInfo(aArg3), OutputArgs[1]);
  590. SetLength(InOutMapping, 2);
  591. InOutMapping[0] := 1;
  592. InOutMapping[1] := 2;
  593. Result := CurrencyRes;
  594. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  595. CalledMethod := 17;
  596. end;
  597. function TTestInterfaceClass.Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  598. begin
  599. SetLength(InputArgs, 10);
  600. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  601. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  602. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  603. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  604. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  605. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  606. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  607. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  608. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  609. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  610. SetLength(OutputArgs, 0);
  611. SetLength(InOutMapping, 0);
  612. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  613. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  614. CalledMethod := 18;
  615. end;
  616. function TTestInterfaceClass.Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  617. begin
  618. SetLength(InputArgs, 10);
  619. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  620. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  621. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  622. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  623. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  624. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  625. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  626. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  627. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  628. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  629. SetLength(OutputArgs, 0);
  630. SetLength(InOutMapping, 0);
  631. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  632. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  633. CalledMethod := 19;
  634. end;
  635. function TTestInterfaceClass.Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  636. begin
  637. SetLength(InputArgs, 10);
  638. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  639. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  640. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  641. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  642. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  643. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  644. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  645. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  646. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  647. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  648. SetLength(OutputArgs, 0);
  649. SetLength(InOutMapping, 0);
  650. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  651. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  652. CalledMethod := 20;
  653. end;
  654. function TTestInterfaceClass.Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  655. begin
  656. SetLength(InputArgs, 10);
  657. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  658. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  659. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  660. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  661. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  662. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  663. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  664. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  665. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  666. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  667. SetLength(OutputArgs, 0);
  668. SetLength(InOutMapping, 0);
  669. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  670. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  671. CalledMethod := 21;
  672. end;
  673. function TTestInterfaceClass.Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  674. begin
  675. SetLength(InputArgs, 10);
  676. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  677. TValue.Make(@aArg2, TypeInfo(aArg2), InputArgs[1]);
  678. TValue.Make(@aArg3, TypeInfo(aArg3), InputArgs[2]);
  679. TValue.Make(@aArg4, TypeInfo(aArg4), InputArgs[3]);
  680. TValue.Make(@aArg5, TypeInfo(aArg5), InputArgs[4]);
  681. TValue.Make(@aArg6, TypeInfo(aArg6), InputArgs[5]);
  682. TValue.Make(@aArg7, TypeInfo(aArg7), InputArgs[6]);
  683. TValue.Make(@aArg8, TypeInfo(aArg8), InputArgs[7]);
  684. TValue.Make(@aArg9, TypeInfo(aArg9), InputArgs[8]);
  685. TValue.Make(@aArg10, TypeInfo(aArg10), InputArgs[9]);
  686. SetLength(OutputArgs, 0);
  687. SetLength(InOutMapping, 0);
  688. Result := aArg1 + aArg2 + aArg3 + aArg4 + aArg5 + aArg6 + aArg7 + aArg8 + aArg9 + aArg10;
  689. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  690. CalledMethod := 22;
  691. end;
  692. function TTestInterfaceClass.Test23(aArg1: Variant): AnsiString;
  693. begin
  694. SetLength(OutputArgs, 0);
  695. SetLength(InOutMapping, 0);
  696. SetLength(InputArgs, 1);
  697. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  698. Result:=AnsiString(aArg1);
  699. TValue.Make(@Result ,TypeInfo(Result), ResultValue);
  700. CalledMethod:=23;
  701. end;
  702. function TTestInterfaceClass.TestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  703. var
  704. i: LongInt;
  705. begin
  706. SetLength(InputArgs, 1);
  707. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  708. SetLength(OutputArgs, 0);
  709. for i := 0 to High(aArg1.b) do
  710. Result.b[High(Result.b) - i] := aArg1.b[i];
  711. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  712. CalledMethod := 1 or RecSizeMarker;
  713. end;
  714. function TTestInterfaceClass.TestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  715. var
  716. i: LongInt;
  717. begin
  718. SetLength(InputArgs, 1);
  719. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  720. SetLength(OutputArgs, 0);
  721. for i := 0 to High(aArg1.b) do
  722. Result.b[High(Result.b) - i] := aArg1.b[i];
  723. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  724. CalledMethod := 2 or RecSizeMarker;
  725. end;
  726. function TTestInterfaceClass.TestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  727. var
  728. i: LongInt;
  729. begin
  730. SetLength(InputArgs, 1);
  731. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  732. SetLength(OutputArgs, 0);
  733. for i := 0 to High(aArg1.b) do
  734. Result.b[High(Result.b) - i] := aArg1.b[i];
  735. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  736. CalledMethod := 3 or RecSizeMarker;
  737. end;
  738. function TTestInterfaceClass.TestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  739. var
  740. i: LongInt;
  741. begin
  742. SetLength(InputArgs, 1);
  743. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  744. SetLength(OutputArgs, 0);
  745. for i := 0 to High(aArg1.b) do
  746. Result.b[High(Result.b) - i] := aArg1.b[i];
  747. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  748. CalledMethod := 4 or RecSizeMarker;
  749. end;
  750. function TTestInterfaceClass.TestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  751. var
  752. i: LongInt;
  753. begin
  754. SetLength(InputArgs, 1);
  755. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  756. SetLength(OutputArgs, 0);
  757. for i := 0 to High(aArg1.b) do
  758. Result.b[High(Result.b) - i] := aArg1.b[i];
  759. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  760. CalledMethod := 5 or RecSizeMarker;
  761. end;
  762. function TTestInterfaceClass.TestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  763. var
  764. i: LongInt;
  765. begin
  766. SetLength(InputArgs, 1);
  767. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  768. SetLength(OutputArgs, 0);
  769. for i := 0 to High(aArg1.b) do
  770. Result.b[High(Result.b) - i] := aArg1.b[i];
  771. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  772. CalledMethod := 6 or RecSizeMarker;
  773. end;
  774. function TTestInterfaceClass.TestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  775. var
  776. i: LongInt;
  777. begin
  778. SetLength(InputArgs, 1);
  779. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  780. SetLength(OutputArgs, 0);
  781. for i := 0 to High(aArg1.b) do
  782. Result.b[High(Result.b) - i] := aArg1.b[i];
  783. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  784. CalledMethod := 7 or RecSizeMarker;
  785. end;
  786. function TTestInterfaceClass.TestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  787. var
  788. i: LongInt;
  789. begin
  790. SetLength(InputArgs, 1);
  791. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  792. SetLength(OutputArgs, 0);
  793. for i := 0 to High(aArg1.b) do
  794. Result.b[High(Result.b) - i] := aArg1.b[i];
  795. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  796. CalledMethod := 8 or RecSizeMarker;
  797. end;
  798. function TTestInterfaceClass.TestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  799. var
  800. i: LongInt;
  801. begin
  802. SetLength(InputArgs, 1);
  803. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  804. SetLength(OutputArgs, 0);
  805. for i := 0 to High(aArg1.b) do
  806. Result.b[High(Result.b) - i] := aArg1.b[i];
  807. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  808. CalledMethod := 9 or RecSizeMarker;
  809. end;
  810. function TTestInterfaceClass.TestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  811. var
  812. i: LongInt;
  813. begin
  814. SetLength(InputArgs, 1);
  815. TValue.Make(@aArg1, TypeInfo(aArg1), InputArgs[0]);
  816. SetLength(OutputArgs, 0);
  817. for i := 0 to High(aArg1.b) do
  818. Result.b[High(Result.b) - i] := aArg1.b[i];
  819. TValue.Make(@Result, TypeInfo(Result), ResultValue);
  820. CalledMethod := 10 or RecSizeMarker;
  821. end;
  822. procedure TTestInterfaceClass.TestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  823. begin
  824. if Length(ExpectedArgs) <> 4 then
  825. Exit;
  826. if Length(OutArgs) <> 2 then
  827. Exit;
  828. SetLength(InputArgs, 4);
  829. TValue.Make(@aArg1, ExpectedArgs[0].TypeInfo, InputArgs[0]);
  830. TValue.Make(@aArg2, ExpectedArgs[1].TypeInfo, InputArgs[1]);
  831. TValue.Make(@aArg3, ExpectedArgs[2].TypeInfo, InputArgs[2]);
  832. TValue.Make(@aArg4, ExpectedArgs[3].TypeInfo, InputArgs[3]);
  833. Move(PPointer(OutArgs[0].GetReferenceToRawData)^, aArg1, OutArgs[0].DataSize);
  834. Move(PPointer(OutArgs[1].GetReferenceToRawData)^, aArg2, OutArgs[1].DataSize);
  835. SetLength(OutputArgs, 2);
  836. TValue.Make(@aArg1, ExpectedArgs[0].TypeInfo, OutputArgs[0]);
  837. TValue.Make(@aArg2, ExpectedArgs[1].TypeInfo, OutputArgs[1]);
  838. SetLength(InOutMapping, 2);
  839. InOutMapping[0] := 0;
  840. InOutMapping[1] := 1;
  841. CalledMethod := -1;
  842. end;
  843. procedure TTestInterfaceClass.Reset;
  844. begin
  845. InputArgs := Nil;
  846. OutputArgs := Nil;
  847. ExpectedArgs := Nil;
  848. OutArgs := Nil;
  849. InOutMapping := Nil;
  850. ResultValue := TValue.Empty;
  851. CalledMethod := 0;
  852. end;
  853. function TTestInterfaceClass.DoAddRef: longint;
  854. begin
  855. Result:=_AddRef;
  856. end;
  857. function TTestInterfaceClass.DoRelease: longint;
  858. begin
  859. Result:=_Release
  860. end;
  861. destructor TTestInterfaceClass.Destroy;
  862. begin
  863. // Empty, for debugging purposes
  864. inherited Destroy;
  865. end;
  866. { TTestParent }
  867. function TTestParent.DoTest: String;
  868. begin
  869. Result:='Parent';
  870. end;
  871. procedure ProcTest1;
  872. begin
  873. TTestInterfaceClass.ProcVarInst.Test1;
  874. end;
  875. function ProcTest2: SizeInt;
  876. begin
  877. Result := TTestInterfaceClass.ProcVarInst.Test2;
  878. end;
  879. function ProcTest3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: SizeInt): SizeInt;
  880. begin
  881. Result := TTestInterfaceClass.ProcVarInst.Test3(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  882. end;
  883. procedure ProcTest4(aArg1: AnsiString; aArg2: UnicodeString; aArg3: WideString; aArg4: ShortString);
  884. begin
  885. TTestInterfaceClass.ProcVarInst.Test4(aArg1, aArg2, aArg3, aArg4);
  886. end;
  887. function ProcTest5: AnsiString;
  888. begin
  889. Result := TTestInterfaceClass.ProcVarInst.Test5;
  890. end;
  891. function ProcTest6: UnicodeString;
  892. begin
  893. Result := TTestInterfaceClass.ProcVarInst.Test6;
  894. end;
  895. function ProcTest7: WideString;
  896. begin
  897. Result := TTestInterfaceClass.ProcVarInst.Test7;
  898. end;
  899. function ProcTest8: ShortString;
  900. begin
  901. Result := TTestInterfaceClass.ProcVarInst.Test8;
  902. end;
  903. procedure ProcTest9(aArg1: SizeInt; var aArg2: SizeInt; out aArg3: SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: SizeInt);
  904. begin
  905. TTestInterfaceClass.ProcVarInst.Test9(aArg1, aArg2, aArg3, aArg4);
  906. end;
  907. procedure ProcTest10(aArg1: AnsiString; var aArg2: AnsiString; out aArg3: AnsiString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: AnsiString);
  908. begin
  909. TTestInterfaceClass.ProcVarInst.Test10(aArg1, aArg2, aArg3, aArg4);
  910. end;
  911. procedure ProcTest11(aArg1: ShortString; var aArg2: ShortString; out aArg3: ShortString; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: ShortString);
  912. begin
  913. TTestInterfaceClass.ProcVarInst.Test11(aArg1, aArg2, aArg3, aArg4);
  914. end;
  915. procedure ProcTest12(aArg1: array of SizeInt; var aArg2: array of SizeInt; out aArg3: array of SizeInt; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: array of SizeInt);
  916. begin
  917. TTestInterfaceClass.ProcVarInst.Test12(aArg1, aArg2, aArg3, aArg4);
  918. end;
  919. function ProcTest13(aArg1: Single; var aArg2: Single; out aArg3: Single; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Single): Single;
  920. begin
  921. Result := TTestInterfaceClass.ProcVarInst.Test13(aArg1, aArg2, aArg3, aArg4);
  922. end;
  923. function ProcTest14(aArg1: Double; var aArg2: Double; out aArg3: Double; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Double): Double;
  924. begin
  925. Result := TTestInterfaceClass.ProcVarInst.Test14(aArg1, aArg2, aArg3, aArg4);
  926. end;
  927. function ProcTest15(aArg1: Extended; var aArg2: Extended; out aArg3: Extended; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Extended): Extended;
  928. begin
  929. Result := TTestInterfaceClass.ProcVarInst.Test15(aArg1, aArg2, aArg3, aArg4);
  930. end;
  931. function ProcTest16(aArg1: Comp; var aArg2: Comp; out aArg3: Comp; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Comp): Comp;
  932. begin
  933. Result := TTestInterfaceClass.ProcVarInst.Test16(aArg1, aArg2, aArg3, aArg4);
  934. end;
  935. function ProcTest17(aArg1: Currency; var aArg2: Currency; out aArg3: Currency; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4: Currency): Currency;
  936. begin
  937. Result := TTestInterfaceClass.ProcVarInst.Test17(aArg1, aArg2, aArg3, aArg4);
  938. end;
  939. function ProcTest18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Single): Single;
  940. begin
  941. Result := TTestInterfaceClass.ProcVarInst.Test18(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  942. end;
  943. function ProcTest19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Double): Double;
  944. begin
  945. Result := TTestInterfaceClass.ProcVarInst.Test19(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  946. end;
  947. function ProcTest20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Extended): Extended;
  948. begin
  949. Result := TTestInterfaceClass.ProcVarInst.Test20(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  950. end;
  951. function ProcTest21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Comp): Comp;
  952. begin
  953. Result := TTestInterfaceClass.ProcVarInst.Test21(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  954. end;
  955. function ProcTest22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10: Currency): Currency;
  956. begin
  957. Result := TTestInterfaceClass.ProcVarInst.Test22(aArg1, aArg2, aArg3, aArg4, aArg5, aArg6, aArg7, aArg8, aArg9, aArg10);
  958. end;
  959. function ProcTestRecSize1(aArg1: TTestRecord1): TTestRecord1;
  960. begin
  961. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize1(aArg1);
  962. end;
  963. function ProcTestRecSize2(aArg1: TTestRecord2): TTestRecord2;
  964. begin
  965. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize2(aArg1);
  966. end;
  967. function ProcTestRecSize3(aArg1: TTestRecord3): TTestRecord3;
  968. begin
  969. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize3(aArg1);
  970. end;
  971. function ProcTestRecSize4(aArg1: TTestRecord4): TTestRecord4;
  972. begin
  973. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize4(aArg1);
  974. end;
  975. function ProcTestRecSize5(aArg1: TTestRecord5): TTestRecord5;
  976. begin
  977. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize5(aArg1);
  978. end;
  979. function ProcTestRecSize6(aArg1: TTestRecord6): TTestRecord6;
  980. begin
  981. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize6(aArg1);
  982. end;
  983. function ProcTestRecSize7(aArg1: TTestRecord7): TTestRecord7;
  984. begin
  985. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize7(aArg1);
  986. end;
  987. function ProcTestRecSize8(aArg1: TTestRecord8): TTestRecord8;
  988. begin
  989. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize8(aArg1);
  990. end;
  991. function ProcTestRecSize9(aArg1: TTestRecord9): TTestRecord9;
  992. begin
  993. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize9(aArg1);
  994. end;
  995. function ProcTestRecSize10(aArg1: TTestRecord10): TTestRecord10;
  996. begin
  997. Result := TTestInterfaceClass.ProcVarRecInst.TestRecSize10(aArg1);
  998. end;
  999. procedure ProcTestUntyped(var aArg1; out aArg2; const aArg3; {$ifdef fpc}constref{$else}const [ref]{$endif} aArg4);
  1000. begin
  1001. TTestInterfaceClass.ProcVarInst.TestUntyped(aArg1, aArg2, aArg3, aArg4);
  1002. end;
  1003. constructor TTestConstructorCall.Create(aTest: ITestMethodCall);
  1004. begin
  1005. FTest:=aTest;
  1006. end;
  1007. function TTestConstructorCall.DoTest : string;
  1008. begin
  1009. Result:=FTest.Test;
  1010. end;
  1011. { TTest }
  1012. function TTest.Test : string;
  1013. begin
  1014. FTestCalled:=True;
  1015. Result:='In test';
  1016. end;
  1017. end.