tcalobj6.pp 65 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. { Copyright (c) 2002 Carl Eric Codere }
  4. {****************************************************************}
  5. { NODE TESTED : secondcalln() }
  6. {****************************************************************}
  7. { PRE-REQUISITES: secondload() }
  8. { secondassign() }
  9. { secondtypeconv() }
  10. { secondtryexcept() }
  11. {****************************************************************}
  12. { DEFINES: }
  13. { FPC = Target is FreePascal compiler }
  14. {****************************************************************}
  15. { REMARKS: This tests secondcalln(), genentrycode() and }
  16. { genexitcode() for standard object with the register }
  17. { calling convention. }
  18. { }
  19. {****************************************************************}
  20. program tcalobj6;
  21. {$STATIC ON}
  22. {$R+}
  23. const
  24. { should be defined depending on CPU target }
  25. {$ifdef cpu68k}
  26. BIG_INDEX = 8000;
  27. SMALL_INDEX = 13;
  28. {$endif}
  29. {$ifdef cpu86}
  30. BIG_INDEX = 33000;
  31. SMALL_INDEX = 13; { value should not be aligned! }
  32. {$endif}
  33. RESULT_U8BIT = $55;
  34. RESULT_U16BIT = 2*RESULT_U8BIT;
  35. RESULT_S32BIT = $500F0000;
  36. RESULT_S64BIT = $500F0000;
  37. RESULT_S32REAL = 1777.12;
  38. RESULT_S64REAL = 3444.24;
  39. RESULT_BOOL8BIT = 1;
  40. RESULT_BOOL16BIT = 1;
  41. RESULT_BOOL32BIT = 1;
  42. RESULT_PCHAR = 'Hello world';
  43. RESULT_BIGSTRING = 'Hello world';
  44. RESULT_SMALLSTRING = 'H';
  45. RESULT_CHAR = 'I';
  46. RESULT_BOOLEAN = TRUE;
  47. type
  48. tprocedure = procedure;
  49. tsmallrecord = packed record
  50. b: byte;
  51. w: word;
  52. end;
  53. tlargerecord = packed record
  54. b: array[1..BIG_INDEX] of byte;
  55. end;
  56. tsmallarray = packed array[1..SMALL_INDEX] of byte;
  57. tsmallsetenum =
  58. (A_A,A_B,A_C,A_D);
  59. tsmallset = set of tsmallsetenum;
  60. tlargeset = set of char;
  61. tsmallstring = string[2];
  62. var
  63. global_u8bit : byte;
  64. global_u16bit : word;
  65. global_s32bit : longint;
  66. global_s32real : single;
  67. global_s64real : double;
  68. global_ptr : pchar;
  69. global_proc : tprocedure;
  70. global_bigstring : shortstring;
  71. global_boolean : boolean;
  72. global_char : char;
  73. global_s64bit : int64;
  74. value_s64bit : int64;
  75. value_ansistring : ansistring;
  76. value_u8bit : byte;
  77. value_u16bit : word;
  78. value_s32bit : longint;
  79. value_s32real : single;
  80. value_s64real : double;
  81. value_proc : tprocedure;
  82. value_ptr : pchar;
  83. value_smallrec : tsmallrecord;
  84. value_largerec : tlargerecord;
  85. value_smallset : tsmallset;
  86. value_smallstring : tsmallstring;
  87. value_bigstring : shortstring;
  88. value_largeset : tlargeset;
  89. value_smallarray : tsmallarray;
  90. value_boolean : boolean;
  91. value_char : char;
  92. procedure fail;
  93. begin
  94. WriteLn('Failure.');
  95. halt(1);
  96. end;
  97. procedure clear_globals;
  98. begin
  99. global_u8bit := 0;
  100. global_u16bit := 0;
  101. global_s32bit := 0;
  102. global_s32real := 0.0;
  103. global_s64real := 0.0;
  104. global_ptr := nil;
  105. global_proc := nil;
  106. global_bigstring := '';
  107. global_boolean := false;
  108. global_char := #0;
  109. global_s64bit := 0;
  110. end;
  111. procedure clear_values;
  112. begin
  113. value_u8bit := 0;
  114. value_u16bit := 0;
  115. value_s32bit := 0;
  116. value_s32real := 0.0;
  117. value_s64real := 0.0;
  118. value_proc := nil;
  119. value_ptr := nil;
  120. fillchar(value_smallrec, sizeof(value_smallrec), #0);
  121. fillchar(value_largerec, sizeof(value_largerec), #0);
  122. value_smallset := [];
  123. value_smallstring := '';
  124. value_bigstring := '';
  125. value_largeset := [];
  126. fillchar(value_smallarray, sizeof(value_smallarray), #0);
  127. value_boolean := false;
  128. value_char:=#0;
  129. value_ansistring := '';
  130. value_s64bit := 0;
  131. end;
  132. function getu8: byte;
  133. begin
  134. getu8 := RESULT_U8BIT;
  135. end;
  136. type
  137. { object without vmt }
  138. pnovmtobject = ^tnovmtobject;
  139. tnovmtobject = object
  140. public
  141. object_bigstring : shortstring;
  142. object_u16bit : word;
  143. { no parameter testing }
  144. procedure method_public_none;register;
  145. procedure method_public_static_none; static;register;
  146. procedure method_call_private_none;register;
  147. procedure method_call_private_static_none; static;register;
  148. { simple value parameter testing }
  149. procedure method_public_u8(x : byte);register;
  150. procedure method_public_static_u8(x: byte); static;register;
  151. procedure method_call_private_u8(x: byte);register;
  152. procedure method_call_private_static_u8(x: byte); static;register;
  153. function func_array_mixed_nested(b: byte): tsmallarray;register;
  154. private
  155. procedure method_private_none;register;
  156. procedure method_private_static_none; static;register;
  157. function func_getu16bit : word;register;
  158. { simple value parameter testing }
  159. procedure method_private_u8(x: byte);register;
  160. procedure method_private_static_u8(x: byte); static;register;
  161. end;
  162. { object with vmt }
  163. pvmtobject = ^tvmtobject;
  164. tvmtobject = object
  165. public
  166. object_u8bit : byte;
  167. object_u16bit : word;
  168. object_bigstring : shortstring;
  169. object_s32bit : longint;
  170. object_s64bit : int64;
  171. constructor constructor_params_mixed(u8 :byte; u16: word;
  172. bigstring: shortstring; s32: longint; s64: int64);register;
  173. constructor constructor_init;register;
  174. destructor destructor_params_done;register;
  175. procedure method_normal_params_mixed(u8 :byte; u16: word;
  176. bigstring: shortstring; s32: longint; s64: int64);register;
  177. procedure method_virtual_params_mixed(u8 :byte; u16: word;
  178. bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  179. procedure method_virtual_overriden_params_mixed(u8 :byte; u16: word;
  180. bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  181. procedure method_static_params_mixed(u8 :byte; u16: word;
  182. bigstring: shortstring; s32: longint; s64: int64);static;register;
  183. procedure method_normal_call_inherited_params_mixed(
  184. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  185. { virtual methods which call other methods }
  186. procedure method_virtual_call_static_params_mixed(
  187. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  188. procedure method_virtual_call_virtual_params_mixed(
  189. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  190. procedure method_virtual_call_overriden_params_mixed(
  191. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  192. procedure method_virtual_call_normal_params_mixed(
  193. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  194. procedure method_virtual_call_constructor_params_mixed(
  195. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  196. procedure method_virtual_call_inherited_params_mixed(
  197. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  198. end;
  199. pheritedvmtobject = ^theritedvmtobject;
  200. theritedvmtobject = object(tvmtobject)
  201. constructor constructor_params_mixed_call_virtual(u8 :byte; u16: word;
  202. bigstring: shortstring; s32: longint; s64: int64);register;
  203. constructor constructor_params_mixed_call_overriden(u8 :byte; u16: word;
  204. bigstring: shortstring; s32: longint; s64: int64);register;
  205. constructor constructor_params_mixed_call_static(u8 :byte; u16: word;
  206. bigstring: shortstring; s32: longint; s64: int64);register;
  207. constructor constructor_params_mixed_call_normal(u8 :byte; u16: word;
  208. bigstring: shortstring; s32: longint; s64: int64);register;
  209. constructor constructor_params_mixed_call_inherited(u8 :byte; u16: word;
  210. bigstring: shortstring; s32: longint; s64: int64);register;
  211. procedure method_virtual_overriden_params_mixed(
  212. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  213. { normal methods which call other methods }
  214. procedure method_normal_call_static_params_mixed(
  215. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  216. procedure method_normal_call_virtual_params_mixed(
  217. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  218. procedure method_normal_call_overriden_params_mixed(
  219. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  220. procedure method_normal_call_normal_params_mixed(
  221. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  222. procedure method_normal_call_constructor_params_mixed(
  223. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  224. procedure method_normal_call_inherited_params_mixed(
  225. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  226. { virtual methods which call other methods }
  227. procedure method_virtual_call_inherited_params_mixed(
  228. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;register;
  229. end;
  230. pfailvmtobject = ^tfailvmtobject;
  231. tfailvmtobject = object(tvmtobject)
  232. public
  233. constructor constructor_public_none;register;
  234. end;
  235. {**************************************************************************}
  236. { NO VMT OBJECT }
  237. {**************************************************************************}
  238. {****************** NO PARAMETERS ******************}
  239. procedure tnovmtobject.method_public_none;register;
  240. begin
  241. global_u8bit := RESULT_U8BIT;
  242. end;
  243. procedure tnovmtobject.method_public_static_none;register;
  244. begin
  245. global_u8bit := RESULT_U8BIT;
  246. end;
  247. procedure tnovmtobject.method_call_private_none;register;
  248. begin
  249. method_private_none;
  250. method_private_static_none;
  251. end;
  252. procedure tnovmtobject.method_call_private_static_none;register;
  253. begin
  254. method_private_static_none;
  255. end;
  256. procedure tnovmtobject.method_private_none;register;
  257. begin
  258. Inc(global_u16bit, RESULT_U8BIT);
  259. end;
  260. procedure tnovmtobject.method_private_static_none;register;
  261. begin
  262. Inc(global_u16bit, RESULT_U8BIT);
  263. end;
  264. {******************** PARAMETERS ******************}
  265. procedure tnovmtobject.method_public_u8(x : byte);register;
  266. begin
  267. global_u8bit := x;
  268. end;
  269. procedure tnovmtobject.method_public_static_u8(x: byte);register;
  270. begin
  271. global_u8bit := x;
  272. end;
  273. procedure tnovmtobject.method_call_private_u8(x: byte);register;
  274. begin
  275. method_private_static_u8(x);
  276. method_private_u8(x);
  277. end;
  278. procedure tnovmtobject. method_call_private_static_u8(x: byte);register;
  279. begin
  280. method_private_static_u8(x);
  281. end;
  282. procedure tnovmtobject.method_private_u8(x: byte);register;
  283. begin
  284. Inc(global_u16bit,x);
  285. end;
  286. procedure tnovmtobject.method_private_static_u8(x: byte);register;
  287. begin
  288. Inc(global_u16bit,x);
  289. end;
  290. function tnovmtobject.func_getu16bit : word;register;
  291. begin
  292. func_getu16bit := object_u16bit;
  293. end;
  294. {
  295. complex testing, nested field access, with parameters and
  296. comple return value.
  297. On exit : global_u8bit := x;
  298. global_u16bit := object_u16bit (from func_getu16bit);
  299. global_s32bit := RESULT_S32BIT
  300. global_bigstring := object_bigstring
  301. global_s64bit := x;
  302. }
  303. function tnovmtobject.func_array_mixed_nested(b: byte): tsmallarray;register;
  304. procedure nested_one_proc(l: longint);
  305. begin
  306. global_u16bit := func_getu16bit;
  307. global_s32bit := l;
  308. end;
  309. procedure nested_two_proc(l : longint);
  310. begin
  311. global_s64bit := l;
  312. end;
  313. function nested_one_func(level1_b : byte; s: shortstring): byte;
  314. var
  315. s1 : shortstring;
  316. function nested_two_func(level2_b : byte; s :shortstring): byte;
  317. begin
  318. nested_two_func:=level2_b;
  319. global_bigstring := s;
  320. nested_one_proc(RESULT_S32BIT);
  321. end;
  322. begin
  323. s1:=s;
  324. nested_one_func := nested_two_func(level1_b,s1);
  325. nested_two_proc(level1_b);
  326. end;
  327. var
  328. local_b: byte;
  329. smallarray: tsmallarray;
  330. begin
  331. fillchar(smallarray, sizeof(smallarray), #0);
  332. smallarray[1] := RESULT_U8BIT;
  333. smallarray[SMALL_INDEX] := RESULT_U8BIT;
  334. func_array_mixed_nested := smallarray;
  335. local_b:=b;
  336. global_u8bit := nested_one_func(local_b, object_bigstring);
  337. end;
  338. {**************************************************************************}
  339. { FAILED OBJECT }
  340. {**************************************************************************}
  341. constructor tfailvmtobject.constructor_public_none;register;
  342. begin
  343. { this calls the constructor fail special keyword }
  344. fail;
  345. end;
  346. {**************************************************************************}
  347. { VMT OBJECT }
  348. {**************************************************************************}
  349. constructor tvmtobject.constructor_params_mixed(u8 :byte; u16: word;
  350. bigstring: shortstring; s32: longint; s64: int64);register;
  351. begin
  352. object_u8bit := u8;
  353. object_u16bit := u16;
  354. object_bigstring := bigstring;
  355. object_s32bit := s32;
  356. object_s64bit := s64;
  357. end;
  358. constructor tvmtobject.constructor_init;register;
  359. begin
  360. object_u8bit := 0;
  361. object_u16bit := 0;
  362. object_bigstring := '';
  363. object_s32bit := 0;
  364. object_s64bit := 0;
  365. end;
  366. destructor tvmtobject.destructor_params_done;register;
  367. begin
  368. object_u8bit := 0;
  369. object_u16bit := 0;
  370. object_bigstring := '';
  371. object_s32bit := 0;
  372. object_s64bit := 0;
  373. end;
  374. procedure tvmtobject.method_normal_params_mixed(
  375. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  376. begin
  377. object_u8bit := u8;
  378. object_u16bit := u16;
  379. object_bigstring := bigstring;
  380. object_s32bit := s32;
  381. object_s64bit := s64;
  382. end;
  383. procedure tvmtobject.method_virtual_params_mixed(
  384. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  385. begin
  386. object_u8bit := u8;
  387. object_u16bit := u16;
  388. object_bigstring := bigstring;
  389. object_s32bit := s32;
  390. object_s64bit := s64;
  391. end;
  392. { this one should be overriden }
  393. procedure tvmtobject.method_virtual_overriden_params_mixed(
  394. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  395. begin
  396. RunError(211);
  397. end;
  398. { can't access field of instances in static methods }
  399. procedure tvmtobject.method_static_params_mixed(
  400. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  401. begin
  402. global_u8bit := u8;
  403. global_u16bit := u16;
  404. global_bigstring := bigstring;
  405. global_s32bit := s32;
  406. global_s64bit := s64;
  407. end;
  408. procedure tvmtobject.method_normal_call_inherited_params_mixed(
  409. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  410. begin
  411. object_u8bit := u8;
  412. object_u16bit := u16;
  413. object_bigstring := bigstring;
  414. object_s32bit := s32;
  415. object_s64bit := s64;
  416. end;
  417. procedure tvmtobject.method_virtual_call_static_params_mixed(
  418. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  419. begin
  420. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  421. end;
  422. procedure tvmtobject.method_virtual_call_virtual_params_mixed(
  423. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  424. begin
  425. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  426. end;
  427. procedure tvmtobject.method_virtual_call_overriden_params_mixed(
  428. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  429. begin
  430. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  431. end;
  432. procedure tvmtobject.method_virtual_call_normal_params_mixed(
  433. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  434. begin
  435. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  436. end;
  437. procedure tvmtobject.method_virtual_call_constructor_params_mixed(
  438. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  439. begin
  440. constructor_params_mixed(u8, u16, bigstring, s32, s64);
  441. end;
  442. procedure tvmtobject.method_virtual_call_inherited_params_mixed(
  443. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  444. begin
  445. object_u8bit := u8;
  446. object_u16bit := u16;
  447. object_bigstring := bigstring;
  448. object_s32bit := s32;
  449. object_s64bit := s64;
  450. end;
  451. {**************************************************************************}
  452. { INHERITED VMT OBJECT }
  453. {**************************************************************************}
  454. constructor theritedvmtobject.constructor_params_mixed_call_virtual(
  455. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  456. begin
  457. object_u8bit := 0;
  458. object_u16bit := 0;
  459. object_bigstring := '';
  460. object_s32bit := 0;
  461. object_s64bit := 0;
  462. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  463. end;
  464. constructor theritedvmtobject.constructor_params_mixed_call_overriden(
  465. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  466. begin
  467. object_u8bit := 0;
  468. object_u16bit := 0;
  469. object_bigstring := '';
  470. object_s32bit := 0;
  471. object_s64bit := 0;
  472. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  473. end;
  474. constructor theritedvmtobject.constructor_params_mixed_call_static(
  475. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  476. begin
  477. object_u8bit := 0;
  478. object_u16bit := 0;
  479. object_bigstring := '';
  480. object_s32bit := 0;
  481. object_s64bit := 0;
  482. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  483. end;
  484. constructor theritedvmtobject.constructor_params_mixed_call_normal(
  485. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  486. begin
  487. object_u8bit := 0;
  488. object_u16bit := 0;
  489. object_bigstring := '';
  490. object_s32bit := 0;
  491. object_s64bit := 0;
  492. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  493. end;
  494. constructor theritedvmtobject.constructor_params_mixed_call_inherited
  495. (u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  496. begin
  497. object_u8bit := 0;
  498. object_u16bit := 0;
  499. object_bigstring := '';
  500. object_s32bit := 0;
  501. object_s64bit := 0;
  502. inherited constructor_params_mixed(u8, u16, bigstring, s32, s64);
  503. end;
  504. { this one should be overriden }
  505. procedure theritedvmtobject.method_virtual_overriden_params_mixed(
  506. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  507. begin
  508. object_u8bit := u8;
  509. object_u16bit := u16;
  510. object_bigstring := bigstring;
  511. object_s32bit := s32;
  512. object_s64bit := s64;
  513. end;
  514. procedure theritedvmtobject.method_normal_call_static_params_mixed(
  515. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  516. begin
  517. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  518. end;
  519. procedure theritedvmtobject.method_normal_call_virtual_params_mixed(
  520. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  521. begin
  522. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  523. end;
  524. procedure theritedvmtobject.method_normal_call_overriden_params_mixed(
  525. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  526. begin
  527. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  528. end;
  529. procedure theritedvmtobject.method_normal_call_normal_params_mixed(
  530. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  531. begin
  532. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  533. end;
  534. procedure theritedvmtobject.method_normal_call_constructor_params_mixed(
  535. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  536. begin
  537. constructor_params_mixed(u8, u16, bigstring, s32, s64);
  538. end;
  539. procedure theritedvmtobject.method_normal_call_inherited_params_mixed(
  540. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  541. begin
  542. Inherited method_normal_call_inherited_params_mixed(u8, u16, bigstring,
  543. s32, s64);
  544. end;
  545. procedure theritedvmtobject.method_virtual_call_inherited_params_mixed(
  546. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);register;
  547. begin
  548. Inherited method_virtual_call_inherited_params_mixed(u8, u16, bigstring,
  549. s32, s64);
  550. end;
  551. procedure testnovmtobject;
  552. var
  553. novmtobject : tnovmtobject;
  554. failed : boolean;
  555. begin
  556. {******************** STATIC / METHOD SIMPLE CALL **********************}
  557. Write('No parameter / method call testing...');
  558. failed := false;
  559. clear_globals;
  560. clear_values;
  561. tnovmtobject.method_public_static_none;
  562. if global_u8bit <> RESULT_U8BIT then
  563. failed := true;
  564. clear_globals;
  565. clear_values;
  566. novmtobject.method_public_static_none;
  567. if global_u8bit <> RESULT_U8BIT then
  568. failed := true;
  569. clear_globals;
  570. clear_values;
  571. tnovmtobject.method_call_private_static_none;
  572. if global_u16bit <> RESULT_U8BIT then
  573. failed := true;
  574. clear_globals;
  575. clear_values;
  576. novmtobject.method_call_private_static_none;
  577. if global_u16bit <> RESULT_U8BIT then
  578. failed := true;
  579. clear_globals;
  580. clear_values;
  581. novmtobject.method_public_none;
  582. if global_u8bit <> RESULT_U8BIT then
  583. failed := true;
  584. clear_globals;
  585. clear_values;
  586. novmtobject.method_call_private_none;
  587. if global_u16bit <> (RESULT_U16BIT) then
  588. failed := true;
  589. if failed then
  590. fail
  591. else
  592. WriteLn('Passed!');
  593. Write('Simple parameter (LOC_CONSTANT) / method call testing...');
  594. failed := false;
  595. clear_globals;
  596. clear_values;
  597. { parameter is LOC_CONSTANT }
  598. novmtobject.method_public_u8(RESULT_U8BIT);
  599. if global_u8bit <> RESULT_U8BIT then
  600. failed := true;
  601. clear_globals;
  602. clear_values;
  603. tnovmtobject.method_public_static_u8(RESULT_U8BIT);
  604. if global_u8bit <> RESULT_U8BIT then
  605. failed := true;
  606. clear_globals;
  607. clear_values;
  608. novmtobject.method_public_static_u8(RESULT_U8BIT);
  609. if global_u8bit <> RESULT_U8BIT then
  610. failed := true;
  611. clear_globals;
  612. clear_values;
  613. novmtobject.method_call_private_u8(RESULT_U8BIT);
  614. if global_u16bit <> (RESULT_U16BIT) then
  615. failed := true;
  616. clear_globals;
  617. clear_values;
  618. novmtobject.method_call_private_static_u8(RESULT_U8BIT);
  619. if global_u16bit <> (RESULT_U8BIT) then
  620. failed := true;
  621. if failed then
  622. fail
  623. else
  624. WriteLn('Passed!');
  625. Write('Simple parameter (LOC_REFERENCE) / method call testing...');
  626. failed := false;
  627. clear_globals;
  628. clear_values;
  629. value_u8bit := RESULT_U8BIT;
  630. novmtobject.method_public_u8(value_u8bit);
  631. if global_u8bit <> RESULT_U8BIT then
  632. failed := true;
  633. clear_globals;
  634. clear_values;
  635. value_u8bit := RESULT_U8BIT;
  636. tnovmtobject.method_public_static_u8(value_u8bit);
  637. if global_u8bit <> RESULT_U8BIT then
  638. failed := true;
  639. clear_globals;
  640. clear_values;
  641. value_u8bit := RESULT_U8BIT;
  642. novmtobject.method_public_static_u8(value_u8bit);
  643. if global_u8bit <> RESULT_U8BIT then
  644. failed := true;
  645. clear_globals;
  646. clear_values;
  647. value_u8bit := RESULT_U8BIT;
  648. novmtobject.method_call_private_u8(value_u8bit);
  649. if global_u16bit <> (RESULT_U16BIT) then
  650. failed := true;
  651. clear_globals;
  652. clear_values;
  653. value_u8bit := RESULT_U8BIT;
  654. novmtobject.method_call_private_static_u8(value_u8bit);
  655. if global_u16bit <> (RESULT_U8BIT) then
  656. failed := true;
  657. if failed then
  658. fail
  659. else
  660. WriteLn('Passed!');
  661. Write('Simple parameter (LOC_REGISTER) / method call testing...');
  662. failed := false;
  663. clear_globals;
  664. clear_values;
  665. novmtobject.method_public_u8(getu8);
  666. if global_u8bit <> RESULT_U8BIT then
  667. failed := true;
  668. clear_globals;
  669. clear_values;
  670. tnovmtobject.method_public_static_u8(getu8);
  671. if global_u8bit <> RESULT_U8BIT then
  672. failed := true;
  673. clear_globals;
  674. clear_values;
  675. novmtobject.method_public_static_u8(getu8);
  676. if global_u8bit <> RESULT_U8BIT then
  677. failed := true;
  678. clear_globals;
  679. clear_values;
  680. novmtobject.method_call_private_u8(getu8);
  681. if global_u16bit <> (RESULT_U16BIT) then
  682. failed := true;
  683. clear_globals;
  684. clear_values;
  685. novmtobject.method_call_private_static_u8(getu8);
  686. if global_u16bit <> (RESULT_U8BIT) then
  687. failed := true;
  688. if failed then
  689. fail
  690. else
  691. WriteLn('Passed!');
  692. Write('Simple parameter / complex return / nested method access testing...');
  693. clear_globals;
  694. clear_values;
  695. failed := false;
  696. novmtobject.object_bigstring := RESULT_BIGSTRING;
  697. novmtobject.object_u16bit := RESULT_U16BIT;
  698. value_smallarray := novmtobject.func_array_mixed_nested(RESULT_U8BIT);
  699. if (value_smallarray[1] <> RESULT_U8BIT) or (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) then
  700. failed := true;
  701. if global_u8bit <> RESULT_U8BIT then
  702. failed := true;
  703. if global_bigstring <> RESULT_BIGSTRING then
  704. failed := true;
  705. if global_u16bit <> RESULT_U16BIT then
  706. failed := true;
  707. if global_s32bit <> RESULT_S32BIT then
  708. failed := true;
  709. if global_s64bit <> RESULT_U8BIT then
  710. failed := true;
  711. if failed then
  712. fail
  713. else
  714. WriteLn('Passed!');
  715. end;
  716. procedure testfailedobject;
  717. var
  718. failedobject : tfailvmtobject;
  719. begin
  720. Write('Testing constructor return value...');
  721. if failedobject.constructor_public_none then
  722. fail
  723. else
  724. Writeln('Passed!');
  725. end;
  726. procedure testvmtobject;
  727. var
  728. vmtobject : tvmtobject;
  729. failed : boolean;
  730. begin
  731. clear_globals;
  732. clear_values;
  733. failed := false;
  734. Write('Testing mixed parameter (LOC_CONSTANT) constructor call...');
  735. vmtobject.constructor_params_mixed(RESULT_U8BIT, RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  736. if vmtobject.object_u8bit <> RESULT_U8BIT then
  737. failed := true;
  738. if vmtobject.object_u16bit <> RESULT_U16BIT then
  739. failed := true;
  740. if vmtobject.object_s32bit <> RESULT_S32BIT then
  741. failed := true;
  742. if vmtobject.object_s64bit <> RESULT_S64BIT then
  743. failed := true;
  744. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  745. failed := true;
  746. vmtobject.destructor_params_done;
  747. if failed then
  748. fail
  749. else
  750. Writeln('Passed!');
  751. clear_globals;
  752. clear_values;
  753. failed := false;
  754. Write('Testing mixed parameter (LOC_REFERENCE) constructor call...');
  755. value_u8bit := RESULT_U8BIT;
  756. value_u16bit := RESULT_U16BIT;
  757. value_bigstring := RESULT_BIGSTRING;
  758. value_s32bit := RESULT_S32BIT;
  759. value_s64bit := RESULT_S64BIT;
  760. vmtobject.constructor_params_mixed(value_u8bit, value_u16bit, value_bigstring,
  761. value_s32bit, value_s64bit);
  762. if vmtobject.object_u8bit <> RESULT_U8BIT then
  763. failed := true;
  764. if vmtobject.object_u16bit <> RESULT_U16BIT then
  765. failed := true;
  766. if vmtobject.object_s32bit <> RESULT_S32BIT then
  767. failed := true;
  768. if vmtobject.object_s64bit <> RESULT_S64BIT then
  769. failed := true;
  770. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  771. failed := true;
  772. vmtobject.destructor_params_done;
  773. if failed then
  774. fail
  775. else
  776. Writeln('Passed!');
  777. end;
  778. procedure testheritedvmtobject;
  779. var
  780. vmtobject : theritedvmtobject;
  781. failed : boolean;
  782. begin
  783. {********************** CONSTRUCTOR TESTING ************************}
  784. {********************** DESTRUCTOR TESTING ************************}
  785. clear_globals;
  786. clear_values;
  787. failed := false;
  788. Write('Testing mixed parameter (LOC_CONSTANT) inherited constructor call...');
  789. vmtobject.constructor_params_mixed_call_inherited(RESULT_U8BIT, RESULT_U16BIT, RESULT_BIGSTRING,
  790. RESULT_S32BIT, RESULT_S64BIT);
  791. if vmtobject.object_u8bit <> RESULT_U8BIT then
  792. failed := true;
  793. if vmtobject.object_u16bit <> RESULT_U16BIT then
  794. failed := true;
  795. if vmtobject.object_s32bit <> RESULT_S32BIT then
  796. failed := true;
  797. if vmtobject.object_s64bit <> RESULT_S64BIT then
  798. failed := true;
  799. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  800. failed := true;
  801. vmtobject.destructor_params_done;
  802. if failed then
  803. fail
  804. else
  805. Writeln('Passed!');
  806. clear_globals;
  807. clear_values;
  808. failed := false;
  809. Write('Testing mixed parameter (LOC_REFERENCE) inherited constructor call...');
  810. value_u8bit := RESULT_U8BIT;
  811. value_u16bit := RESULT_U16BIT;
  812. value_bigstring := RESULT_BIGSTRING;
  813. value_s32bit := RESULT_S32BIT;
  814. value_s64bit := RESULT_S64BIT;
  815. vmtobject.constructor_params_mixed_call_inherited(value_u8bit,
  816. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  817. if vmtobject.object_u8bit <> RESULT_U8BIT then
  818. failed := true;
  819. if vmtobject.object_u16bit <> RESULT_U16BIT then
  820. failed := true;
  821. if vmtobject.object_s32bit <> RESULT_S32BIT then
  822. failed := true;
  823. if vmtobject.object_s64bit <> RESULT_S64BIT then
  824. failed := true;
  825. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  826. failed := true;
  827. vmtobject.destructor_params_done;
  828. if failed then
  829. fail
  830. else
  831. Writeln('Passed!');
  832. clear_globals;
  833. clear_values;
  834. failed := false;
  835. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  836. vmtobject.constructor_params_mixed_call_virtual(RESULT_U8BIT,
  837. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  838. if vmtobject.object_u8bit <> RESULT_U8BIT then
  839. failed := true;
  840. if vmtobject.object_u16bit <> RESULT_U16BIT then
  841. failed := true;
  842. if vmtobject.object_s32bit <> RESULT_S32BIT then
  843. failed := true;
  844. if vmtobject.object_s64bit <> RESULT_S64BIT then
  845. failed := true;
  846. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  847. failed := true;
  848. vmtobject.destructor_params_done;
  849. if failed then
  850. fail
  851. else
  852. Writeln('Passed!');
  853. clear_globals;
  854. clear_values;
  855. failed := false;
  856. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  857. value_u8bit := RESULT_U8BIT;
  858. value_u16bit := RESULT_U16BIT;
  859. value_bigstring := RESULT_BIGSTRING;
  860. value_s32bit := RESULT_S32BIT;
  861. value_s64bit := RESULT_S64BIT;
  862. vmtobject.constructor_params_mixed_call_virtual(value_u8bit,
  863. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  864. if vmtobject.object_u8bit <> RESULT_U8BIT then
  865. failed := true;
  866. if vmtobject.object_u16bit <> RESULT_U16BIT then
  867. failed := true;
  868. if vmtobject.object_s32bit <> RESULT_S32BIT then
  869. failed := true;
  870. if vmtobject.object_s64bit <> RESULT_S64BIT then
  871. failed := true;
  872. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  873. failed := true;
  874. vmtobject.destructor_params_done;
  875. if failed then
  876. fail
  877. else
  878. Writeln('Passed!');
  879. clear_globals;
  880. clear_values;
  881. failed := false;
  882. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  883. vmtobject.constructor_params_mixed_call_overriden(RESULT_U8BIT,
  884. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  885. if vmtobject.object_u8bit <> RESULT_U8BIT then
  886. failed := true;
  887. if vmtobject.object_u16bit <> RESULT_U16BIT then
  888. failed := true;
  889. if vmtobject.object_s32bit <> RESULT_S32BIT then
  890. failed := true;
  891. if vmtobject.object_s64bit <> RESULT_S64BIT then
  892. failed := true;
  893. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  894. failed := true;
  895. vmtobject.destructor_params_done;
  896. if failed then
  897. fail
  898. else
  899. Writeln('Passed!');
  900. clear_globals;
  901. clear_values;
  902. failed := false;
  903. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  904. value_u8bit := RESULT_U8BIT;
  905. value_u16bit := RESULT_U16BIT;
  906. value_bigstring := RESULT_BIGSTRING;
  907. value_s32bit := RESULT_S32BIT;
  908. value_s64bit := RESULT_S64BIT;
  909. vmtobject.constructor_params_mixed_call_overriden(value_u8bit,
  910. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  911. if vmtobject.object_u8bit <> RESULT_U8BIT then
  912. failed := true;
  913. if vmtobject.object_u16bit <> RESULT_U16BIT then
  914. failed := true;
  915. if vmtobject.object_s32bit <> RESULT_S32BIT then
  916. failed := true;
  917. if vmtobject.object_s64bit <> RESULT_S64BIT then
  918. failed := true;
  919. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  920. failed := true;
  921. vmtobject.destructor_params_done;
  922. if failed then
  923. fail
  924. else
  925. Writeln('Passed!');
  926. clear_globals;
  927. clear_values;
  928. failed := false;
  929. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/method call...');
  930. vmtobject.constructor_params_mixed_call_normal(RESULT_U8BIT,
  931. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  932. if vmtobject.object_u8bit <> RESULT_U8BIT then
  933. failed := true;
  934. if vmtobject.object_u16bit <> RESULT_U16BIT then
  935. failed := true;
  936. if vmtobject.object_s32bit <> RESULT_S32BIT then
  937. failed := true;
  938. if vmtobject.object_s64bit <> RESULT_S64BIT then
  939. failed := true;
  940. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  941. failed := true;
  942. vmtobject.destructor_params_done;
  943. if failed then
  944. fail
  945. else
  946. Writeln('Passed!');
  947. clear_globals;
  948. clear_values;
  949. failed := false;
  950. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/method call...');
  951. value_u8bit := RESULT_U8BIT;
  952. value_u16bit := RESULT_U16BIT;
  953. value_bigstring := RESULT_BIGSTRING;
  954. value_s32bit := RESULT_S32BIT;
  955. value_s64bit := RESULT_S64BIT;
  956. vmtobject.constructor_params_mixed_call_normal(value_u8bit,
  957. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  958. if vmtobject.object_u8bit <> RESULT_U8BIT then
  959. failed := true;
  960. if vmtobject.object_u16bit <> RESULT_U16BIT then
  961. failed := true;
  962. if vmtobject.object_s32bit <> RESULT_S32BIT then
  963. failed := true;
  964. if vmtobject.object_s64bit <> RESULT_S64BIT then
  965. failed := true;
  966. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  967. failed := true;
  968. vmtobject.destructor_params_done;
  969. if failed then
  970. fail
  971. else
  972. Writeln('Passed!');
  973. clear_globals;
  974. clear_values;
  975. failed := false;
  976. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/static call...');
  977. vmtobject.constructor_params_mixed_call_static(RESULT_U8BIT,
  978. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  979. if global_u8bit <> RESULT_U8BIT then
  980. failed := true;
  981. if global_u16bit <> RESULT_U16BIT then
  982. failed := true;
  983. if global_s32bit <> RESULT_S32BIT then
  984. failed := true;
  985. if global_s64bit <> RESULT_S64BIT then
  986. failed := true;
  987. if global_bigstring <> RESULT_BIGSTRING then
  988. failed := true;
  989. vmtobject.destructor_params_done;
  990. if failed then
  991. fail
  992. else
  993. Writeln('Passed!');
  994. clear_globals;
  995. clear_values;
  996. failed := false;
  997. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/static call...');
  998. value_u8bit := RESULT_U8BIT;
  999. value_u16bit := RESULT_U16BIT;
  1000. value_bigstring := RESULT_BIGSTRING;
  1001. value_s32bit := RESULT_S32BIT;
  1002. value_s64bit := RESULT_S64BIT;
  1003. vmtobject.constructor_params_mixed_call_static(value_u8bit,
  1004. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1005. if global_u8bit <> RESULT_U8BIT then
  1006. failed := true;
  1007. if global_u16bit <> RESULT_U16BIT then
  1008. failed := true;
  1009. if global_s32bit <> RESULT_S32BIT then
  1010. failed := true;
  1011. if global_s64bit <> RESULT_S64BIT then
  1012. failed := true;
  1013. if global_bigstring <> RESULT_BIGSTRING then
  1014. failed := true;
  1015. vmtobject.destructor_params_done;
  1016. if failed then
  1017. fail
  1018. else
  1019. Writeln('Passed!');
  1020. {************************* METHOD TESTING **************************}
  1021. clear_globals;
  1022. clear_values;
  1023. failed := false;
  1024. vmtobject.constructor_init;
  1025. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  1026. vmtobject.method_virtual_params_mixed(RESULT_U8BIT,
  1027. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1028. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1029. failed := true;
  1030. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1031. failed := true;
  1032. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1033. failed := true;
  1034. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1035. failed := true;
  1036. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1037. failed := true;
  1038. vmtobject.destructor_params_done;
  1039. if failed then
  1040. fail
  1041. else
  1042. Writeln('Passed!');
  1043. clear_globals;
  1044. clear_values;
  1045. failed := false;
  1046. vmtobject.constructor_init;
  1047. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  1048. value_u8bit := RESULT_U8BIT;
  1049. value_u16bit := RESULT_U16BIT;
  1050. value_bigstring := RESULT_BIGSTRING;
  1051. value_s32bit := RESULT_S32BIT;
  1052. value_s64bit := RESULT_S64BIT;
  1053. vmtobject.method_virtual_params_mixed(value_u8bit,
  1054. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1055. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1056. failed := true;
  1057. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1058. failed := true;
  1059. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1060. failed := true;
  1061. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1062. failed := true;
  1063. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1064. failed := true;
  1065. vmtobject.destructor_params_done;
  1066. if failed then
  1067. fail
  1068. else
  1069. Writeln('Passed!');
  1070. clear_globals;
  1071. clear_values;
  1072. failed := false;
  1073. vmtobject.constructor_init;
  1074. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  1075. vmtobject.method_virtual_overriden_params_mixed(RESULT_U8BIT,
  1076. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1077. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1078. failed := true;
  1079. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1080. failed := true;
  1081. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1082. failed := true;
  1083. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1084. failed := true;
  1085. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1086. failed := true;
  1087. vmtobject.destructor_params_done;
  1088. if failed then
  1089. fail
  1090. else
  1091. Writeln('Passed!');
  1092. clear_globals;
  1093. clear_values;
  1094. failed := false;
  1095. vmtobject.constructor_init;
  1096. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  1097. value_u8bit := RESULT_U8BIT;
  1098. value_u16bit := RESULT_U16BIT;
  1099. value_bigstring := RESULT_BIGSTRING;
  1100. value_s32bit := RESULT_S32BIT;
  1101. value_s64bit := RESULT_S64BIT;
  1102. vmtobject.method_virtual_overriden_params_mixed(value_u8bit,
  1103. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1104. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1105. failed := true;
  1106. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1107. failed := true;
  1108. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1109. failed := true;
  1110. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1111. failed := true;
  1112. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1113. failed := true;
  1114. vmtobject.destructor_params_done;
  1115. if failed then
  1116. fail
  1117. else
  1118. Writeln('Passed!');
  1119. clear_globals;
  1120. clear_values;
  1121. failed := false;
  1122. vmtobject.constructor_init;
  1123. Write('Testing mixed parameter (LOC_CONSTANT) method call...');
  1124. vmtobject.method_normal_params_mixed(RESULT_U8BIT,
  1125. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1126. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1127. failed := true;
  1128. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1129. failed := true;
  1130. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1131. failed := true;
  1132. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1133. failed := true;
  1134. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1135. failed := true;
  1136. vmtobject.destructor_params_done;
  1137. if failed then
  1138. fail
  1139. else
  1140. Writeln('Passed!');
  1141. clear_globals;
  1142. clear_values;
  1143. failed := false;
  1144. vmtobject.constructor_init;
  1145. Write('Testing mixed parameter (LOC_REFERENCE) method call...');
  1146. value_u8bit := RESULT_U8BIT;
  1147. value_u16bit := RESULT_U16BIT;
  1148. value_bigstring := RESULT_BIGSTRING;
  1149. value_s32bit := RESULT_S32BIT;
  1150. value_s64bit := RESULT_S64BIT;
  1151. vmtobject.method_normal_params_mixed(value_u8bit,
  1152. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1153. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1154. failed := true;
  1155. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1156. failed := true;
  1157. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1158. failed := true;
  1159. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1160. failed := true;
  1161. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1162. failed := true;
  1163. vmtobject.destructor_params_done;
  1164. if failed then
  1165. fail
  1166. else
  1167. Writeln('Passed!');
  1168. clear_globals;
  1169. clear_values;
  1170. failed := false;
  1171. vmtobject.constructor_init;
  1172. Write('Testing mixed parameter (LOC_CONSTANT) static method call...');
  1173. vmtobject.method_static_params_mixed(RESULT_U8BIT,
  1174. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1175. if global_u8bit <> RESULT_U8BIT then
  1176. failed := true;
  1177. if global_u16bit <> RESULT_U16BIT then
  1178. failed := true;
  1179. if global_s32bit <> RESULT_S32BIT then
  1180. failed := true;
  1181. if global_s64bit <> RESULT_S64BIT then
  1182. failed := true;
  1183. if global_bigstring <> RESULT_BIGSTRING then
  1184. failed := true;
  1185. vmtobject.destructor_params_done;
  1186. if failed then
  1187. fail
  1188. else
  1189. Writeln('Passed!');
  1190. clear_globals;
  1191. clear_values;
  1192. failed := false;
  1193. vmtobject.constructor_init;
  1194. Write('Testing mixed parameter (LOC_REFERENCE) static method call...');
  1195. value_u8bit := RESULT_U8BIT;
  1196. value_u16bit := RESULT_U16BIT;
  1197. value_bigstring := RESULT_BIGSTRING;
  1198. value_s32bit := RESULT_S32BIT;
  1199. value_s64bit := RESULT_S64BIT;
  1200. vmtobject.method_static_params_mixed(value_u8bit,
  1201. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1202. if global_u8bit <> RESULT_U8BIT then
  1203. failed := true;
  1204. if global_u16bit <> RESULT_U16BIT then
  1205. failed := true;
  1206. if global_s32bit <> RESULT_S32BIT then
  1207. failed := true;
  1208. if global_s64bit <> RESULT_S64BIT then
  1209. failed := true;
  1210. if global_bigstring <> RESULT_BIGSTRING then
  1211. failed := true;
  1212. vmtobject.destructor_params_done;
  1213. if failed then
  1214. fail
  1215. else
  1216. Writeln('Passed!');
  1217. { ********************************************************************
  1218. This calls methods which in turn call other methods, or a constructor
  1219. or a destructor.
  1220. *********************************************************************
  1221. }
  1222. clear_globals;
  1223. clear_values;
  1224. failed := false;
  1225. { Calls the ancestor virtual method }
  1226. vmtobject.constructor_init;
  1227. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  1228. vmtobject.method_normal_call_virtual_params_mixed(RESULT_U8BIT,
  1229. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1230. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1231. failed := true;
  1232. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1233. failed := true;
  1234. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1235. failed := true;
  1236. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1237. failed := true;
  1238. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1239. failed := true;
  1240. vmtobject.destructor_params_done;
  1241. if failed then
  1242. fail
  1243. else
  1244. Writeln('Passed!');
  1245. clear_globals;
  1246. clear_values;
  1247. failed := false;
  1248. vmtobject.constructor_init;
  1249. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  1250. value_u8bit := RESULT_U8BIT;
  1251. value_u16bit := RESULT_U16BIT;
  1252. value_bigstring := RESULT_BIGSTRING;
  1253. value_s32bit := RESULT_S32BIT;
  1254. value_s64bit := RESULT_S64BIT;
  1255. vmtobject.method_normal_call_virtual_params_mixed(value_u8bit,
  1256. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1257. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1258. failed := true;
  1259. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1260. failed := true;
  1261. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1262. failed := true;
  1263. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1264. failed := true;
  1265. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1266. failed := true;
  1267. vmtobject.destructor_params_done;
  1268. if failed then
  1269. fail
  1270. else
  1271. Writeln('Passed!');
  1272. { The virtual method has been overriden by the object in this case }
  1273. vmtobject.constructor_init;
  1274. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  1275. vmtobject.method_normal_call_overriden_params_mixed(RESULT_U8BIT,
  1276. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1277. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1278. failed := true;
  1279. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1280. failed := true;
  1281. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1282. failed := true;
  1283. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1284. failed := true;
  1285. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1286. failed := true;
  1287. vmtobject.destructor_params_done;
  1288. if failed then
  1289. fail
  1290. else
  1291. Writeln('Passed!');
  1292. clear_globals;
  1293. clear_values;
  1294. failed := false;
  1295. vmtobject.constructor_init;
  1296. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  1297. value_u8bit := RESULT_U8BIT;
  1298. value_u16bit := RESULT_U16BIT;
  1299. value_bigstring := RESULT_BIGSTRING;
  1300. value_s32bit := RESULT_S32BIT;
  1301. value_s64bit := RESULT_S64BIT;
  1302. vmtobject.method_normal_call_overriden_params_mixed(value_u8bit,
  1303. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1304. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1305. failed := true;
  1306. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1307. failed := true;
  1308. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1309. failed := true;
  1310. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1311. failed := true;
  1312. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1313. failed := true;
  1314. vmtobject.destructor_params_done;
  1315. if failed then
  1316. fail
  1317. else
  1318. Writeln('Passed!');
  1319. clear_globals;
  1320. clear_values;
  1321. failed := false;
  1322. vmtobject.constructor_init;
  1323. Write('Testing mixed parameter (LOC_CONSTANT) method call w/normal call...');
  1324. vmtobject.method_normal_call_normal_params_mixed(RESULT_U8BIT,
  1325. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1326. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1327. failed := true;
  1328. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1329. failed := true;
  1330. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1331. failed := true;
  1332. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1333. failed := true;
  1334. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1335. failed := true;
  1336. vmtobject.destructor_params_done;
  1337. if failed then
  1338. fail
  1339. else
  1340. Writeln('Passed!');
  1341. clear_globals;
  1342. clear_values;
  1343. failed := false;
  1344. vmtobject.constructor_init;
  1345. Write('Testing mixed parameter (LOC_REFERENCE) method call w/normal call...');
  1346. value_u8bit := RESULT_U8BIT;
  1347. value_u16bit := RESULT_U16BIT;
  1348. value_bigstring := RESULT_BIGSTRING;
  1349. value_s32bit := RESULT_S32BIT;
  1350. value_s64bit := RESULT_S64BIT;
  1351. vmtobject.method_normal_call_normal_params_mixed(value_u8bit,
  1352. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1353. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1354. failed := true;
  1355. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1356. failed := true;
  1357. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1358. failed := true;
  1359. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1360. failed := true;
  1361. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1362. failed := true;
  1363. vmtobject.destructor_params_done;
  1364. if failed then
  1365. fail
  1366. else
  1367. Writeln('Passed!');
  1368. (* constructor call inside a normal method *)
  1369. clear_globals;
  1370. clear_values;
  1371. failed := false;
  1372. vmtobject.constructor_init;
  1373. Write('Testing mixed parameter (LOC_CONSTANT) method call w/constructor call...');
  1374. vmtobject.method_normal_call_constructor_params_mixed(RESULT_U8BIT,
  1375. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1376. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1377. failed := true;
  1378. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1379. failed := true;
  1380. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1381. failed := true;
  1382. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1383. failed := true;
  1384. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1385. failed := true;
  1386. vmtobject.destructor_params_done;
  1387. if failed then
  1388. fail
  1389. else
  1390. Writeln('Passed!');
  1391. clear_globals;
  1392. clear_values;
  1393. failed := false;
  1394. vmtobject.constructor_init;
  1395. Write('Testing mixed parameter (LOC_REFERENCE) method call w/constructor call...');
  1396. value_u8bit := RESULT_U8BIT;
  1397. value_u16bit := RESULT_U16BIT;
  1398. value_bigstring := RESULT_BIGSTRING;
  1399. value_s32bit := RESULT_S32BIT;
  1400. value_s64bit := RESULT_S64BIT;
  1401. vmtobject.method_normal_call_constructor_params_mixed(value_u8bit,
  1402. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1403. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1404. failed := true;
  1405. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1406. failed := true;
  1407. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1408. failed := true;
  1409. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1410. failed := true;
  1411. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1412. failed := true;
  1413. vmtobject.destructor_params_done;
  1414. if failed then
  1415. fail
  1416. else
  1417. Writeln('Passed!');
  1418. { static method call }
  1419. clear_globals;
  1420. clear_values;
  1421. failed := false;
  1422. vmtobject.constructor_init;
  1423. Write('Testing mixed parameter (LOC_CONSTANT) method call w/static call...');
  1424. vmtobject.method_normal_call_static_params_mixed(RESULT_U8BIT,
  1425. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1426. if global_u8bit <> RESULT_U8BIT then
  1427. failed := true;
  1428. if global_u16bit <> RESULT_U16BIT then
  1429. failed := true;
  1430. if global_s32bit <> RESULT_S32BIT then
  1431. failed := true;
  1432. if global_s64bit <> RESULT_S64BIT then
  1433. failed := true;
  1434. if global_bigstring <> RESULT_BIGSTRING then
  1435. failed := true;
  1436. vmtobject.destructor_params_done;
  1437. if failed then
  1438. fail
  1439. else
  1440. Writeln('Passed!');
  1441. clear_globals;
  1442. clear_values;
  1443. failed := false;
  1444. vmtobject.constructor_init;
  1445. Write('Testing mixed parameter (LOC_REFERENCE) method call w/static call...');
  1446. value_u8bit := RESULT_U8BIT;
  1447. value_u16bit := RESULT_U16BIT;
  1448. value_bigstring := RESULT_BIGSTRING;
  1449. value_s32bit := RESULT_S32BIT;
  1450. value_s64bit := RESULT_S64BIT;
  1451. vmtobject.method_normal_call_static_params_mixed(value_u8bit,
  1452. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1453. if global_u8bit <> RESULT_U8BIT then
  1454. failed := true;
  1455. if global_u16bit <> RESULT_U16BIT then
  1456. failed := true;
  1457. if global_s32bit <> RESULT_S32BIT then
  1458. failed := true;
  1459. if global_s64bit <> RESULT_S64BIT then
  1460. failed := true;
  1461. if global_bigstring <> RESULT_BIGSTRING then
  1462. failed := true;
  1463. vmtobject.destructor_params_done;
  1464. if failed then
  1465. fail
  1466. else
  1467. Writeln('Passed!');
  1468. (* calls the inherited method *)
  1469. clear_globals;
  1470. clear_values;
  1471. failed := false;
  1472. { Calls the ancestor virtual method }
  1473. vmtobject.constructor_init;
  1474. Write('Testing mixed parameter (LOC_CONSTANT) method call w/inherited call...');
  1475. vmtobject.method_normal_call_inherited_params_mixed(RESULT_U8BIT,
  1476. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1477. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1478. failed := true;
  1479. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1480. failed := true;
  1481. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1482. failed := true;
  1483. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1484. failed := true;
  1485. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1486. failed := true;
  1487. vmtobject.destructor_params_done;
  1488. if failed then
  1489. fail
  1490. else
  1491. Writeln('Passed!');
  1492. clear_globals;
  1493. clear_values;
  1494. failed := false;
  1495. vmtobject.constructor_init;
  1496. Write('Testing mixed parameter (LOC_REFERENCE) method call w/inherited call...');
  1497. value_u8bit := RESULT_U8BIT;
  1498. value_u16bit := RESULT_U16BIT;
  1499. value_bigstring := RESULT_BIGSTRING;
  1500. value_s32bit := RESULT_S32BIT;
  1501. value_s64bit := RESULT_S64BIT;
  1502. vmtobject.method_normal_call_inherited_params_mixed(value_u8bit,
  1503. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1504. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1505. failed := true;
  1506. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1507. failed := true;
  1508. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1509. failed := true;
  1510. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1511. failed := true;
  1512. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1513. failed := true;
  1514. vmtobject.destructor_params_done;
  1515. if failed then
  1516. fail
  1517. else
  1518. Writeln('Passed!');
  1519. { ********************************************************************
  1520. This calls virtual methods which in turn call other methods,
  1521. or a constructor or a destructor.
  1522. *********************************************************************
  1523. }
  1524. clear_globals;
  1525. clear_values;
  1526. failed := false;
  1527. { Calls the ancestor virtual method }
  1528. vmtobject.constructor_init;
  1529. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  1530. vmtobject.method_virtual_call_virtual_params_mixed(RESULT_U8BIT,
  1531. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1532. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1533. failed := true;
  1534. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1535. failed := true;
  1536. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1537. failed := true;
  1538. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1539. failed := true;
  1540. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1541. failed := true;
  1542. vmtobject.destructor_params_done;
  1543. if failed then
  1544. fail
  1545. else
  1546. Writeln('Passed!');
  1547. clear_globals;
  1548. clear_values;
  1549. failed := false;
  1550. vmtobject.constructor_init;
  1551. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  1552. value_u8bit := RESULT_U8BIT;
  1553. value_u16bit := RESULT_U16BIT;
  1554. value_bigstring := RESULT_BIGSTRING;
  1555. value_s32bit := RESULT_S32BIT;
  1556. value_s64bit := RESULT_S64BIT;
  1557. vmtobject.method_virtual_call_virtual_params_mixed(value_u8bit,
  1558. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1559. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1560. failed := true;
  1561. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1562. failed := true;
  1563. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1564. failed := true;
  1565. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1566. failed := true;
  1567. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1568. failed := true;
  1569. vmtobject.destructor_params_done;
  1570. if failed then
  1571. fail
  1572. else
  1573. Writeln('Passed!');
  1574. { The virtual method has been overriden by the object in this case }
  1575. vmtobject.constructor_init;
  1576. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  1577. vmtobject.method_virtual_call_overriden_params_mixed(RESULT_U8BIT,
  1578. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1579. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1580. failed := true;
  1581. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1582. failed := true;
  1583. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1584. failed := true;
  1585. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1586. failed := true;
  1587. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1588. failed := true;
  1589. vmtobject.destructor_params_done;
  1590. if failed then
  1591. fail
  1592. else
  1593. Writeln('Passed!');
  1594. clear_globals;
  1595. clear_values;
  1596. failed := false;
  1597. vmtobject.constructor_init;
  1598. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  1599. value_u8bit := RESULT_U8BIT;
  1600. value_u16bit := RESULT_U16BIT;
  1601. value_bigstring := RESULT_BIGSTRING;
  1602. value_s32bit := RESULT_S32BIT;
  1603. value_s64bit := RESULT_S64BIT;
  1604. vmtobject.method_virtual_call_overriden_params_mixed(value_u8bit,
  1605. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1606. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1607. failed := true;
  1608. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1609. failed := true;
  1610. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1611. failed := true;
  1612. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1613. failed := true;
  1614. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1615. failed := true;
  1616. vmtobject.destructor_params_done;
  1617. if failed then
  1618. fail
  1619. else
  1620. Writeln('Passed!');
  1621. clear_globals;
  1622. clear_values;
  1623. failed := false;
  1624. vmtobject.constructor_init;
  1625. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/normal call...');
  1626. vmtobject.method_virtual_call_normal_params_mixed(RESULT_U8BIT,
  1627. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1628. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1629. failed := true;
  1630. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1631. failed := true;
  1632. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1633. failed := true;
  1634. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1635. failed := true;
  1636. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1637. failed := true;
  1638. vmtobject.destructor_params_done;
  1639. if failed then
  1640. fail
  1641. else
  1642. Writeln('Passed!');
  1643. clear_globals;
  1644. clear_values;
  1645. failed := false;
  1646. vmtobject.constructor_init;
  1647. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/normal call...');
  1648. value_u8bit := RESULT_U8BIT;
  1649. value_u16bit := RESULT_U16BIT;
  1650. value_bigstring := RESULT_BIGSTRING;
  1651. value_s32bit := RESULT_S32BIT;
  1652. value_s64bit := RESULT_S64BIT;
  1653. vmtobject.method_virtual_call_normal_params_mixed(value_u8bit,
  1654. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1655. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1656. failed := true;
  1657. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1658. failed := true;
  1659. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1660. failed := true;
  1661. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1662. failed := true;
  1663. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1664. failed := true;
  1665. vmtobject.destructor_params_done;
  1666. if failed then
  1667. fail
  1668. else
  1669. Writeln('Passed!');
  1670. (* constructor call inside a normal method *)
  1671. clear_globals;
  1672. clear_values;
  1673. failed := false;
  1674. vmtobject.constructor_init;
  1675. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/constructor call...');
  1676. vmtobject.method_virtual_call_constructor_params_mixed(RESULT_U8BIT,
  1677. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1678. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1679. failed := true;
  1680. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1681. failed := true;
  1682. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1683. failed := true;
  1684. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1685. failed := true;
  1686. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1687. failed := true;
  1688. vmtobject.destructor_params_done;
  1689. if failed then
  1690. fail
  1691. else
  1692. Writeln('Passed!');
  1693. clear_globals;
  1694. clear_values;
  1695. failed := false;
  1696. vmtobject.constructor_init;
  1697. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/constructor call...');
  1698. value_u8bit := RESULT_U8BIT;
  1699. value_u16bit := RESULT_U16BIT;
  1700. value_bigstring := RESULT_BIGSTRING;
  1701. value_s32bit := RESULT_S32BIT;
  1702. value_s64bit := RESULT_S64BIT;
  1703. vmtobject.method_virtual_call_constructor_params_mixed(value_u8bit,
  1704. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1705. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1706. failed := true;
  1707. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1708. failed := true;
  1709. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1710. failed := true;
  1711. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1712. failed := true;
  1713. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1714. failed := true;
  1715. vmtobject.destructor_params_done;
  1716. if failed then
  1717. fail
  1718. else
  1719. Writeln('Passed!');
  1720. { static virtual call }
  1721. clear_globals;
  1722. clear_values;
  1723. failed := false;
  1724. vmtobject.constructor_init;
  1725. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/static call...');
  1726. vmtobject.method_virtual_call_static_params_mixed(RESULT_U8BIT,
  1727. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1728. if global_u8bit <> RESULT_U8BIT then
  1729. failed := true;
  1730. if global_u16bit <> RESULT_U16BIT then
  1731. failed := true;
  1732. if global_s32bit <> RESULT_S32BIT then
  1733. failed := true;
  1734. if global_s64bit <> RESULT_S64BIT then
  1735. failed := true;
  1736. if global_bigstring <> RESULT_BIGSTRING then
  1737. failed := true;
  1738. vmtobject.destructor_params_done;
  1739. if failed then
  1740. fail
  1741. else
  1742. Writeln('Passed!');
  1743. clear_globals;
  1744. clear_values;
  1745. failed := false;
  1746. vmtobject.constructor_init;
  1747. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/static call...');
  1748. value_u8bit := RESULT_U8BIT;
  1749. value_u16bit := RESULT_U16BIT;
  1750. value_bigstring := RESULT_BIGSTRING;
  1751. value_s32bit := RESULT_S32BIT;
  1752. value_s64bit := RESULT_S64BIT;
  1753. vmtobject.method_virtual_call_static_params_mixed(value_u8bit,
  1754. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1755. if global_u8bit <> RESULT_U8BIT then
  1756. failed := true;
  1757. if global_u16bit <> RESULT_U16BIT then
  1758. failed := true;
  1759. if global_s32bit <> RESULT_S32BIT then
  1760. failed := true;
  1761. if global_s64bit <> RESULT_S64BIT then
  1762. failed := true;
  1763. if global_bigstring <> RESULT_BIGSTRING then
  1764. failed := true;
  1765. vmtobject.destructor_params_done;
  1766. if failed then
  1767. fail
  1768. else
  1769. Writeln('Passed!');
  1770. (* calls the inherited method *)
  1771. clear_globals;
  1772. clear_values;
  1773. failed := false;
  1774. { Calls the ancestor virtual method }
  1775. vmtobject.constructor_init;
  1776. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/inherited call...');
  1777. vmtobject.method_virtual_call_inherited_params_mixed(RESULT_U8BIT,
  1778. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1779. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1780. failed := true;
  1781. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1782. failed := true;
  1783. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1784. failed := true;
  1785. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1786. failed := true;
  1787. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1788. failed := true;
  1789. vmtobject.destructor_params_done;
  1790. if failed then
  1791. fail
  1792. else
  1793. Writeln('Passed!');
  1794. clear_globals;
  1795. clear_values;
  1796. failed := false;
  1797. vmtobject.constructor_init;
  1798. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/inherited call...');
  1799. value_u8bit := RESULT_U8BIT;
  1800. value_u16bit := RESULT_U16BIT;
  1801. value_bigstring := RESULT_BIGSTRING;
  1802. value_s32bit := RESULT_S32BIT;
  1803. value_s64bit := RESULT_S64BIT;
  1804. vmtobject.method_virtual_call_inherited_params_mixed(value_u8bit,
  1805. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1806. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1807. failed := true;
  1808. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1809. failed := true;
  1810. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1811. failed := true;
  1812. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1813. failed := true;
  1814. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1815. failed := true;
  1816. vmtobject.destructor_params_done;
  1817. if failed then
  1818. fail
  1819. else
  1820. Writeln('Passed!');
  1821. end;
  1822. begin
  1823. WriteLN('*********************** NO VMT OBJECT TESTS ********************');
  1824. testnovmtobject;
  1825. WriteLN('************************ VMT OBJECT FAIL **********************');
  1826. testfailedobject;
  1827. WriteLN('************************* VMT OBJECT TESTS *********************');
  1828. testvmtobject;
  1829. testheritedvmtobject;
  1830. end.
  1831. {
  1832. $Log$
  1833. Revision 1.1 2002-05-05 13:58:50 carl
  1834. + finished procedural variable testsuit
  1835. + finished method testsuit
  1836. }