tcalobj1.pp 102 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290
  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(). }
  17. { }
  18. { }
  19. {****************************************************************}
  20. program tcalobj1;
  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. {$else}
  29. BIG_INDEX = 33000;
  30. SMALL_INDEX = 13; { value should not be aligned! }
  31. {$endif}
  32. RESULT_U8BIT = $55;
  33. RESULT_U16BIT = 2*RESULT_U8BIT;
  34. RESULT_S32BIT = $500F0000;
  35. RESULT_S64BIT = $500F0000;
  36. RESULT_S32REAL = 1777.12;
  37. RESULT_S64REAL = 3444.24;
  38. RESULT_BOOL8BIT = 1;
  39. RESULT_BOOL16BIT = 1;
  40. RESULT_BOOL32BIT = 1;
  41. RESULT_PCHAR = 'Hello world';
  42. RESULT_BIGSTRING = 'Hello world';
  43. RESULT_SMALLSTRING = 'H';
  44. RESULT_CHAR = 'I';
  45. RESULT_BOOLEAN = TRUE;
  46. type
  47. tprocedure = procedure;
  48. tsmallrecord = packed record
  49. b: byte;
  50. w: word;
  51. end;
  52. tlargerecord = packed record
  53. b: array[1..BIG_INDEX] of byte;
  54. end;
  55. tsmallarray = packed array[1..SMALL_INDEX] of byte;
  56. tsmallsetenum =
  57. (A_A,A_B,A_C,A_D);
  58. tsmallset = set of tsmallsetenum;
  59. tlargeset = set of char;
  60. tsmallstring = string[2];
  61. var
  62. global_u8bit : byte;
  63. global_u16bit : word;
  64. global_s32bit : longint;
  65. global_s32real : single;
  66. global_s64real : double;
  67. global_ptr : pchar;
  68. global_proc : tprocedure;
  69. global_bigstring : shortstring;
  70. global_boolean : boolean;
  71. global_char : char;
  72. global_s64bit : int64;
  73. value_s64bit : int64;
  74. value_ansistring : ansistring;
  75. value_u8bit : byte;
  76. value_u16bit : word;
  77. value_s32bit : longint;
  78. value_s32real : single;
  79. value_s64real : double;
  80. value_proc : tprocedure;
  81. value_ptr : pchar;
  82. value_smallrec : tsmallrecord;
  83. value_largerec : tlargerecord;
  84. value_smallset : tsmallset;
  85. value_smallstring : tsmallstring;
  86. value_bigstring : shortstring;
  87. value_largeset : tlargeset;
  88. value_smallarray : tsmallarray;
  89. value_boolean : boolean;
  90. value_char : char;
  91. procedure fail;
  92. begin
  93. WriteLn('Failure.');
  94. halt(1);
  95. end;
  96. procedure clear_globals;
  97. begin
  98. global_u8bit := 0;
  99. global_u16bit := 0;
  100. global_s32bit := 0;
  101. global_s32real := 0.0;
  102. global_s64real := 0.0;
  103. global_ptr := nil;
  104. global_proc := nil;
  105. global_bigstring := '';
  106. global_boolean := false;
  107. global_char := #0;
  108. global_s64bit := 0;
  109. end;
  110. procedure clear_values;
  111. begin
  112. value_u8bit := 0;
  113. value_u16bit := 0;
  114. value_s32bit := 0;
  115. value_s32real := 0.0;
  116. value_s64real := 0.0;
  117. value_proc := nil;
  118. value_ptr := nil;
  119. fillchar(value_smallrec, sizeof(value_smallrec), #0);
  120. fillchar(value_largerec, sizeof(value_largerec), #0);
  121. value_smallset := [];
  122. value_smallstring := '';
  123. value_bigstring := '';
  124. value_largeset := [];
  125. fillchar(value_smallarray, sizeof(value_smallarray), #0);
  126. value_boolean := false;
  127. value_char:=#0;
  128. value_ansistring := '';
  129. value_s64bit := 0;
  130. end;
  131. function getu8: byte;
  132. begin
  133. getu8 := RESULT_U8BIT;
  134. end;
  135. type
  136. { object without vmt }
  137. pnovmtobject = ^tnovmtobject;
  138. tnovmtobject = object
  139. public
  140. object_bigstring : shortstring;
  141. object_u16bit : word;
  142. { no parameter testing }
  143. procedure method_public_none;
  144. procedure method_public_static_none; static;
  145. procedure method_call_private_none;
  146. procedure method_call_private_static_none; static;
  147. { simple value parameter testing }
  148. procedure method_public_u8(x : byte);
  149. procedure method_public_static_u8(x: byte); static;
  150. procedure method_call_private_u8(x: byte);
  151. procedure method_call_private_static_u8(x: byte); static;
  152. function func_array_mixed_nested(b: byte): tsmallarray;
  153. private
  154. procedure method_private_none;
  155. procedure method_private_static_none; static;
  156. function func_getu16bit : word;
  157. { simple value parameter testing }
  158. procedure method_private_u8(x: byte);
  159. procedure method_private_static_u8(x: byte); static;
  160. end;
  161. { object with vmt }
  162. pvmtobject = ^tvmtobject;
  163. tvmtobject = object
  164. public
  165. object_u8bit : byte;
  166. object_u16bit : word;
  167. object_bigstring : shortstring;
  168. object_s32bit : longint;
  169. object_s64bit : int64;
  170. constructor constructor_params_mixed(u8 :byte; u16: word;
  171. bigstring: shortstring; s32: longint; s64: int64);
  172. constructor constructor_init;
  173. destructor destructor_params_done;
  174. procedure method_normal_params_mixed(u8 :byte; u16: word;
  175. bigstring: shortstring; s32: longint; s64: int64);
  176. procedure method_virtual_params_mixed(u8 :byte; u16: word;
  177. bigstring: shortstring; s32: longint; s64: int64);virtual;
  178. procedure method_virtual_overriden_params_mixed(u8 :byte; u16: word;
  179. bigstring: shortstring; s32: longint; s64: int64);virtual;
  180. procedure method_static_params_mixed(u8 :byte; u16: word;
  181. bigstring: shortstring; s32: longint; s64: int64);static;
  182. procedure method_normal_call_inherited_params_mixed(
  183. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  184. { virtual methods which call other methods }
  185. procedure method_virtual_call_static_params_mixed(
  186. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  187. procedure method_virtual_call_virtual_params_mixed(
  188. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  189. procedure method_virtual_call_overriden_params_mixed(
  190. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  191. procedure method_virtual_call_normal_params_mixed(
  192. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  193. procedure method_virtual_call_constructor_params_mixed(
  194. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  195. procedure method_virtual_call_inherited_params_mixed(
  196. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  197. end;
  198. pheritedvmtobject = ^theritedvmtobject;
  199. theritedvmtobject = object(tvmtobject)
  200. constructor constructor_params_mixed_call_virtual(u8 :byte; u16: word;
  201. bigstring: shortstring; s32: longint; s64: int64);
  202. constructor constructor_params_mixed_call_overriden(u8 :byte; u16: word;
  203. bigstring: shortstring; s32: longint; s64: int64);
  204. constructor constructor_params_mixed_call_static(u8 :byte; u16: word;
  205. bigstring: shortstring; s32: longint; s64: int64);
  206. constructor constructor_params_mixed_call_normal(u8 :byte; u16: word;
  207. bigstring: shortstring; s32: longint; s64: int64);
  208. constructor constructor_params_mixed_call_inherited(u8 :byte; u16: word;
  209. bigstring: shortstring; s32: longint; s64: int64);
  210. procedure method_virtual_overriden_params_mixed(
  211. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  212. { normal methods which call other methods }
  213. procedure method_normal_call_static_params_mixed(
  214. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  215. procedure method_normal_call_virtual_params_mixed(
  216. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  217. procedure method_normal_call_overriden_params_mixed(
  218. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  219. procedure method_normal_call_normal_params_mixed(
  220. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  221. procedure method_normal_call_constructor_params_mixed(
  222. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  223. procedure method_normal_call_inherited_params_mixed(
  224. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  225. { virtual methods which call other methods }
  226. procedure method_virtual_call_inherited_params_mixed(
  227. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);virtual;
  228. end;
  229. pfailvmtobject = ^tfailvmtobject;
  230. tfailvmtobject = object(tvmtobject)
  231. public
  232. constructor constructor_public_none;
  233. end;
  234. {**************************************************************************}
  235. { NO VMT OBJECT }
  236. {**************************************************************************}
  237. {****************** NO PARAMETERS ******************}
  238. procedure tnovmtobject.method_public_none;
  239. begin
  240. global_u8bit := RESULT_U8BIT;
  241. end;
  242. procedure tnovmtobject.method_public_static_none;
  243. begin
  244. global_u8bit := RESULT_U8BIT;
  245. end;
  246. procedure tnovmtobject.method_call_private_none;
  247. begin
  248. method_private_none;
  249. method_private_static_none;
  250. end;
  251. procedure tnovmtobject.method_call_private_static_none;
  252. begin
  253. method_private_static_none;
  254. end;
  255. procedure tnovmtobject.method_private_none;
  256. begin
  257. Inc(global_u16bit, RESULT_U8BIT);
  258. end;
  259. procedure tnovmtobject.method_private_static_none;
  260. begin
  261. Inc(global_u16bit, RESULT_U8BIT);
  262. end;
  263. {******************** PARAMETERS ******************}
  264. procedure tnovmtobject.method_public_u8(x : byte);
  265. begin
  266. global_u8bit := x;
  267. end;
  268. procedure tnovmtobject.method_public_static_u8(x: byte);
  269. begin
  270. global_u8bit := x;
  271. end;
  272. procedure tnovmtobject.method_call_private_u8(x: byte);
  273. begin
  274. method_private_static_u8(x);
  275. method_private_u8(x);
  276. end;
  277. procedure tnovmtobject. method_call_private_static_u8(x: byte);
  278. begin
  279. method_private_static_u8(x);
  280. end;
  281. procedure tnovmtobject.method_private_u8(x: byte);
  282. begin
  283. Inc(global_u16bit,x);
  284. end;
  285. procedure tnovmtobject.method_private_static_u8(x: byte);
  286. begin
  287. Inc(global_u16bit,x);
  288. end;
  289. function tnovmtobject.func_getu16bit : word;
  290. begin
  291. func_getu16bit := object_u16bit;
  292. end;
  293. {
  294. complex testing, nested field access, with parameters and
  295. comple return value.
  296. On exit : global_u8bit := x;
  297. global_u16bit := object_u16bit (from func_getu16bit);
  298. global_s32bit := RESULT_S32BIT
  299. global_bigstring := object_bigstring
  300. global_s64bit := x;
  301. }
  302. function tnovmtobject.func_array_mixed_nested(b: byte): tsmallarray;
  303. procedure nested_one_proc(l: longint);
  304. begin
  305. global_u16bit := func_getu16bit;
  306. global_s32bit := l;
  307. end;
  308. procedure nested_two_proc(l : longint);
  309. begin
  310. global_s64bit := l;
  311. end;
  312. function nested_one_func(level1_b : byte; s: shortstring): byte;
  313. var
  314. s1 : shortstring;
  315. function nested_two_func(level2_b : byte; s :shortstring): byte;
  316. begin
  317. nested_two_func:=level2_b;
  318. global_bigstring := s;
  319. nested_one_proc(RESULT_S32BIT);
  320. end;
  321. begin
  322. s1:=s;
  323. nested_one_func := nested_two_func(level1_b,s1);
  324. nested_two_proc(level1_b);
  325. end;
  326. var
  327. local_b: byte;
  328. smallarray: tsmallarray;
  329. begin
  330. fillchar(smallarray, sizeof(smallarray), #0);
  331. smallarray[1] := RESULT_U8BIT;
  332. smallarray[SMALL_INDEX] := RESULT_U8BIT;
  333. func_array_mixed_nested := smallarray;
  334. local_b:=b;
  335. global_u8bit := nested_one_func(local_b, object_bigstring);
  336. end;
  337. {**************************************************************************}
  338. { FAILED OBJECT }
  339. {**************************************************************************}
  340. constructor tfailvmtobject.constructor_public_none;
  341. begin
  342. { this calls the constructor fail special keyword }
  343. fail;
  344. end;
  345. {**************************************************************************}
  346. { VMT OBJECT }
  347. {**************************************************************************}
  348. constructor tvmtobject.constructor_params_mixed(u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  349. begin
  350. object_u8bit := u8;
  351. object_u16bit := u16;
  352. object_bigstring := bigstring;
  353. object_s32bit := s32;
  354. object_s64bit := s64;
  355. end;
  356. constructor tvmtobject.constructor_init;
  357. begin
  358. object_u8bit := 0;
  359. object_u16bit := 0;
  360. object_bigstring := '';
  361. object_s32bit := 0;
  362. object_s64bit := 0;
  363. end;
  364. destructor tvmtobject.destructor_params_done;
  365. begin
  366. object_u8bit := 0;
  367. object_u16bit := 0;
  368. object_bigstring := '';
  369. object_s32bit := 0;
  370. object_s64bit := 0;
  371. end;
  372. procedure tvmtobject.method_normal_params_mixed(
  373. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  374. begin
  375. object_u8bit := u8;
  376. object_u16bit := u16;
  377. object_bigstring := bigstring;
  378. object_s32bit := s32;
  379. object_s64bit := s64;
  380. end;
  381. procedure tvmtobject.method_virtual_params_mixed(
  382. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  383. begin
  384. object_u8bit := u8;
  385. object_u16bit := u16;
  386. object_bigstring := bigstring;
  387. object_s32bit := s32;
  388. object_s64bit := s64;
  389. end;
  390. { this one should be overriden }
  391. procedure tvmtobject.method_virtual_overriden_params_mixed(
  392. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  393. begin
  394. RunError(211);
  395. end;
  396. { can't access field of instances in static methods }
  397. procedure tvmtobject.method_static_params_mixed(
  398. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  399. begin
  400. global_u8bit := u8;
  401. global_u16bit := u16;
  402. global_bigstring := bigstring;
  403. global_s32bit := s32;
  404. global_s64bit := s64;
  405. end;
  406. procedure tvmtobject.method_normal_call_inherited_params_mixed(
  407. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  408. begin
  409. object_u8bit := u8;
  410. object_u16bit := u16;
  411. object_bigstring := bigstring;
  412. object_s32bit := s32;
  413. object_s64bit := s64;
  414. end;
  415. procedure tvmtobject.method_virtual_call_static_params_mixed(
  416. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  417. begin
  418. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  419. end;
  420. procedure tvmtobject.method_virtual_call_virtual_params_mixed(
  421. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  422. begin
  423. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  424. end;
  425. procedure tvmtobject.method_virtual_call_overriden_params_mixed(
  426. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  427. begin
  428. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  429. end;
  430. procedure tvmtobject.method_virtual_call_normal_params_mixed(
  431. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  432. begin
  433. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  434. end;
  435. procedure tvmtobject.method_virtual_call_constructor_params_mixed(
  436. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  437. begin
  438. constructor_params_mixed(u8, u16, bigstring, s32, s64);
  439. end;
  440. procedure tvmtobject.method_virtual_call_inherited_params_mixed(
  441. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  442. begin
  443. object_u8bit := u8;
  444. object_u16bit := u16;
  445. object_bigstring := bigstring;
  446. object_s32bit := s32;
  447. object_s64bit := s64;
  448. end;
  449. {**************************************************************************}
  450. { INHERITED VMT OBJECT }
  451. {**************************************************************************}
  452. constructor theritedvmtobject.constructor_params_mixed_call_virtual(
  453. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  454. begin
  455. object_u8bit := 0;
  456. object_u16bit := 0;
  457. object_bigstring := '';
  458. object_s32bit := 0;
  459. object_s64bit := 0;
  460. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  461. end;
  462. constructor theritedvmtobject.constructor_params_mixed_call_overriden(
  463. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  464. begin
  465. object_u8bit := 0;
  466. object_u16bit := 0;
  467. object_bigstring := '';
  468. object_s32bit := 0;
  469. object_s64bit := 0;
  470. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  471. end;
  472. constructor theritedvmtobject.constructor_params_mixed_call_static(
  473. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  474. begin
  475. object_u8bit := 0;
  476. object_u16bit := 0;
  477. object_bigstring := '';
  478. object_s32bit := 0;
  479. object_s64bit := 0;
  480. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  481. end;
  482. constructor theritedvmtobject.constructor_params_mixed_call_normal(
  483. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  484. begin
  485. object_u8bit := 0;
  486. object_u16bit := 0;
  487. object_bigstring := '';
  488. object_s32bit := 0;
  489. object_s64bit := 0;
  490. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  491. end;
  492. constructor theritedvmtobject.constructor_params_mixed_call_inherited
  493. (u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  494. begin
  495. object_u8bit := 0;
  496. object_u16bit := 0;
  497. object_bigstring := '';
  498. object_s32bit := 0;
  499. object_s64bit := 0;
  500. inherited constructor_params_mixed(u8, u16, bigstring, s32, s64);
  501. end;
  502. { this one should be overriden }
  503. procedure theritedvmtobject.method_virtual_overriden_params_mixed(
  504. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  505. begin
  506. object_u8bit := u8;
  507. object_u16bit := u16;
  508. object_bigstring := bigstring;
  509. object_s32bit := s32;
  510. object_s64bit := s64;
  511. end;
  512. procedure theritedvmtobject.method_normal_call_static_params_mixed(
  513. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  514. begin
  515. method_static_params_mixed(u8, u16, bigstring, s32, s64);
  516. end;
  517. procedure theritedvmtobject.method_normal_call_virtual_params_mixed(
  518. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  519. begin
  520. method_virtual_params_mixed(u8, u16, bigstring, s32, s64);
  521. end;
  522. procedure theritedvmtobject.method_normal_call_overriden_params_mixed(
  523. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  524. begin
  525. method_virtual_overriden_params_mixed(u8, u16, bigstring, s32, s64);
  526. end;
  527. procedure theritedvmtobject.method_normal_call_normal_params_mixed(
  528. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  529. begin
  530. method_normal_params_mixed(u8, u16, bigstring, s32, s64);
  531. end;
  532. procedure theritedvmtobject.method_normal_call_constructor_params_mixed(
  533. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  534. begin
  535. constructor_params_mixed(u8, u16, bigstring, s32, s64);
  536. end;
  537. procedure theritedvmtobject.method_normal_call_inherited_params_mixed(
  538. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  539. begin
  540. Inherited method_normal_call_inherited_params_mixed(u8, u16, bigstring,
  541. s32, s64);
  542. end;
  543. procedure theritedvmtobject.method_virtual_call_inherited_params_mixed(
  544. u8 :byte; u16: word; bigstring: shortstring; s32: longint; s64: int64);
  545. begin
  546. Inherited method_virtual_call_inherited_params_mixed(u8, u16, bigstring,
  547. s32, s64);
  548. end;
  549. procedure testnovmtobject;
  550. var
  551. novmtobject : tnovmtobject;
  552. failed : boolean;
  553. begin
  554. {******************** STATIC / METHOD SIMPLE CALL **********************}
  555. Write('No parameter / method call testing...');
  556. failed := false;
  557. clear_globals;
  558. clear_values;
  559. tnovmtobject.method_public_static_none;
  560. if global_u8bit <> RESULT_U8BIT then
  561. failed := true;
  562. clear_globals;
  563. clear_values;
  564. novmtobject.method_public_static_none;
  565. if global_u8bit <> RESULT_U8BIT then
  566. failed := true;
  567. clear_globals;
  568. clear_values;
  569. tnovmtobject.method_call_private_static_none;
  570. if global_u16bit <> RESULT_U8BIT then
  571. failed := true;
  572. clear_globals;
  573. clear_values;
  574. novmtobject.method_call_private_static_none;
  575. if global_u16bit <> RESULT_U8BIT then
  576. failed := true;
  577. clear_globals;
  578. clear_values;
  579. novmtobject.method_public_none;
  580. if global_u8bit <> RESULT_U8BIT then
  581. failed := true;
  582. clear_globals;
  583. clear_values;
  584. novmtobject.method_call_private_none;
  585. if global_u16bit <> (RESULT_U16BIT) then
  586. failed := true;
  587. if failed then
  588. fail
  589. else
  590. WriteLn('Passed!');
  591. Write('Simple parameter (LOC_CONSTANT) / method call testing...');
  592. failed := false;
  593. clear_globals;
  594. clear_values;
  595. { parameter is LOC_CONSTANT }
  596. novmtobject.method_public_u8(RESULT_U8BIT);
  597. if global_u8bit <> RESULT_U8BIT then
  598. failed := true;
  599. clear_globals;
  600. clear_values;
  601. tnovmtobject.method_public_static_u8(RESULT_U8BIT);
  602. if global_u8bit <> RESULT_U8BIT then
  603. failed := true;
  604. clear_globals;
  605. clear_values;
  606. novmtobject.method_public_static_u8(RESULT_U8BIT);
  607. if global_u8bit <> RESULT_U8BIT then
  608. failed := true;
  609. clear_globals;
  610. clear_values;
  611. novmtobject.method_call_private_u8(RESULT_U8BIT);
  612. if global_u16bit <> (RESULT_U16BIT) then
  613. failed := true;
  614. clear_globals;
  615. clear_values;
  616. novmtobject.method_call_private_static_u8(RESULT_U8BIT);
  617. if global_u16bit <> (RESULT_U8BIT) then
  618. failed := true;
  619. if failed then
  620. fail
  621. else
  622. WriteLn('Passed!');
  623. Write('Simple parameter (LOC_REFERENCE) / method call testing...');
  624. failed := false;
  625. clear_globals;
  626. clear_values;
  627. value_u8bit := RESULT_U8BIT;
  628. novmtobject.method_public_u8(value_u8bit);
  629. if global_u8bit <> RESULT_U8BIT then
  630. failed := true;
  631. clear_globals;
  632. clear_values;
  633. value_u8bit := RESULT_U8BIT;
  634. tnovmtobject.method_public_static_u8(value_u8bit);
  635. if global_u8bit <> RESULT_U8BIT then
  636. failed := true;
  637. clear_globals;
  638. clear_values;
  639. value_u8bit := RESULT_U8BIT;
  640. novmtobject.method_public_static_u8(value_u8bit);
  641. if global_u8bit <> RESULT_U8BIT then
  642. failed := true;
  643. clear_globals;
  644. clear_values;
  645. value_u8bit := RESULT_U8BIT;
  646. novmtobject.method_call_private_u8(value_u8bit);
  647. if global_u16bit <> (RESULT_U16BIT) then
  648. failed := true;
  649. clear_globals;
  650. clear_values;
  651. value_u8bit := RESULT_U8BIT;
  652. novmtobject.method_call_private_static_u8(value_u8bit);
  653. if global_u16bit <> (RESULT_U8BIT) then
  654. failed := true;
  655. if failed then
  656. fail
  657. else
  658. WriteLn('Passed!');
  659. Write('Simple parameter (LOC_REGISTER) / method call testing...');
  660. failed := false;
  661. clear_globals;
  662. clear_values;
  663. novmtobject.method_public_u8(getu8);
  664. if global_u8bit <> RESULT_U8BIT then
  665. failed := true;
  666. clear_globals;
  667. clear_values;
  668. tnovmtobject.method_public_static_u8(getu8);
  669. if global_u8bit <> RESULT_U8BIT then
  670. failed := true;
  671. clear_globals;
  672. clear_values;
  673. novmtobject.method_public_static_u8(getu8);
  674. if global_u8bit <> RESULT_U8BIT then
  675. failed := true;
  676. clear_globals;
  677. clear_values;
  678. novmtobject.method_call_private_u8(getu8);
  679. if global_u16bit <> (RESULT_U16BIT) then
  680. failed := true;
  681. clear_globals;
  682. clear_values;
  683. novmtobject.method_call_private_static_u8(getu8);
  684. if global_u16bit <> (RESULT_U8BIT) then
  685. failed := true;
  686. if failed then
  687. fail
  688. else
  689. WriteLn('Passed!');
  690. Write('Simple parameter / complex return / nested method access testing...');
  691. clear_globals;
  692. clear_values;
  693. failed := false;
  694. novmtobject.object_bigstring := RESULT_BIGSTRING;
  695. novmtobject.object_u16bit := RESULT_U16BIT;
  696. value_smallarray := novmtobject.func_array_mixed_nested(RESULT_U8BIT);
  697. if (value_smallarray[1] <> RESULT_U8BIT) or (value_smallarray[SMALL_INDEX] <> RESULT_U8BIT) then
  698. failed := true;
  699. if global_u8bit <> RESULT_U8BIT then
  700. failed := true;
  701. if global_bigstring <> RESULT_BIGSTRING then
  702. failed := true;
  703. if global_u16bit <> RESULT_U16BIT then
  704. failed := true;
  705. if global_s32bit <> RESULT_S32BIT then
  706. failed := true;
  707. if global_s64bit <> RESULT_U8BIT then
  708. failed := true;
  709. if failed then
  710. fail
  711. else
  712. WriteLn('Passed!');
  713. end;
  714. procedure testfailedobject;
  715. var
  716. failedobject : tfailvmtobject;
  717. begin
  718. Write('Testing constructor return value...');
  719. if failedobject.constructor_public_none then
  720. fail
  721. else
  722. Writeln('Passed!');
  723. end;
  724. procedure testvmtobject;
  725. var
  726. vmtobject : tvmtobject;
  727. failed : boolean;
  728. begin
  729. clear_globals;
  730. clear_values;
  731. failed := false;
  732. Write('Testing mixed parameter (LOC_CONSTANT) constructor call...');
  733. vmtobject.constructor_params_mixed(RESULT_U8BIT, RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  734. if vmtobject.object_u8bit <> RESULT_U8BIT then
  735. failed := true;
  736. if vmtobject.object_u16bit <> RESULT_U16BIT then
  737. failed := true;
  738. if vmtobject.object_s32bit <> RESULT_S32BIT then
  739. failed := true;
  740. if vmtobject.object_s64bit <> RESULT_S64BIT then
  741. failed := true;
  742. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  743. failed := true;
  744. vmtobject.destructor_params_done;
  745. if failed then
  746. fail
  747. else
  748. Writeln('Passed!');
  749. clear_globals;
  750. clear_values;
  751. failed := false;
  752. Write('Testing mixed parameter (LOC_REFERENCE) constructor call...');
  753. value_u8bit := RESULT_U8BIT;
  754. value_u16bit := RESULT_U16BIT;
  755. value_bigstring := RESULT_BIGSTRING;
  756. value_s32bit := RESULT_S32BIT;
  757. value_s64bit := RESULT_S64BIT;
  758. vmtobject.constructor_params_mixed(value_u8bit, value_u16bit, value_bigstring,
  759. value_s32bit, value_s64bit);
  760. if vmtobject.object_u8bit <> RESULT_U8BIT then
  761. failed := true;
  762. if vmtobject.object_u16bit <> RESULT_U16BIT then
  763. failed := true;
  764. if vmtobject.object_s32bit <> RESULT_S32BIT then
  765. failed := true;
  766. if vmtobject.object_s64bit <> RESULT_S64BIT then
  767. failed := true;
  768. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  769. failed := true;
  770. vmtobject.destructor_params_done;
  771. if failed then
  772. fail
  773. else
  774. Writeln('Passed!');
  775. end;
  776. procedure testheritedvmtobject;
  777. var
  778. vmtobject : theritedvmtobject;
  779. failed : boolean;
  780. begin
  781. {********************** CONSTRUCTOR TESTING ************************}
  782. {********************** DESTRUCTOR TESTING ************************}
  783. clear_globals;
  784. clear_values;
  785. failed := false;
  786. Write('Testing mixed parameter (LOC_CONSTANT) inherited constructor call...');
  787. vmtobject.constructor_params_mixed_call_inherited(RESULT_U8BIT, RESULT_U16BIT, RESULT_BIGSTRING,
  788. RESULT_S32BIT, RESULT_S64BIT);
  789. if vmtobject.object_u8bit <> RESULT_U8BIT then
  790. failed := true;
  791. if vmtobject.object_u16bit <> RESULT_U16BIT then
  792. failed := true;
  793. if vmtobject.object_s32bit <> RESULT_S32BIT then
  794. failed := true;
  795. if vmtobject.object_s64bit <> RESULT_S64BIT then
  796. failed := true;
  797. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  798. failed := true;
  799. vmtobject.destructor_params_done;
  800. if failed then
  801. fail
  802. else
  803. Writeln('Passed!');
  804. clear_globals;
  805. clear_values;
  806. failed := false;
  807. Write('Testing mixed parameter (LOC_REFERENCE) inherited constructor call...');
  808. value_u8bit := RESULT_U8BIT;
  809. value_u16bit := RESULT_U16BIT;
  810. value_bigstring := RESULT_BIGSTRING;
  811. value_s32bit := RESULT_S32BIT;
  812. value_s64bit := RESULT_S64BIT;
  813. vmtobject.constructor_params_mixed_call_inherited(value_u8bit,
  814. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  815. if vmtobject.object_u8bit <> RESULT_U8BIT then
  816. failed := true;
  817. if vmtobject.object_u16bit <> RESULT_U16BIT then
  818. failed := true;
  819. if vmtobject.object_s32bit <> RESULT_S32BIT then
  820. failed := true;
  821. if vmtobject.object_s64bit <> RESULT_S64BIT then
  822. failed := true;
  823. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  824. failed := true;
  825. vmtobject.destructor_params_done;
  826. if failed then
  827. fail
  828. else
  829. Writeln('Passed!');
  830. clear_globals;
  831. clear_values;
  832. failed := false;
  833. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  834. vmtobject.constructor_params_mixed_call_virtual(RESULT_U8BIT,
  835. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  836. if vmtobject.object_u8bit <> RESULT_U8BIT then
  837. failed := true;
  838. if vmtobject.object_u16bit <> RESULT_U16BIT then
  839. failed := true;
  840. if vmtobject.object_s32bit <> RESULT_S32BIT then
  841. failed := true;
  842. if vmtobject.object_s64bit <> RESULT_S64BIT then
  843. failed := true;
  844. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  845. failed := true;
  846. vmtobject.destructor_params_done;
  847. if failed then
  848. fail
  849. else
  850. Writeln('Passed!');
  851. clear_globals;
  852. clear_values;
  853. failed := false;
  854. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  855. value_u8bit := RESULT_U8BIT;
  856. value_u16bit := RESULT_U16BIT;
  857. value_bigstring := RESULT_BIGSTRING;
  858. value_s32bit := RESULT_S32BIT;
  859. value_s64bit := RESULT_S64BIT;
  860. vmtobject.constructor_params_mixed_call_virtual(value_u8bit,
  861. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  862. if vmtobject.object_u8bit <> RESULT_U8BIT then
  863. failed := true;
  864. if vmtobject.object_u16bit <> RESULT_U16BIT then
  865. failed := true;
  866. if vmtobject.object_s32bit <> RESULT_S32BIT then
  867. failed := true;
  868. if vmtobject.object_s64bit <> RESULT_S64BIT then
  869. failed := true;
  870. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  871. failed := true;
  872. vmtobject.destructor_params_done;
  873. if failed then
  874. fail
  875. else
  876. Writeln('Passed!');
  877. clear_globals;
  878. clear_values;
  879. failed := false;
  880. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  881. vmtobject.constructor_params_mixed_call_overriden(RESULT_U8BIT,
  882. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  883. if vmtobject.object_u8bit <> RESULT_U8BIT then
  884. failed := true;
  885. if vmtobject.object_u16bit <> RESULT_U16BIT then
  886. failed := true;
  887. if vmtobject.object_s32bit <> RESULT_S32BIT then
  888. failed := true;
  889. if vmtobject.object_s64bit <> RESULT_S64BIT then
  890. failed := true;
  891. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  892. failed := true;
  893. vmtobject.destructor_params_done;
  894. if failed then
  895. fail
  896. else
  897. Writeln('Passed!');
  898. clear_globals;
  899. clear_values;
  900. failed := false;
  901. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  902. value_u8bit := RESULT_U8BIT;
  903. value_u16bit := RESULT_U16BIT;
  904. value_bigstring := RESULT_BIGSTRING;
  905. value_s32bit := RESULT_S32BIT;
  906. value_s64bit := RESULT_S64BIT;
  907. vmtobject.constructor_params_mixed_call_overriden(value_u8bit,
  908. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  909. if vmtobject.object_u8bit <> RESULT_U8BIT then
  910. failed := true;
  911. if vmtobject.object_u16bit <> RESULT_U16BIT then
  912. failed := true;
  913. if vmtobject.object_s32bit <> RESULT_S32BIT then
  914. failed := true;
  915. if vmtobject.object_s64bit <> RESULT_S64BIT then
  916. failed := true;
  917. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  918. failed := true;
  919. vmtobject.destructor_params_done;
  920. if failed then
  921. fail
  922. else
  923. Writeln('Passed!');
  924. clear_globals;
  925. clear_values;
  926. failed := false;
  927. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/method call...');
  928. vmtobject.constructor_params_mixed_call_normal(RESULT_U8BIT,
  929. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  930. if vmtobject.object_u8bit <> RESULT_U8BIT then
  931. failed := true;
  932. if vmtobject.object_u16bit <> RESULT_U16BIT then
  933. failed := true;
  934. if vmtobject.object_s32bit <> RESULT_S32BIT then
  935. failed := true;
  936. if vmtobject.object_s64bit <> RESULT_S64BIT then
  937. failed := true;
  938. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  939. failed := true;
  940. vmtobject.destructor_params_done;
  941. if failed then
  942. fail
  943. else
  944. Writeln('Passed!');
  945. clear_globals;
  946. clear_values;
  947. failed := false;
  948. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/method call...');
  949. value_u8bit := RESULT_U8BIT;
  950. value_u16bit := RESULT_U16BIT;
  951. value_bigstring := RESULT_BIGSTRING;
  952. value_s32bit := RESULT_S32BIT;
  953. value_s64bit := RESULT_S64BIT;
  954. vmtobject.constructor_params_mixed_call_normal(value_u8bit,
  955. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  956. if vmtobject.object_u8bit <> RESULT_U8BIT then
  957. failed := true;
  958. if vmtobject.object_u16bit <> RESULT_U16BIT then
  959. failed := true;
  960. if vmtobject.object_s32bit <> RESULT_S32BIT then
  961. failed := true;
  962. if vmtobject.object_s64bit <> RESULT_S64BIT then
  963. failed := true;
  964. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  965. failed := true;
  966. vmtobject.destructor_params_done;
  967. if failed then
  968. fail
  969. else
  970. Writeln('Passed!');
  971. clear_globals;
  972. clear_values;
  973. failed := false;
  974. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/static call...');
  975. vmtobject.constructor_params_mixed_call_static(RESULT_U8BIT,
  976. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  977. if global_u8bit <> RESULT_U8BIT then
  978. failed := true;
  979. if global_u16bit <> RESULT_U16BIT then
  980. failed := true;
  981. if global_s32bit <> RESULT_S32BIT then
  982. failed := true;
  983. if global_s64bit <> RESULT_S64BIT then
  984. failed := true;
  985. if global_bigstring <> RESULT_BIGSTRING then
  986. failed := true;
  987. vmtobject.destructor_params_done;
  988. if failed then
  989. fail
  990. else
  991. Writeln('Passed!');
  992. clear_globals;
  993. clear_values;
  994. failed := false;
  995. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/static call...');
  996. value_u8bit := RESULT_U8BIT;
  997. value_u16bit := RESULT_U16BIT;
  998. value_bigstring := RESULT_BIGSTRING;
  999. value_s32bit := RESULT_S32BIT;
  1000. value_s64bit := RESULT_S64BIT;
  1001. vmtobject.constructor_params_mixed_call_static(value_u8bit,
  1002. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1003. if global_u8bit <> RESULT_U8BIT then
  1004. failed := true;
  1005. if global_u16bit <> RESULT_U16BIT then
  1006. failed := true;
  1007. if global_s32bit <> RESULT_S32BIT then
  1008. failed := true;
  1009. if global_s64bit <> RESULT_S64BIT then
  1010. failed := true;
  1011. if global_bigstring <> RESULT_BIGSTRING then
  1012. failed := true;
  1013. vmtobject.destructor_params_done;
  1014. if failed then
  1015. fail
  1016. else
  1017. Writeln('Passed!');
  1018. {************************* METHOD TESTING **************************}
  1019. clear_globals;
  1020. clear_values;
  1021. failed := false;
  1022. vmtobject.constructor_init;
  1023. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  1024. vmtobject.method_virtual_params_mixed(RESULT_U8BIT,
  1025. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1026. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1027. failed := true;
  1028. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1029. failed := true;
  1030. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1031. failed := true;
  1032. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1033. failed := true;
  1034. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1035. failed := true;
  1036. vmtobject.destructor_params_done;
  1037. if failed then
  1038. fail
  1039. else
  1040. Writeln('Passed!');
  1041. clear_globals;
  1042. clear_values;
  1043. failed := false;
  1044. vmtobject.constructor_init;
  1045. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  1046. value_u8bit := RESULT_U8BIT;
  1047. value_u16bit := RESULT_U16BIT;
  1048. value_bigstring := RESULT_BIGSTRING;
  1049. value_s32bit := RESULT_S32BIT;
  1050. value_s64bit := RESULT_S64BIT;
  1051. vmtobject.method_virtual_params_mixed(value_u8bit,
  1052. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1053. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1054. failed := true;
  1055. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1056. failed := true;
  1057. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1058. failed := true;
  1059. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1060. failed := true;
  1061. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1062. failed := true;
  1063. vmtobject.destructor_params_done;
  1064. if failed then
  1065. fail
  1066. else
  1067. Writeln('Passed!');
  1068. clear_globals;
  1069. clear_values;
  1070. failed := false;
  1071. vmtobject.constructor_init;
  1072. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  1073. vmtobject.method_virtual_overriden_params_mixed(RESULT_U8BIT,
  1074. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1075. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1076. failed := true;
  1077. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1078. failed := true;
  1079. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1080. failed := true;
  1081. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1082. failed := true;
  1083. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1084. failed := true;
  1085. vmtobject.destructor_params_done;
  1086. if failed then
  1087. fail
  1088. else
  1089. Writeln('Passed!');
  1090. clear_globals;
  1091. clear_values;
  1092. failed := false;
  1093. vmtobject.constructor_init;
  1094. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  1095. value_u8bit := RESULT_U8BIT;
  1096. value_u16bit := RESULT_U16BIT;
  1097. value_bigstring := RESULT_BIGSTRING;
  1098. value_s32bit := RESULT_S32BIT;
  1099. value_s64bit := RESULT_S64BIT;
  1100. vmtobject.method_virtual_overriden_params_mixed(value_u8bit,
  1101. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1102. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1103. failed := true;
  1104. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1105. failed := true;
  1106. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1107. failed := true;
  1108. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1109. failed := true;
  1110. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1111. failed := true;
  1112. vmtobject.destructor_params_done;
  1113. if failed then
  1114. fail
  1115. else
  1116. Writeln('Passed!');
  1117. clear_globals;
  1118. clear_values;
  1119. failed := false;
  1120. vmtobject.constructor_init;
  1121. Write('Testing mixed parameter (LOC_CONSTANT) method call...');
  1122. vmtobject.method_normal_params_mixed(RESULT_U8BIT,
  1123. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1124. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1125. failed := true;
  1126. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1127. failed := true;
  1128. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1129. failed := true;
  1130. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1131. failed := true;
  1132. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1133. failed := true;
  1134. vmtobject.destructor_params_done;
  1135. if failed then
  1136. fail
  1137. else
  1138. Writeln('Passed!');
  1139. clear_globals;
  1140. clear_values;
  1141. failed := false;
  1142. vmtobject.constructor_init;
  1143. Write('Testing mixed parameter (LOC_REFERENCE) method call...');
  1144. value_u8bit := RESULT_U8BIT;
  1145. value_u16bit := RESULT_U16BIT;
  1146. value_bigstring := RESULT_BIGSTRING;
  1147. value_s32bit := RESULT_S32BIT;
  1148. value_s64bit := RESULT_S64BIT;
  1149. vmtobject.method_normal_params_mixed(value_u8bit,
  1150. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1151. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1152. failed := true;
  1153. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1154. failed := true;
  1155. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1156. failed := true;
  1157. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1158. failed := true;
  1159. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1160. failed := true;
  1161. vmtobject.destructor_params_done;
  1162. if failed then
  1163. fail
  1164. else
  1165. Writeln('Passed!');
  1166. clear_globals;
  1167. clear_values;
  1168. failed := false;
  1169. vmtobject.constructor_init;
  1170. Write('Testing mixed parameter (LOC_CONSTANT) static method call...');
  1171. vmtobject.method_static_params_mixed(RESULT_U8BIT,
  1172. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1173. if global_u8bit <> RESULT_U8BIT then
  1174. failed := true;
  1175. if global_u16bit <> RESULT_U16BIT then
  1176. failed := true;
  1177. if global_s32bit <> RESULT_S32BIT then
  1178. failed := true;
  1179. if global_s64bit <> RESULT_S64BIT then
  1180. failed := true;
  1181. if global_bigstring <> RESULT_BIGSTRING then
  1182. failed := true;
  1183. vmtobject.destructor_params_done;
  1184. if failed then
  1185. fail
  1186. else
  1187. Writeln('Passed!');
  1188. clear_globals;
  1189. clear_values;
  1190. failed := false;
  1191. vmtobject.constructor_init;
  1192. Write('Testing mixed parameter (LOC_REFERENCE) static method call...');
  1193. value_u8bit := RESULT_U8BIT;
  1194. value_u16bit := RESULT_U16BIT;
  1195. value_bigstring := RESULT_BIGSTRING;
  1196. value_s32bit := RESULT_S32BIT;
  1197. value_s64bit := RESULT_S64BIT;
  1198. vmtobject.method_static_params_mixed(value_u8bit,
  1199. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1200. if global_u8bit <> RESULT_U8BIT then
  1201. failed := true;
  1202. if global_u16bit <> RESULT_U16BIT then
  1203. failed := true;
  1204. if global_s32bit <> RESULT_S32BIT then
  1205. failed := true;
  1206. if global_s64bit <> RESULT_S64BIT then
  1207. failed := true;
  1208. if global_bigstring <> RESULT_BIGSTRING then
  1209. failed := true;
  1210. vmtobject.destructor_params_done;
  1211. if failed then
  1212. fail
  1213. else
  1214. Writeln('Passed!');
  1215. { ********************************************************************
  1216. This calls methods which in turn call other methods, or a constructor
  1217. or a destructor.
  1218. *********************************************************************
  1219. }
  1220. clear_globals;
  1221. clear_values;
  1222. failed := false;
  1223. { Calls the ancestor virtual method }
  1224. vmtobject.constructor_init;
  1225. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  1226. vmtobject.method_normal_call_virtual_params_mixed(RESULT_U8BIT,
  1227. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1228. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1229. failed := true;
  1230. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1231. failed := true;
  1232. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1233. failed := true;
  1234. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1235. failed := true;
  1236. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1237. failed := true;
  1238. vmtobject.destructor_params_done;
  1239. if failed then
  1240. fail
  1241. else
  1242. Writeln('Passed!');
  1243. clear_globals;
  1244. clear_values;
  1245. failed := false;
  1246. vmtobject.constructor_init;
  1247. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  1248. value_u8bit := RESULT_U8BIT;
  1249. value_u16bit := RESULT_U16BIT;
  1250. value_bigstring := RESULT_BIGSTRING;
  1251. value_s32bit := RESULT_S32BIT;
  1252. value_s64bit := RESULT_S64BIT;
  1253. vmtobject.method_normal_call_virtual_params_mixed(value_u8bit,
  1254. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1255. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1256. failed := true;
  1257. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1258. failed := true;
  1259. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1260. failed := true;
  1261. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1262. failed := true;
  1263. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1264. failed := true;
  1265. vmtobject.destructor_params_done;
  1266. if failed then
  1267. fail
  1268. else
  1269. Writeln('Passed!');
  1270. { The virtual method has been overriden by the object in this case }
  1271. vmtobject.constructor_init;
  1272. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  1273. vmtobject.method_normal_call_overriden_params_mixed(RESULT_U8BIT,
  1274. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1275. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1276. failed := true;
  1277. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1278. failed := true;
  1279. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1280. failed := true;
  1281. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1282. failed := true;
  1283. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1284. failed := true;
  1285. vmtobject.destructor_params_done;
  1286. if failed then
  1287. fail
  1288. else
  1289. Writeln('Passed!');
  1290. clear_globals;
  1291. clear_values;
  1292. failed := false;
  1293. vmtobject.constructor_init;
  1294. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  1295. value_u8bit := RESULT_U8BIT;
  1296. value_u16bit := RESULT_U16BIT;
  1297. value_bigstring := RESULT_BIGSTRING;
  1298. value_s32bit := RESULT_S32BIT;
  1299. value_s64bit := RESULT_S64BIT;
  1300. vmtobject.method_normal_call_overriden_params_mixed(value_u8bit,
  1301. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1302. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1303. failed := true;
  1304. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1305. failed := true;
  1306. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1307. failed := true;
  1308. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1309. failed := true;
  1310. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1311. failed := true;
  1312. vmtobject.destructor_params_done;
  1313. if failed then
  1314. fail
  1315. else
  1316. Writeln('Passed!');
  1317. clear_globals;
  1318. clear_values;
  1319. failed := false;
  1320. vmtobject.constructor_init;
  1321. Write('Testing mixed parameter (LOC_CONSTANT) method call w/normal call...');
  1322. vmtobject.method_normal_call_normal_params_mixed(RESULT_U8BIT,
  1323. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1324. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1325. failed := true;
  1326. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1327. failed := true;
  1328. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1329. failed := true;
  1330. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1331. failed := true;
  1332. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1333. failed := true;
  1334. vmtobject.destructor_params_done;
  1335. if failed then
  1336. fail
  1337. else
  1338. Writeln('Passed!');
  1339. clear_globals;
  1340. clear_values;
  1341. failed := false;
  1342. vmtobject.constructor_init;
  1343. Write('Testing mixed parameter (LOC_REFERENCE) method call w/normal call...');
  1344. value_u8bit := RESULT_U8BIT;
  1345. value_u16bit := RESULT_U16BIT;
  1346. value_bigstring := RESULT_BIGSTRING;
  1347. value_s32bit := RESULT_S32BIT;
  1348. value_s64bit := RESULT_S64BIT;
  1349. vmtobject.method_normal_call_normal_params_mixed(value_u8bit,
  1350. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1351. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1352. failed := true;
  1353. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1354. failed := true;
  1355. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1356. failed := true;
  1357. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1358. failed := true;
  1359. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1360. failed := true;
  1361. vmtobject.destructor_params_done;
  1362. if failed then
  1363. fail
  1364. else
  1365. Writeln('Passed!');
  1366. (* constructor call inside a normal method *)
  1367. clear_globals;
  1368. clear_values;
  1369. failed := false;
  1370. vmtobject.constructor_init;
  1371. Write('Testing mixed parameter (LOC_CONSTANT) method call w/constructor call...');
  1372. vmtobject.method_normal_call_constructor_params_mixed(RESULT_U8BIT,
  1373. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1374. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1375. failed := true;
  1376. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1377. failed := true;
  1378. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1379. failed := true;
  1380. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1381. failed := true;
  1382. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1383. failed := true;
  1384. vmtobject.destructor_params_done;
  1385. if failed then
  1386. fail
  1387. else
  1388. Writeln('Passed!');
  1389. clear_globals;
  1390. clear_values;
  1391. failed := false;
  1392. vmtobject.constructor_init;
  1393. Write('Testing mixed parameter (LOC_REFERENCE) method call w/constructor call...');
  1394. value_u8bit := RESULT_U8BIT;
  1395. value_u16bit := RESULT_U16BIT;
  1396. value_bigstring := RESULT_BIGSTRING;
  1397. value_s32bit := RESULT_S32BIT;
  1398. value_s64bit := RESULT_S64BIT;
  1399. vmtobject.method_normal_call_constructor_params_mixed(value_u8bit,
  1400. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1401. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1402. failed := true;
  1403. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1404. failed := true;
  1405. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1406. failed := true;
  1407. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1408. failed := true;
  1409. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1410. failed := true;
  1411. vmtobject.destructor_params_done;
  1412. if failed then
  1413. fail
  1414. else
  1415. Writeln('Passed!');
  1416. { static method call }
  1417. clear_globals;
  1418. clear_values;
  1419. failed := false;
  1420. vmtobject.constructor_init;
  1421. Write('Testing mixed parameter (LOC_CONSTANT) method call w/static call...');
  1422. vmtobject.method_normal_call_static_params_mixed(RESULT_U8BIT,
  1423. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1424. if global_u8bit <> RESULT_U8BIT then
  1425. failed := true;
  1426. if global_u16bit <> RESULT_U16BIT then
  1427. failed := true;
  1428. if global_s32bit <> RESULT_S32BIT then
  1429. failed := true;
  1430. if global_s64bit <> RESULT_S64BIT then
  1431. failed := true;
  1432. if global_bigstring <> RESULT_BIGSTRING then
  1433. failed := true;
  1434. vmtobject.destructor_params_done;
  1435. if failed then
  1436. fail
  1437. else
  1438. Writeln('Passed!');
  1439. clear_globals;
  1440. clear_values;
  1441. failed := false;
  1442. vmtobject.constructor_init;
  1443. Write('Testing mixed parameter (LOC_REFERENCE) method call w/static call...');
  1444. value_u8bit := RESULT_U8BIT;
  1445. value_u16bit := RESULT_U16BIT;
  1446. value_bigstring := RESULT_BIGSTRING;
  1447. value_s32bit := RESULT_S32BIT;
  1448. value_s64bit := RESULT_S64BIT;
  1449. vmtobject.method_normal_call_static_params_mixed(value_u8bit,
  1450. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1451. if global_u8bit <> RESULT_U8BIT then
  1452. failed := true;
  1453. if global_u16bit <> RESULT_U16BIT then
  1454. failed := true;
  1455. if global_s32bit <> RESULT_S32BIT then
  1456. failed := true;
  1457. if global_s64bit <> RESULT_S64BIT then
  1458. failed := true;
  1459. if global_bigstring <> RESULT_BIGSTRING then
  1460. failed := true;
  1461. vmtobject.destructor_params_done;
  1462. if failed then
  1463. fail
  1464. else
  1465. Writeln('Passed!');
  1466. (* calls the inherited method *)
  1467. clear_globals;
  1468. clear_values;
  1469. failed := false;
  1470. { Calls the ancestor virtual method }
  1471. vmtobject.constructor_init;
  1472. Write('Testing mixed parameter (LOC_CONSTANT) method call w/inherited call...');
  1473. vmtobject.method_normal_call_inherited_params_mixed(RESULT_U8BIT,
  1474. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1475. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1476. failed := true;
  1477. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1478. failed := true;
  1479. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1480. failed := true;
  1481. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1482. failed := true;
  1483. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1484. failed := true;
  1485. vmtobject.destructor_params_done;
  1486. if failed then
  1487. fail
  1488. else
  1489. Writeln('Passed!');
  1490. clear_globals;
  1491. clear_values;
  1492. failed := false;
  1493. vmtobject.constructor_init;
  1494. Write('Testing mixed parameter (LOC_REFERENCE) method call w/inherited call...');
  1495. value_u8bit := RESULT_U8BIT;
  1496. value_u16bit := RESULT_U16BIT;
  1497. value_bigstring := RESULT_BIGSTRING;
  1498. value_s32bit := RESULT_S32BIT;
  1499. value_s64bit := RESULT_S64BIT;
  1500. vmtobject.method_normal_call_inherited_params_mixed(value_u8bit,
  1501. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1502. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1503. failed := true;
  1504. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1505. failed := true;
  1506. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1507. failed := true;
  1508. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1509. failed := true;
  1510. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1511. failed := true;
  1512. vmtobject.destructor_params_done;
  1513. if failed then
  1514. fail
  1515. else
  1516. Writeln('Passed!');
  1517. { ********************************************************************
  1518. This calls virtual methods which in turn call other methods,
  1519. or a constructor or a destructor.
  1520. *********************************************************************
  1521. }
  1522. clear_globals;
  1523. clear_values;
  1524. failed := false;
  1525. { Calls the ancestor virtual method }
  1526. vmtobject.constructor_init;
  1527. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  1528. vmtobject.method_virtual_call_virtual_params_mixed(RESULT_U8BIT,
  1529. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1530. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1531. failed := true;
  1532. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1533. failed := true;
  1534. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1535. failed := true;
  1536. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1537. failed := true;
  1538. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1539. failed := true;
  1540. vmtobject.destructor_params_done;
  1541. if failed then
  1542. fail
  1543. else
  1544. Writeln('Passed!');
  1545. clear_globals;
  1546. clear_values;
  1547. failed := false;
  1548. vmtobject.constructor_init;
  1549. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  1550. value_u8bit := RESULT_U8BIT;
  1551. value_u16bit := RESULT_U16BIT;
  1552. value_bigstring := RESULT_BIGSTRING;
  1553. value_s32bit := RESULT_S32BIT;
  1554. value_s64bit := RESULT_S64BIT;
  1555. vmtobject.method_virtual_call_virtual_params_mixed(value_u8bit,
  1556. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1557. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1558. failed := true;
  1559. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1560. failed := true;
  1561. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1562. failed := true;
  1563. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1564. failed := true;
  1565. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1566. failed := true;
  1567. vmtobject.destructor_params_done;
  1568. if failed then
  1569. fail
  1570. else
  1571. Writeln('Passed!');
  1572. { The virtual method has been overriden by the object in this case }
  1573. vmtobject.constructor_init;
  1574. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  1575. vmtobject.method_virtual_call_overriden_params_mixed(RESULT_U8BIT,
  1576. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1577. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1578. failed := true;
  1579. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1580. failed := true;
  1581. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1582. failed := true;
  1583. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1584. failed := true;
  1585. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1586. failed := true;
  1587. vmtobject.destructor_params_done;
  1588. if failed then
  1589. fail
  1590. else
  1591. Writeln('Passed!');
  1592. clear_globals;
  1593. clear_values;
  1594. failed := false;
  1595. vmtobject.constructor_init;
  1596. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  1597. value_u8bit := RESULT_U8BIT;
  1598. value_u16bit := RESULT_U16BIT;
  1599. value_bigstring := RESULT_BIGSTRING;
  1600. value_s32bit := RESULT_S32BIT;
  1601. value_s64bit := RESULT_S64BIT;
  1602. vmtobject.method_virtual_call_overriden_params_mixed(value_u8bit,
  1603. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1604. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1605. failed := true;
  1606. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1607. failed := true;
  1608. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1609. failed := true;
  1610. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1611. failed := true;
  1612. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1613. failed := true;
  1614. vmtobject.destructor_params_done;
  1615. if failed then
  1616. fail
  1617. else
  1618. Writeln('Passed!');
  1619. clear_globals;
  1620. clear_values;
  1621. failed := false;
  1622. vmtobject.constructor_init;
  1623. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/normal call...');
  1624. vmtobject.method_virtual_call_normal_params_mixed(RESULT_U8BIT,
  1625. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1626. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1627. failed := true;
  1628. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1629. failed := true;
  1630. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1631. failed := true;
  1632. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1633. failed := true;
  1634. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1635. failed := true;
  1636. vmtobject.destructor_params_done;
  1637. if failed then
  1638. fail
  1639. else
  1640. Writeln('Passed!');
  1641. clear_globals;
  1642. clear_values;
  1643. failed := false;
  1644. vmtobject.constructor_init;
  1645. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/normal call...');
  1646. value_u8bit := RESULT_U8BIT;
  1647. value_u16bit := RESULT_U16BIT;
  1648. value_bigstring := RESULT_BIGSTRING;
  1649. value_s32bit := RESULT_S32BIT;
  1650. value_s64bit := RESULT_S64BIT;
  1651. vmtobject.method_virtual_call_normal_params_mixed(value_u8bit,
  1652. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1653. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1654. failed := true;
  1655. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1656. failed := true;
  1657. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1658. failed := true;
  1659. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1660. failed := true;
  1661. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1662. failed := true;
  1663. vmtobject.destructor_params_done;
  1664. if failed then
  1665. fail
  1666. else
  1667. Writeln('Passed!');
  1668. (* constructor call inside a normal method *)
  1669. clear_globals;
  1670. clear_values;
  1671. failed := false;
  1672. vmtobject.constructor_init;
  1673. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/constructor call...');
  1674. vmtobject.method_virtual_call_constructor_params_mixed(RESULT_U8BIT,
  1675. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1676. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1677. failed := true;
  1678. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1679. failed := true;
  1680. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1681. failed := true;
  1682. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1683. failed := true;
  1684. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1685. failed := true;
  1686. vmtobject.destructor_params_done;
  1687. if failed then
  1688. fail
  1689. else
  1690. Writeln('Passed!');
  1691. clear_globals;
  1692. clear_values;
  1693. failed := false;
  1694. vmtobject.constructor_init;
  1695. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/constructor call...');
  1696. value_u8bit := RESULT_U8BIT;
  1697. value_u16bit := RESULT_U16BIT;
  1698. value_bigstring := RESULT_BIGSTRING;
  1699. value_s32bit := RESULT_S32BIT;
  1700. value_s64bit := RESULT_S64BIT;
  1701. vmtobject.method_virtual_call_constructor_params_mixed(value_u8bit,
  1702. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1703. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1704. failed := true;
  1705. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1706. failed := true;
  1707. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1708. failed := true;
  1709. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1710. failed := true;
  1711. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1712. failed := true;
  1713. vmtobject.destructor_params_done;
  1714. if failed then
  1715. fail
  1716. else
  1717. Writeln('Passed!');
  1718. { static virtual call }
  1719. clear_globals;
  1720. clear_values;
  1721. failed := false;
  1722. vmtobject.constructor_init;
  1723. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/static call...');
  1724. vmtobject.method_virtual_call_static_params_mixed(RESULT_U8BIT,
  1725. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1726. if global_u8bit <> RESULT_U8BIT then
  1727. failed := true;
  1728. if global_u16bit <> RESULT_U16BIT then
  1729. failed := true;
  1730. if global_s32bit <> RESULT_S32BIT then
  1731. failed := true;
  1732. if global_s64bit <> RESULT_S64BIT then
  1733. failed := true;
  1734. if global_bigstring <> RESULT_BIGSTRING then
  1735. failed := true;
  1736. vmtobject.destructor_params_done;
  1737. if failed then
  1738. fail
  1739. else
  1740. Writeln('Passed!');
  1741. clear_globals;
  1742. clear_values;
  1743. failed := false;
  1744. vmtobject.constructor_init;
  1745. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/static call...');
  1746. value_u8bit := RESULT_U8BIT;
  1747. value_u16bit := RESULT_U16BIT;
  1748. value_bigstring := RESULT_BIGSTRING;
  1749. value_s32bit := RESULT_S32BIT;
  1750. value_s64bit := RESULT_S64BIT;
  1751. vmtobject.method_virtual_call_static_params_mixed(value_u8bit,
  1752. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1753. if global_u8bit <> RESULT_U8BIT then
  1754. failed := true;
  1755. if global_u16bit <> RESULT_U16BIT then
  1756. failed := true;
  1757. if global_s32bit <> RESULT_S32BIT then
  1758. failed := true;
  1759. if global_s64bit <> RESULT_S64BIT then
  1760. failed := true;
  1761. if global_bigstring <> RESULT_BIGSTRING then
  1762. failed := true;
  1763. vmtobject.destructor_params_done;
  1764. if failed then
  1765. fail
  1766. else
  1767. Writeln('Passed!');
  1768. (* calls the inherited method *)
  1769. clear_globals;
  1770. clear_values;
  1771. failed := false;
  1772. { Calls the ancestor virtual method }
  1773. vmtobject.constructor_init;
  1774. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/inherited call...');
  1775. vmtobject.method_virtual_call_inherited_params_mixed(RESULT_U8BIT,
  1776. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1777. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1778. failed := true;
  1779. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1780. failed := true;
  1781. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1782. failed := true;
  1783. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1784. failed := true;
  1785. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1786. failed := true;
  1787. vmtobject.destructor_params_done;
  1788. if failed then
  1789. fail
  1790. else
  1791. Writeln('Passed!');
  1792. clear_globals;
  1793. clear_values;
  1794. failed := false;
  1795. vmtobject.constructor_init;
  1796. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/inherited call...');
  1797. value_u8bit := RESULT_U8BIT;
  1798. value_u16bit := RESULT_U16BIT;
  1799. value_bigstring := RESULT_BIGSTRING;
  1800. value_s32bit := RESULT_S32BIT;
  1801. value_s64bit := RESULT_S64BIT;
  1802. vmtobject.method_virtual_call_inherited_params_mixed(value_u8bit,
  1803. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1804. if vmtobject.object_u8bit <> RESULT_U8BIT then
  1805. failed := true;
  1806. if vmtobject.object_u16bit <> RESULT_U16BIT then
  1807. failed := true;
  1808. if vmtobject.object_s32bit <> RESULT_S32BIT then
  1809. failed := true;
  1810. if vmtobject.object_s64bit <> RESULT_S64BIT then
  1811. failed := true;
  1812. if vmtobject.object_bigstring <> RESULT_BIGSTRING then
  1813. failed := true;
  1814. vmtobject.destructor_params_done;
  1815. if failed then
  1816. fail
  1817. else
  1818. Writeln('Passed!');
  1819. end;
  1820. { same as testvmtherited, except uses with statement }
  1821. procedure testwith;
  1822. var
  1823. vmtobject : theritedvmtobject;
  1824. failed : boolean;
  1825. begin
  1826. with vmtobject do
  1827. begin
  1828. {********************** CONSTRUCTOR TESTING ************************}
  1829. {********************** DESTRUCTOR TESTING ************************}
  1830. clear_globals;
  1831. clear_values;
  1832. failed := false;
  1833. Write('Testing mixed parameter (LOC_CONSTANT) inherited constructor call...');
  1834. constructor_params_mixed_call_inherited(RESULT_U8BIT, RESULT_U16BIT, RESULT_BIGSTRING,
  1835. RESULT_S32BIT, RESULT_S64BIT);
  1836. if object_u8bit <> RESULT_U8BIT then
  1837. failed := true;
  1838. if object_u16bit <> RESULT_U16BIT then
  1839. failed := true;
  1840. if object_s32bit <> RESULT_S32BIT then
  1841. failed := true;
  1842. if object_s64bit <> RESULT_S64BIT then
  1843. failed := true;
  1844. if object_bigstring <> RESULT_BIGSTRING then
  1845. failed := true;
  1846. destructor_params_done;
  1847. if failed then
  1848. fail
  1849. else
  1850. Writeln('Passed!');
  1851. clear_globals;
  1852. clear_values;
  1853. failed := false;
  1854. Write('Testing mixed parameter (LOC_REFERENCE) inherited constructor call...');
  1855. value_u8bit := RESULT_U8BIT;
  1856. value_u16bit := RESULT_U16BIT;
  1857. value_bigstring := RESULT_BIGSTRING;
  1858. value_s32bit := RESULT_S32BIT;
  1859. value_s64bit := RESULT_S64BIT;
  1860. constructor_params_mixed_call_inherited(value_u8bit,
  1861. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1862. if object_u8bit <> RESULT_U8BIT then
  1863. failed := true;
  1864. if object_u16bit <> RESULT_U16BIT then
  1865. failed := true;
  1866. if object_s32bit <> RESULT_S32BIT then
  1867. failed := true;
  1868. if object_s64bit <> RESULT_S64BIT then
  1869. failed := true;
  1870. if object_bigstring <> RESULT_BIGSTRING then
  1871. failed := true;
  1872. destructor_params_done;
  1873. if failed then
  1874. fail
  1875. else
  1876. Writeln('Passed!');
  1877. clear_globals;
  1878. clear_values;
  1879. failed := false;
  1880. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  1881. constructor_params_mixed_call_virtual(RESULT_U8BIT,
  1882. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1883. if object_u8bit <> RESULT_U8BIT then
  1884. failed := true;
  1885. if object_u16bit <> RESULT_U16BIT then
  1886. failed := true;
  1887. if object_s32bit <> RESULT_S32BIT then
  1888. failed := true;
  1889. if object_s64bit <> RESULT_S64BIT then
  1890. failed := true;
  1891. if object_bigstring <> RESULT_BIGSTRING then
  1892. failed := true;
  1893. destructor_params_done;
  1894. if failed then
  1895. fail
  1896. else
  1897. Writeln('Passed!');
  1898. clear_globals;
  1899. clear_values;
  1900. failed := false;
  1901. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  1902. value_u8bit := RESULT_U8BIT;
  1903. value_u16bit := RESULT_U16BIT;
  1904. value_bigstring := RESULT_BIGSTRING;
  1905. value_s32bit := RESULT_S32BIT;
  1906. value_s64bit := RESULT_S64BIT;
  1907. constructor_params_mixed_call_virtual(value_u8bit,
  1908. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1909. if object_u8bit <> RESULT_U8BIT then
  1910. failed := true;
  1911. if object_u16bit <> RESULT_U16BIT then
  1912. failed := true;
  1913. if object_s32bit <> RESULT_S32BIT then
  1914. failed := true;
  1915. if object_s64bit <> RESULT_S64BIT then
  1916. failed := true;
  1917. if object_bigstring <> RESULT_BIGSTRING then
  1918. failed := true;
  1919. destructor_params_done;
  1920. if failed then
  1921. fail
  1922. else
  1923. Writeln('Passed!');
  1924. clear_globals;
  1925. clear_values;
  1926. failed := false;
  1927. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/virtual call...');
  1928. constructor_params_mixed_call_overriden(RESULT_U8BIT,
  1929. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1930. if object_u8bit <> RESULT_U8BIT then
  1931. failed := true;
  1932. if object_u16bit <> RESULT_U16BIT then
  1933. failed := true;
  1934. if object_s32bit <> RESULT_S32BIT then
  1935. failed := true;
  1936. if object_s64bit <> RESULT_S64BIT then
  1937. failed := true;
  1938. if object_bigstring <> RESULT_BIGSTRING then
  1939. failed := true;
  1940. destructor_params_done;
  1941. if failed then
  1942. fail
  1943. else
  1944. Writeln('Passed!');
  1945. clear_globals;
  1946. clear_values;
  1947. failed := false;
  1948. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/virtual call...');
  1949. value_u8bit := RESULT_U8BIT;
  1950. value_u16bit := RESULT_U16BIT;
  1951. value_bigstring := RESULT_BIGSTRING;
  1952. value_s32bit := RESULT_S32BIT;
  1953. value_s64bit := RESULT_S64BIT;
  1954. constructor_params_mixed_call_overriden(value_u8bit,
  1955. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  1956. if object_u8bit <> RESULT_U8BIT then
  1957. failed := true;
  1958. if object_u16bit <> RESULT_U16BIT then
  1959. failed := true;
  1960. if object_s32bit <> RESULT_S32BIT then
  1961. failed := true;
  1962. if object_s64bit <> RESULT_S64BIT then
  1963. failed := true;
  1964. if object_bigstring <> RESULT_BIGSTRING then
  1965. failed := true;
  1966. destructor_params_done;
  1967. if failed then
  1968. fail
  1969. else
  1970. Writeln('Passed!');
  1971. clear_globals;
  1972. clear_values;
  1973. failed := false;
  1974. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/method call...');
  1975. constructor_params_mixed_call_normal(RESULT_U8BIT,
  1976. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  1977. if object_u8bit <> RESULT_U8BIT then
  1978. failed := true;
  1979. if object_u16bit <> RESULT_U16BIT then
  1980. failed := true;
  1981. if object_s32bit <> RESULT_S32BIT then
  1982. failed := true;
  1983. if object_s64bit <> RESULT_S64BIT then
  1984. failed := true;
  1985. if object_bigstring <> RESULT_BIGSTRING then
  1986. failed := true;
  1987. destructor_params_done;
  1988. if failed then
  1989. fail
  1990. else
  1991. Writeln('Passed!');
  1992. clear_globals;
  1993. clear_values;
  1994. failed := false;
  1995. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/method call...');
  1996. value_u8bit := RESULT_U8BIT;
  1997. value_u16bit := RESULT_U16BIT;
  1998. value_bigstring := RESULT_BIGSTRING;
  1999. value_s32bit := RESULT_S32BIT;
  2000. value_s64bit := RESULT_S64BIT;
  2001. constructor_params_mixed_call_normal(value_u8bit,
  2002. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2003. if object_u8bit <> RESULT_U8BIT then
  2004. failed := true;
  2005. if object_u16bit <> RESULT_U16BIT then
  2006. failed := true;
  2007. if object_s32bit <> RESULT_S32BIT then
  2008. failed := true;
  2009. if object_s64bit <> RESULT_S64BIT then
  2010. failed := true;
  2011. if object_bigstring <> RESULT_BIGSTRING then
  2012. failed := true;
  2013. destructor_params_done;
  2014. if failed then
  2015. fail
  2016. else
  2017. Writeln('Passed!');
  2018. clear_globals;
  2019. clear_values;
  2020. failed := false;
  2021. Write('Testing mixed parameter (LOC_CONSTANT) constructor call w/static call...');
  2022. constructor_params_mixed_call_static(RESULT_U8BIT,
  2023. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2024. if global_u8bit <> RESULT_U8BIT then
  2025. failed := true;
  2026. if global_u16bit <> RESULT_U16BIT then
  2027. failed := true;
  2028. if global_s32bit <> RESULT_S32BIT then
  2029. failed := true;
  2030. if global_s64bit <> RESULT_S64BIT then
  2031. failed := true;
  2032. if global_bigstring <> RESULT_BIGSTRING then
  2033. failed := true;
  2034. destructor_params_done;
  2035. if failed then
  2036. fail
  2037. else
  2038. Writeln('Passed!');
  2039. clear_globals;
  2040. clear_values;
  2041. failed := false;
  2042. Write('Testing mixed parameter (LOC_REFERENCE) constructor call w/static call...');
  2043. value_u8bit := RESULT_U8BIT;
  2044. value_u16bit := RESULT_U16BIT;
  2045. value_bigstring := RESULT_BIGSTRING;
  2046. value_s32bit := RESULT_S32BIT;
  2047. value_s64bit := RESULT_S64BIT;
  2048. constructor_params_mixed_call_static(value_u8bit,
  2049. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2050. if global_u8bit <> RESULT_U8BIT then
  2051. failed := true;
  2052. if global_u16bit <> RESULT_U16BIT then
  2053. failed := true;
  2054. if global_s32bit <> RESULT_S32BIT then
  2055. failed := true;
  2056. if global_s64bit <> RESULT_S64BIT then
  2057. failed := true;
  2058. if global_bigstring <> RESULT_BIGSTRING then
  2059. failed := true;
  2060. destructor_params_done;
  2061. if failed then
  2062. fail
  2063. else
  2064. Writeln('Passed!');
  2065. {************************* METHOD TESTING **************************}
  2066. clear_globals;
  2067. clear_values;
  2068. failed := false;
  2069. constructor_init;
  2070. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  2071. method_virtual_params_mixed(RESULT_U8BIT,
  2072. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2073. if object_u8bit <> RESULT_U8BIT then
  2074. failed := true;
  2075. if object_u16bit <> RESULT_U16BIT then
  2076. failed := true;
  2077. if object_s32bit <> RESULT_S32BIT then
  2078. failed := true;
  2079. if object_s64bit <> RESULT_S64BIT then
  2080. failed := true;
  2081. if object_bigstring <> RESULT_BIGSTRING then
  2082. failed := true;
  2083. destructor_params_done;
  2084. if failed then
  2085. fail
  2086. else
  2087. Writeln('Passed!');
  2088. clear_globals;
  2089. clear_values;
  2090. failed := false;
  2091. constructor_init;
  2092. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  2093. value_u8bit := RESULT_U8BIT;
  2094. value_u16bit := RESULT_U16BIT;
  2095. value_bigstring := RESULT_BIGSTRING;
  2096. value_s32bit := RESULT_S32BIT;
  2097. value_s64bit := RESULT_S64BIT;
  2098. method_virtual_params_mixed(value_u8bit,
  2099. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2100. if object_u8bit <> RESULT_U8BIT then
  2101. failed := true;
  2102. if object_u16bit <> RESULT_U16BIT then
  2103. failed := true;
  2104. if object_s32bit <> RESULT_S32BIT then
  2105. failed := true;
  2106. if object_s64bit <> RESULT_S64BIT then
  2107. failed := true;
  2108. if object_bigstring <> RESULT_BIGSTRING then
  2109. failed := true;
  2110. destructor_params_done;
  2111. if failed then
  2112. fail
  2113. else
  2114. Writeln('Passed!');
  2115. clear_globals;
  2116. clear_values;
  2117. failed := false;
  2118. constructor_init;
  2119. Write('Testing mixed parameter (LOC_CONSTANT) virtual method call...');
  2120. method_virtual_overriden_params_mixed(RESULT_U8BIT,
  2121. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2122. if object_u8bit <> RESULT_U8BIT then
  2123. failed := true;
  2124. if object_u16bit <> RESULT_U16BIT then
  2125. failed := true;
  2126. if object_s32bit <> RESULT_S32BIT then
  2127. failed := true;
  2128. if object_s64bit <> RESULT_S64BIT then
  2129. failed := true;
  2130. if object_bigstring <> RESULT_BIGSTRING then
  2131. failed := true;
  2132. destructor_params_done;
  2133. if failed then
  2134. fail
  2135. else
  2136. Writeln('Passed!');
  2137. clear_globals;
  2138. clear_values;
  2139. failed := false;
  2140. constructor_init;
  2141. Write('Testing mixed parameter (LOC_REFERENCE) virtual method call...');
  2142. value_u8bit := RESULT_U8BIT;
  2143. value_u16bit := RESULT_U16BIT;
  2144. value_bigstring := RESULT_BIGSTRING;
  2145. value_s32bit := RESULT_S32BIT;
  2146. value_s64bit := RESULT_S64BIT;
  2147. method_virtual_overriden_params_mixed(value_u8bit,
  2148. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2149. if object_u8bit <> RESULT_U8BIT then
  2150. failed := true;
  2151. if object_u16bit <> RESULT_U16BIT then
  2152. failed := true;
  2153. if object_s32bit <> RESULT_S32BIT then
  2154. failed := true;
  2155. if object_s64bit <> RESULT_S64BIT then
  2156. failed := true;
  2157. if object_bigstring <> RESULT_BIGSTRING then
  2158. failed := true;
  2159. destructor_params_done;
  2160. if failed then
  2161. fail
  2162. else
  2163. Writeln('Passed!');
  2164. clear_globals;
  2165. clear_values;
  2166. failed := false;
  2167. constructor_init;
  2168. Write('Testing mixed parameter (LOC_CONSTANT) method call...');
  2169. method_normal_params_mixed(RESULT_U8BIT,
  2170. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2171. if object_u8bit <> RESULT_U8BIT then
  2172. failed := true;
  2173. if object_u16bit <> RESULT_U16BIT then
  2174. failed := true;
  2175. if object_s32bit <> RESULT_S32BIT then
  2176. failed := true;
  2177. if object_s64bit <> RESULT_S64BIT then
  2178. failed := true;
  2179. if object_bigstring <> RESULT_BIGSTRING then
  2180. failed := true;
  2181. destructor_params_done;
  2182. if failed then
  2183. fail
  2184. else
  2185. Writeln('Passed!');
  2186. clear_globals;
  2187. clear_values;
  2188. failed := false;
  2189. constructor_init;
  2190. Write('Testing mixed parameter (LOC_REFERENCE) method call...');
  2191. value_u8bit := RESULT_U8BIT;
  2192. value_u16bit := RESULT_U16BIT;
  2193. value_bigstring := RESULT_BIGSTRING;
  2194. value_s32bit := RESULT_S32BIT;
  2195. value_s64bit := RESULT_S64BIT;
  2196. method_normal_params_mixed(value_u8bit,
  2197. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2198. if object_u8bit <> RESULT_U8BIT then
  2199. failed := true;
  2200. if object_u16bit <> RESULT_U16BIT then
  2201. failed := true;
  2202. if object_s32bit <> RESULT_S32BIT then
  2203. failed := true;
  2204. if object_s64bit <> RESULT_S64BIT then
  2205. failed := true;
  2206. if object_bigstring <> RESULT_BIGSTRING then
  2207. failed := true;
  2208. destructor_params_done;
  2209. if failed then
  2210. fail
  2211. else
  2212. Writeln('Passed!');
  2213. clear_globals;
  2214. clear_values;
  2215. failed := false;
  2216. constructor_init;
  2217. Write('Testing mixed parameter (LOC_CONSTANT) static method call...');
  2218. method_static_params_mixed(RESULT_U8BIT,
  2219. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2220. if global_u8bit <> RESULT_U8BIT then
  2221. failed := true;
  2222. if global_u16bit <> RESULT_U16BIT then
  2223. failed := true;
  2224. if global_s32bit <> RESULT_S32BIT then
  2225. failed := true;
  2226. if global_s64bit <> RESULT_S64BIT then
  2227. failed := true;
  2228. if global_bigstring <> RESULT_BIGSTRING then
  2229. failed := true;
  2230. destructor_params_done;
  2231. if failed then
  2232. fail
  2233. else
  2234. Writeln('Passed!');
  2235. clear_globals;
  2236. clear_values;
  2237. failed := false;
  2238. constructor_init;
  2239. Write('Testing mixed parameter (LOC_REFERENCE) static method call...');
  2240. value_u8bit := RESULT_U8BIT;
  2241. value_u16bit := RESULT_U16BIT;
  2242. value_bigstring := RESULT_BIGSTRING;
  2243. value_s32bit := RESULT_S32BIT;
  2244. value_s64bit := RESULT_S64BIT;
  2245. method_static_params_mixed(value_u8bit,
  2246. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2247. if global_u8bit <> RESULT_U8BIT then
  2248. failed := true;
  2249. if global_u16bit <> RESULT_U16BIT then
  2250. failed := true;
  2251. if global_s32bit <> RESULT_S32BIT then
  2252. failed := true;
  2253. if global_s64bit <> RESULT_S64BIT then
  2254. failed := true;
  2255. if global_bigstring <> RESULT_BIGSTRING then
  2256. failed := true;
  2257. destructor_params_done;
  2258. if failed then
  2259. fail
  2260. else
  2261. Writeln('Passed!');
  2262. { ********************************************************************
  2263. This calls methods which in turn call other methods, or a constructor
  2264. or a destructor.
  2265. *********************************************************************
  2266. }
  2267. clear_globals;
  2268. clear_values;
  2269. failed := false;
  2270. { Calls the ancestor virtual method }
  2271. constructor_init;
  2272. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  2273. method_normal_call_virtual_params_mixed(RESULT_U8BIT,
  2274. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2275. if object_u8bit <> RESULT_U8BIT then
  2276. failed := true;
  2277. if object_u16bit <> RESULT_U16BIT then
  2278. failed := true;
  2279. if object_s32bit <> RESULT_S32BIT then
  2280. failed := true;
  2281. if object_s64bit <> RESULT_S64BIT then
  2282. failed := true;
  2283. if object_bigstring <> RESULT_BIGSTRING then
  2284. failed := true;
  2285. destructor_params_done;
  2286. if failed then
  2287. fail
  2288. else
  2289. Writeln('Passed!');
  2290. clear_globals;
  2291. clear_values;
  2292. failed := false;
  2293. constructor_init;
  2294. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  2295. value_u8bit := RESULT_U8BIT;
  2296. value_u16bit := RESULT_U16BIT;
  2297. value_bigstring := RESULT_BIGSTRING;
  2298. value_s32bit := RESULT_S32BIT;
  2299. value_s64bit := RESULT_S64BIT;
  2300. method_normal_call_virtual_params_mixed(value_u8bit,
  2301. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2302. if object_u8bit <> RESULT_U8BIT then
  2303. failed := true;
  2304. if object_u16bit <> RESULT_U16BIT then
  2305. failed := true;
  2306. if object_s32bit <> RESULT_S32BIT then
  2307. failed := true;
  2308. if object_s64bit <> RESULT_S64BIT then
  2309. failed := true;
  2310. if object_bigstring <> RESULT_BIGSTRING then
  2311. failed := true;
  2312. destructor_params_done;
  2313. if failed then
  2314. fail
  2315. else
  2316. Writeln('Passed!');
  2317. { The virtual method has been overriden by the object in this case }
  2318. constructor_init;
  2319. Write('Testing mixed parameter (LOC_CONSTANT) method call w/virtual call...');
  2320. method_normal_call_overriden_params_mixed(RESULT_U8BIT,
  2321. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2322. if object_u8bit <> RESULT_U8BIT then
  2323. failed := true;
  2324. if object_u16bit <> RESULT_U16BIT then
  2325. failed := true;
  2326. if object_s32bit <> RESULT_S32BIT then
  2327. failed := true;
  2328. if object_s64bit <> RESULT_S64BIT then
  2329. failed := true;
  2330. if object_bigstring <> RESULT_BIGSTRING then
  2331. failed := true;
  2332. destructor_params_done;
  2333. if failed then
  2334. fail
  2335. else
  2336. Writeln('Passed!');
  2337. clear_globals;
  2338. clear_values;
  2339. failed := false;
  2340. constructor_init;
  2341. Write('Testing mixed parameter (LOC_REFERENCE) method call w/virtual call...');
  2342. value_u8bit := RESULT_U8BIT;
  2343. value_u16bit := RESULT_U16BIT;
  2344. value_bigstring := RESULT_BIGSTRING;
  2345. value_s32bit := RESULT_S32BIT;
  2346. value_s64bit := RESULT_S64BIT;
  2347. method_normal_call_overriden_params_mixed(value_u8bit,
  2348. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2349. if object_u8bit <> RESULT_U8BIT then
  2350. failed := true;
  2351. if object_u16bit <> RESULT_U16BIT then
  2352. failed := true;
  2353. if object_s32bit <> RESULT_S32BIT then
  2354. failed := true;
  2355. if object_s64bit <> RESULT_S64BIT then
  2356. failed := true;
  2357. if object_bigstring <> RESULT_BIGSTRING then
  2358. failed := true;
  2359. destructor_params_done;
  2360. if failed then
  2361. fail
  2362. else
  2363. Writeln('Passed!');
  2364. clear_globals;
  2365. clear_values;
  2366. failed := false;
  2367. constructor_init;
  2368. Write('Testing mixed parameter (LOC_CONSTANT) method call w/normal call...');
  2369. method_normal_call_normal_params_mixed(RESULT_U8BIT,
  2370. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2371. if object_u8bit <> RESULT_U8BIT then
  2372. failed := true;
  2373. if object_u16bit <> RESULT_U16BIT then
  2374. failed := true;
  2375. if object_s32bit <> RESULT_S32BIT then
  2376. failed := true;
  2377. if object_s64bit <> RESULT_S64BIT then
  2378. failed := true;
  2379. if object_bigstring <> RESULT_BIGSTRING then
  2380. failed := true;
  2381. destructor_params_done;
  2382. if failed then
  2383. fail
  2384. else
  2385. Writeln('Passed!');
  2386. clear_globals;
  2387. clear_values;
  2388. failed := false;
  2389. constructor_init;
  2390. Write('Testing mixed parameter (LOC_REFERENCE) method call w/normal call...');
  2391. value_u8bit := RESULT_U8BIT;
  2392. value_u16bit := RESULT_U16BIT;
  2393. value_bigstring := RESULT_BIGSTRING;
  2394. value_s32bit := RESULT_S32BIT;
  2395. value_s64bit := RESULT_S64BIT;
  2396. method_normal_call_normal_params_mixed(value_u8bit,
  2397. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2398. if object_u8bit <> RESULT_U8BIT then
  2399. failed := true;
  2400. if object_u16bit <> RESULT_U16BIT then
  2401. failed := true;
  2402. if object_s32bit <> RESULT_S32BIT then
  2403. failed := true;
  2404. if object_s64bit <> RESULT_S64BIT then
  2405. failed := true;
  2406. if object_bigstring <> RESULT_BIGSTRING then
  2407. failed := true;
  2408. destructor_params_done;
  2409. if failed then
  2410. fail
  2411. else
  2412. Writeln('Passed!');
  2413. (* constructor call inside a normal method *)
  2414. clear_globals;
  2415. clear_values;
  2416. failed := false;
  2417. constructor_init;
  2418. Write('Testing mixed parameter (LOC_CONSTANT) method call w/constructor call...');
  2419. method_normal_call_constructor_params_mixed(RESULT_U8BIT,
  2420. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2421. if object_u8bit <> RESULT_U8BIT then
  2422. failed := true;
  2423. if object_u16bit <> RESULT_U16BIT then
  2424. failed := true;
  2425. if object_s32bit <> RESULT_S32BIT then
  2426. failed := true;
  2427. if object_s64bit <> RESULT_S64BIT then
  2428. failed := true;
  2429. if object_bigstring <> RESULT_BIGSTRING then
  2430. failed := true;
  2431. destructor_params_done;
  2432. if failed then
  2433. fail
  2434. else
  2435. Writeln('Passed!');
  2436. clear_globals;
  2437. clear_values;
  2438. failed := false;
  2439. constructor_init;
  2440. Write('Testing mixed parameter (LOC_REFERENCE) method call w/constructor call...');
  2441. value_u8bit := RESULT_U8BIT;
  2442. value_u16bit := RESULT_U16BIT;
  2443. value_bigstring := RESULT_BIGSTRING;
  2444. value_s32bit := RESULT_S32BIT;
  2445. value_s64bit := RESULT_S64BIT;
  2446. method_normal_call_constructor_params_mixed(value_u8bit,
  2447. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2448. if object_u8bit <> RESULT_U8BIT then
  2449. failed := true;
  2450. if object_u16bit <> RESULT_U16BIT then
  2451. failed := true;
  2452. if object_s32bit <> RESULT_S32BIT then
  2453. failed := true;
  2454. if object_s64bit <> RESULT_S64BIT then
  2455. failed := true;
  2456. if object_bigstring <> RESULT_BIGSTRING then
  2457. failed := true;
  2458. destructor_params_done;
  2459. if failed then
  2460. fail
  2461. else
  2462. Writeln('Passed!');
  2463. { static method call }
  2464. clear_globals;
  2465. clear_values;
  2466. failed := false;
  2467. constructor_init;
  2468. Write('Testing mixed parameter (LOC_CONSTANT) method call w/static call...');
  2469. method_normal_call_static_params_mixed(RESULT_U8BIT,
  2470. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2471. if global_u8bit <> RESULT_U8BIT then
  2472. failed := true;
  2473. if global_u16bit <> RESULT_U16BIT then
  2474. failed := true;
  2475. if global_s32bit <> RESULT_S32BIT then
  2476. failed := true;
  2477. if global_s64bit <> RESULT_S64BIT then
  2478. failed := true;
  2479. if global_bigstring <> RESULT_BIGSTRING then
  2480. failed := true;
  2481. destructor_params_done;
  2482. if failed then
  2483. fail
  2484. else
  2485. Writeln('Passed!');
  2486. clear_globals;
  2487. clear_values;
  2488. failed := false;
  2489. constructor_init;
  2490. Write('Testing mixed parameter (LOC_REFERENCE) method call w/static call...');
  2491. value_u8bit := RESULT_U8BIT;
  2492. value_u16bit := RESULT_U16BIT;
  2493. value_bigstring := RESULT_BIGSTRING;
  2494. value_s32bit := RESULT_S32BIT;
  2495. value_s64bit := RESULT_S64BIT;
  2496. method_normal_call_static_params_mixed(value_u8bit,
  2497. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2498. if global_u8bit <> RESULT_U8BIT then
  2499. failed := true;
  2500. if global_u16bit <> RESULT_U16BIT then
  2501. failed := true;
  2502. if global_s32bit <> RESULT_S32BIT then
  2503. failed := true;
  2504. if global_s64bit <> RESULT_S64BIT then
  2505. failed := true;
  2506. if global_bigstring <> RESULT_BIGSTRING then
  2507. failed := true;
  2508. destructor_params_done;
  2509. if failed then
  2510. fail
  2511. else
  2512. Writeln('Passed!');
  2513. (* calls the inherited method *)
  2514. clear_globals;
  2515. clear_values;
  2516. failed := false;
  2517. { Calls the ancestor virtual method }
  2518. constructor_init;
  2519. Write('Testing mixed parameter (LOC_CONSTANT) method call w/inherited call...');
  2520. method_normal_call_inherited_params_mixed(RESULT_U8BIT,
  2521. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2522. if object_u8bit <> RESULT_U8BIT then
  2523. failed := true;
  2524. if object_u16bit <> RESULT_U16BIT then
  2525. failed := true;
  2526. if object_s32bit <> RESULT_S32BIT then
  2527. failed := true;
  2528. if object_s64bit <> RESULT_S64BIT then
  2529. failed := true;
  2530. if object_bigstring <> RESULT_BIGSTRING then
  2531. failed := true;
  2532. destructor_params_done;
  2533. if failed then
  2534. fail
  2535. else
  2536. Writeln('Passed!');
  2537. clear_globals;
  2538. clear_values;
  2539. failed := false;
  2540. constructor_init;
  2541. Write('Testing mixed parameter (LOC_REFERENCE) method call w/inherited call...');
  2542. value_u8bit := RESULT_U8BIT;
  2543. value_u16bit := RESULT_U16BIT;
  2544. value_bigstring := RESULT_BIGSTRING;
  2545. value_s32bit := RESULT_S32BIT;
  2546. value_s64bit := RESULT_S64BIT;
  2547. method_normal_call_inherited_params_mixed(value_u8bit,
  2548. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2549. if object_u8bit <> RESULT_U8BIT then
  2550. failed := true;
  2551. if object_u16bit <> RESULT_U16BIT then
  2552. failed := true;
  2553. if object_s32bit <> RESULT_S32BIT then
  2554. failed := true;
  2555. if object_s64bit <> RESULT_S64BIT then
  2556. failed := true;
  2557. if object_bigstring <> RESULT_BIGSTRING then
  2558. failed := true;
  2559. destructor_params_done;
  2560. if failed then
  2561. fail
  2562. else
  2563. Writeln('Passed!');
  2564. { ********************************************************************
  2565. This calls virtual methods which in turn call other methods,
  2566. or a constructor or a destructor.
  2567. *********************************************************************
  2568. }
  2569. clear_globals;
  2570. clear_values;
  2571. failed := false;
  2572. { Calls the ancestor virtual method }
  2573. constructor_init;
  2574. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  2575. method_virtual_call_virtual_params_mixed(RESULT_U8BIT,
  2576. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2577. if object_u8bit <> RESULT_U8BIT then
  2578. failed := true;
  2579. if object_u16bit <> RESULT_U16BIT then
  2580. failed := true;
  2581. if object_s32bit <> RESULT_S32BIT then
  2582. failed := true;
  2583. if object_s64bit <> RESULT_S64BIT then
  2584. failed := true;
  2585. if object_bigstring <> RESULT_BIGSTRING then
  2586. failed := true;
  2587. destructor_params_done;
  2588. if failed then
  2589. fail
  2590. else
  2591. Writeln('Passed!');
  2592. clear_globals;
  2593. clear_values;
  2594. failed := false;
  2595. constructor_init;
  2596. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  2597. value_u8bit := RESULT_U8BIT;
  2598. value_u16bit := RESULT_U16BIT;
  2599. value_bigstring := RESULT_BIGSTRING;
  2600. value_s32bit := RESULT_S32BIT;
  2601. value_s64bit := RESULT_S64BIT;
  2602. method_virtual_call_virtual_params_mixed(value_u8bit,
  2603. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2604. if object_u8bit <> RESULT_U8BIT then
  2605. failed := true;
  2606. if object_u16bit <> RESULT_U16BIT then
  2607. failed := true;
  2608. if object_s32bit <> RESULT_S32BIT then
  2609. failed := true;
  2610. if object_s64bit <> RESULT_S64BIT then
  2611. failed := true;
  2612. if object_bigstring <> RESULT_BIGSTRING then
  2613. failed := true;
  2614. destructor_params_done;
  2615. if failed then
  2616. fail
  2617. else
  2618. Writeln('Passed!');
  2619. { The virtual method has been overriden by the object in this case }
  2620. constructor_init;
  2621. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/virtual call...');
  2622. method_virtual_call_overriden_params_mixed(RESULT_U8BIT,
  2623. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2624. if object_u8bit <> RESULT_U8BIT then
  2625. failed := true;
  2626. if object_u16bit <> RESULT_U16BIT then
  2627. failed := true;
  2628. if object_s32bit <> RESULT_S32BIT then
  2629. failed := true;
  2630. if object_s64bit <> RESULT_S64BIT then
  2631. failed := true;
  2632. if object_bigstring <> RESULT_BIGSTRING then
  2633. failed := true;
  2634. destructor_params_done;
  2635. if failed then
  2636. fail
  2637. else
  2638. Writeln('Passed!');
  2639. clear_globals;
  2640. clear_values;
  2641. failed := false;
  2642. constructor_init;
  2643. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/virtual call...');
  2644. value_u8bit := RESULT_U8BIT;
  2645. value_u16bit := RESULT_U16BIT;
  2646. value_bigstring := RESULT_BIGSTRING;
  2647. value_s32bit := RESULT_S32BIT;
  2648. value_s64bit := RESULT_S64BIT;
  2649. method_virtual_call_overriden_params_mixed(value_u8bit,
  2650. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2651. if object_u8bit <> RESULT_U8BIT then
  2652. failed := true;
  2653. if object_u16bit <> RESULT_U16BIT then
  2654. failed := true;
  2655. if object_s32bit <> RESULT_S32BIT then
  2656. failed := true;
  2657. if object_s64bit <> RESULT_S64BIT then
  2658. failed := true;
  2659. if object_bigstring <> RESULT_BIGSTRING then
  2660. failed := true;
  2661. destructor_params_done;
  2662. if failed then
  2663. fail
  2664. else
  2665. Writeln('Passed!');
  2666. clear_globals;
  2667. clear_values;
  2668. failed := false;
  2669. constructor_init;
  2670. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/normal call...');
  2671. method_virtual_call_normal_params_mixed(RESULT_U8BIT,
  2672. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2673. if object_u8bit <> RESULT_U8BIT then
  2674. failed := true;
  2675. if object_u16bit <> RESULT_U16BIT then
  2676. failed := true;
  2677. if object_s32bit <> RESULT_S32BIT then
  2678. failed := true;
  2679. if object_s64bit <> RESULT_S64BIT then
  2680. failed := true;
  2681. if object_bigstring <> RESULT_BIGSTRING then
  2682. failed := true;
  2683. destructor_params_done;
  2684. if failed then
  2685. fail
  2686. else
  2687. Writeln('Passed!');
  2688. clear_globals;
  2689. clear_values;
  2690. failed := false;
  2691. constructor_init;
  2692. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/normal call...');
  2693. value_u8bit := RESULT_U8BIT;
  2694. value_u16bit := RESULT_U16BIT;
  2695. value_bigstring := RESULT_BIGSTRING;
  2696. value_s32bit := RESULT_S32BIT;
  2697. value_s64bit := RESULT_S64BIT;
  2698. method_virtual_call_normal_params_mixed(value_u8bit,
  2699. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2700. if object_u8bit <> RESULT_U8BIT then
  2701. failed := true;
  2702. if object_u16bit <> RESULT_U16BIT then
  2703. failed := true;
  2704. if object_s32bit <> RESULT_S32BIT then
  2705. failed := true;
  2706. if object_s64bit <> RESULT_S64BIT then
  2707. failed := true;
  2708. if object_bigstring <> RESULT_BIGSTRING then
  2709. failed := true;
  2710. destructor_params_done;
  2711. if failed then
  2712. fail
  2713. else
  2714. Writeln('Passed!');
  2715. (* constructor call inside a normal method *)
  2716. clear_globals;
  2717. clear_values;
  2718. failed := false;
  2719. constructor_init;
  2720. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/constructor call...');
  2721. method_virtual_call_constructor_params_mixed(RESULT_U8BIT,
  2722. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2723. if object_u8bit <> RESULT_U8BIT then
  2724. failed := true;
  2725. if object_u16bit <> RESULT_U16BIT then
  2726. failed := true;
  2727. if object_s32bit <> RESULT_S32BIT then
  2728. failed := true;
  2729. if object_s64bit <> RESULT_S64BIT then
  2730. failed := true;
  2731. if object_bigstring <> RESULT_BIGSTRING then
  2732. failed := true;
  2733. destructor_params_done;
  2734. if failed then
  2735. fail
  2736. else
  2737. Writeln('Passed!');
  2738. clear_globals;
  2739. clear_values;
  2740. failed := false;
  2741. constructor_init;
  2742. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/constructor call...');
  2743. value_u8bit := RESULT_U8BIT;
  2744. value_u16bit := RESULT_U16BIT;
  2745. value_bigstring := RESULT_BIGSTRING;
  2746. value_s32bit := RESULT_S32BIT;
  2747. value_s64bit := RESULT_S64BIT;
  2748. method_virtual_call_constructor_params_mixed(value_u8bit,
  2749. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2750. if object_u8bit <> RESULT_U8BIT then
  2751. failed := true;
  2752. if object_u16bit <> RESULT_U16BIT then
  2753. failed := true;
  2754. if object_s32bit <> RESULT_S32BIT then
  2755. failed := true;
  2756. if object_s64bit <> RESULT_S64BIT then
  2757. failed := true;
  2758. if object_bigstring <> RESULT_BIGSTRING then
  2759. failed := true;
  2760. destructor_params_done;
  2761. if failed then
  2762. fail
  2763. else
  2764. Writeln('Passed!');
  2765. { static virtual call }
  2766. clear_globals;
  2767. clear_values;
  2768. failed := false;
  2769. constructor_init;
  2770. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/static call...');
  2771. method_virtual_call_static_params_mixed(RESULT_U8BIT,
  2772. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2773. if global_u8bit <> RESULT_U8BIT then
  2774. failed := true;
  2775. if global_u16bit <> RESULT_U16BIT then
  2776. failed := true;
  2777. if global_s32bit <> RESULT_S32BIT then
  2778. failed := true;
  2779. if global_s64bit <> RESULT_S64BIT then
  2780. failed := true;
  2781. if global_bigstring <> RESULT_BIGSTRING then
  2782. failed := true;
  2783. destructor_params_done;
  2784. if failed then
  2785. fail
  2786. else
  2787. Writeln('Passed!');
  2788. clear_globals;
  2789. clear_values;
  2790. failed := false;
  2791. constructor_init;
  2792. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/static call...');
  2793. value_u8bit := RESULT_U8BIT;
  2794. value_u16bit := RESULT_U16BIT;
  2795. value_bigstring := RESULT_BIGSTRING;
  2796. value_s32bit := RESULT_S32BIT;
  2797. value_s64bit := RESULT_S64BIT;
  2798. method_virtual_call_static_params_mixed(value_u8bit,
  2799. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2800. if global_u8bit <> RESULT_U8BIT then
  2801. failed := true;
  2802. if global_u16bit <> RESULT_U16BIT then
  2803. failed := true;
  2804. if global_s32bit <> RESULT_S32BIT then
  2805. failed := true;
  2806. if global_s64bit <> RESULT_S64BIT then
  2807. failed := true;
  2808. if global_bigstring <> RESULT_BIGSTRING then
  2809. failed := true;
  2810. destructor_params_done;
  2811. if failed then
  2812. fail
  2813. else
  2814. Writeln('Passed!');
  2815. (* calls the inherited method *)
  2816. clear_globals;
  2817. clear_values;
  2818. failed := false;
  2819. { Calls the ancestor virtual method }
  2820. constructor_init;
  2821. Write('Testing mixed parameter (LOC_CONSTANT) virtual call w/inherited call...');
  2822. method_virtual_call_inherited_params_mixed(RESULT_U8BIT,
  2823. RESULT_U16BIT, RESULT_BIGSTRING, RESULT_S32BIT, RESULT_S64BIT);
  2824. if object_u8bit <> RESULT_U8BIT then
  2825. failed := true;
  2826. if object_u16bit <> RESULT_U16BIT then
  2827. failed := true;
  2828. if object_s32bit <> RESULT_S32BIT then
  2829. failed := true;
  2830. if object_s64bit <> RESULT_S64BIT then
  2831. failed := true;
  2832. if object_bigstring <> RESULT_BIGSTRING then
  2833. failed := true;
  2834. destructor_params_done;
  2835. if failed then
  2836. fail
  2837. else
  2838. Writeln('Passed!');
  2839. clear_globals;
  2840. clear_values;
  2841. failed := false;
  2842. constructor_init;
  2843. Write('Testing mixed parameter (LOC_REFERENCE) virtual call w/inherited call...');
  2844. value_u8bit := RESULT_U8BIT;
  2845. value_u16bit := RESULT_U16BIT;
  2846. value_bigstring := RESULT_BIGSTRING;
  2847. value_s32bit := RESULT_S32BIT;
  2848. value_s64bit := RESULT_S64BIT;
  2849. method_virtual_call_inherited_params_mixed(value_u8bit,
  2850. value_u16bit, value_bigstring, value_s32bit, value_s64bit);
  2851. if object_u8bit <> RESULT_U8BIT then
  2852. failed := true;
  2853. if object_u16bit <> RESULT_U16BIT then
  2854. failed := true;
  2855. if object_s32bit <> RESULT_S32BIT then
  2856. failed := true;
  2857. if object_s64bit <> RESULT_S64BIT then
  2858. failed := true;
  2859. if object_bigstring <> RESULT_BIGSTRING then
  2860. failed := true;
  2861. destructor_params_done;
  2862. if failed then
  2863. fail
  2864. else
  2865. Writeln('Passed!');
  2866. end; { end with }
  2867. end;
  2868. begin
  2869. WriteLN('*********************** NO VMT OBJECT TESTS ********************');
  2870. testnovmtobject;
  2871. WriteLN('************************ VMT OBJECT FAIL **********************');
  2872. testfailedobject;
  2873. WriteLN('************************* VMT OBJECT TESTS *********************');
  2874. testvmtobject;
  2875. testheritedvmtobject;
  2876. WriteLN('**************** VMT OBJECT TESTS USING WITH *******************');
  2877. testwith;
  2878. end.