tcalcst1.pp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848
  1. {****************************************************************}
  2. { CODE GENERATOR TEST PROGRAM }
  3. { By Carl Eric Codere }
  4. {****************************************************************}
  5. { NODE TESTED : secondcallparan() }
  6. {****************************************************************}
  7. { PRE-REQUISITES: secondload() }
  8. { secondassign() }
  9. { secondtypeconv() }
  10. { secondtryexcept() }
  11. { secondcalln() }
  12. { secondadd() }
  13. {****************************************************************}
  14. { DEFINES: }
  15. { FPC = Target is FreePascal compiler }
  16. {****************************************************************}
  17. { REMARKS: This tests a subset of the secondcalln() node }
  18. { (const parameters) }
  19. {****************************************************************}
  20. program tcalcst1;
  21. {$ifdef fpc}
  22. {$mode objfpc}
  23. {$INLINE ON}
  24. {$endif}
  25. {$R+}
  26. {$ifdef VER70}
  27. {$define tp}
  28. {$endif}
  29. { REAL should map to single or double }
  30. { so it is not checked, since single }
  31. { double nodes are checked. }
  32. { assumes that enumdef is the same as orddef (same storage format) }
  33. const
  34. { should be defined depending on CPU target }
  35. {$ifdef fpc}
  36. {$ifdef cpu68k}
  37. BIG_INDEX = 8000;
  38. SMALL_INDEX = 13;
  39. {$else}
  40. BIG_INDEX = 33000;
  41. SMALL_INDEX = 13; { value should not be aligned! }
  42. {$endif}
  43. {$else}
  44. BIG_INDEX = 33000;
  45. SMALL_INDEX = 13; { value should not be aligned! }
  46. {$endif}
  47. RESULT_U8BIT = $55;
  48. RESULT_U16BIT = $500F;
  49. RESULT_S32BIT = $500F0000;
  50. RESULT_S64BIT = $500F0000;
  51. RESULT_S32REAL = 1777.12;
  52. RESULT_S64REAL = 3444.24;
  53. RESULT_BOOL8BIT = 1;
  54. RESULT_BOOL16BIT = 1;
  55. RESULT_BOOL32BIT = 1;
  56. RESULT_PCHAR = 'Hello world';
  57. RESULT_BIGSTRING = 'Hello world';
  58. RESULT_SMALLSTRING = 'H';
  59. RESULT_CHAR = 'I';
  60. RESULT_BOOLEAN = TRUE;
  61. type
  62. {$ifndef tp}
  63. tclass1 = class
  64. end;
  65. {$else}
  66. shortstring = string;
  67. {$endif}
  68. tprocedure = procedure;
  69. tsmallrecord =
  70. {$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
  71. packed
  72. {$endif FPC_REQUIRES_PROPER_ALIGNMENT}
  73. record
  74. b: byte;
  75. w: word;
  76. end;
  77. tlargerecord = packed record
  78. b: array[1..BIG_INDEX] of byte;
  79. end;
  80. tsmallarray = packed array[1..SMALL_INDEX] of byte;
  81. tsmallsetenum =
  82. (A_A,A_B,A_C,A_D);
  83. tsmallset = set of tsmallsetenum;
  84. tlargeset = set of char;
  85. tsmallstring = string[2];
  86. var
  87. global_u8bit : byte;
  88. global_u16bit : word;
  89. global_s32bit : longint;
  90. global_s32real : single;
  91. global_s64real : double;
  92. global_ptr : pchar;
  93. global_proc : tprocedure;
  94. global_bigstring : shortstring;
  95. global_boolean : boolean;
  96. global_char : char;
  97. value_u8bit : byte;
  98. value_u16bit : word;
  99. value_s32bit : longint;
  100. {$ifndef tp}
  101. global_class : tclass1;
  102. global_s64bit : int64;
  103. value_s64bit : int64;
  104. value_class : tclass1;
  105. {$endif}
  106. value_s32real : single;
  107. value_s64real : double;
  108. value_proc : tprocedure;
  109. value_ptr : pchar;
  110. value_smallrec : tsmallrecord;
  111. value_largerec : tlargerecord;
  112. value_smallset : tsmallset;
  113. value_smallstring : tsmallstring;
  114. value_bigstring : shortstring;
  115. value_largeset : tlargeset;
  116. value_smallarray : tsmallarray;
  117. value_boolean : boolean;
  118. value_char : char;
  119. procedure fail;
  120. begin
  121. WriteLn('Failure.');
  122. halt(1);
  123. end;
  124. procedure clear_globals;
  125. begin
  126. global_u8bit := 0;
  127. global_u16bit := 0;
  128. global_s32bit := 0;
  129. global_s32real := 0.0;
  130. global_s64real := 0.0;
  131. global_ptr := nil;
  132. global_proc := nil;
  133. global_bigstring := '';
  134. global_boolean := false;
  135. global_char := #0;
  136. {$ifndef tp}
  137. global_s64bit := 0;
  138. global_class := nil;
  139. {$endif}
  140. end;
  141. procedure clear_values;
  142. begin
  143. value_u8bit := 0;
  144. value_u16bit := 0;
  145. value_s32bit := 0;
  146. value_s32real := 0.0;
  147. value_s64real := 0.0;
  148. value_proc := nil;
  149. value_ptr := nil;
  150. {$ifndef tp}
  151. value_s64bit := 0;
  152. value_class := nil;
  153. {$endif}
  154. fillchar(value_smallrec, sizeof(value_smallrec), #0);
  155. fillchar(value_largerec, sizeof(value_largerec), #0);
  156. value_smallset := [];
  157. value_smallstring := '';
  158. value_bigstring := '';
  159. value_largeset := [];
  160. fillchar(value_smallarray, sizeof(value_smallarray), #0);
  161. value_boolean := false;
  162. value_char:=#0;
  163. end;
  164. procedure testprocedure;
  165. begin
  166. end;
  167. function getu8bit : byte;
  168. begin
  169. getu8bit:=RESULT_U8BIT;
  170. end;
  171. function getu16bit: word;
  172. begin
  173. getu16bit:=RESULT_U16BIT;
  174. end;
  175. function gets32bit: longint;
  176. begin
  177. gets32bit:=RESULT_S32BIT;
  178. end;
  179. function gets64bit: int64;
  180. begin
  181. gets64bit:=RESULT_S64BIT;
  182. end;
  183. function gets32real: single;
  184. begin
  185. gets32real:=RESULT_S32REAL;
  186. end;
  187. function gets64real: double;
  188. begin
  189. gets64real:=RESULT_S64REAL;
  190. end;
  191. {************************************************************************}
  192. { CONST PARAMETERS }
  193. {************************************************************************}
  194. procedure proc_const_s32bit(const v : longint);
  195. begin
  196. global_s32bit := v;
  197. end;
  198. {$ifndef tp}
  199. procedure proc_const_s64bit(const v: int64);
  200. begin
  201. global_s64bit:= v;
  202. end;
  203. procedure proc_const_smallarray_const_1(const arr : array of const);
  204. var
  205. i: integer;
  206. begin
  207. for i:=0 to high(arr) do
  208. begin
  209. case arr[i].vtype of
  210. vtInteger : global_u8bit := arr[i].vinteger and $ff;
  211. vtBoolean : global_boolean := arr[i].vboolean;
  212. vtChar : global_char := arr[i].vchar;
  213. vtExtended : global_s64real := arr[i].VExtended^;
  214. vtString : global_bigstring := arr[i].VString^;
  215. vtPointer : ;
  216. vtPChar : global_ptr := arr[i].VPchar;
  217. vtObject : ;
  218. { vtClass : global_class := (arr[i].VClass) as tclass1;}
  219. vtAnsiString : ;
  220. vtInt64 : global_s64bit := arr[i].vInt64^;
  221. else
  222. RunError(255);
  223. end;
  224. end; {endfor}
  225. end;
  226. procedure proc_const_smallarray_const_2(const arr : array of const);
  227. var
  228. i: integer;
  229. begin
  230. if high(arr)<0 then
  231. global_u8bit := RESULT_U8BIT;
  232. end;
  233. {$endif}
  234. procedure proc_const_smallrecord(const smallrec : tsmallrecord);
  235. begin
  236. if (smallrec.b = RESULT_U8BIT) and (smallrec.w = RESULT_U16BIT) then
  237. global_u8bit := RESULT_U8BIT;
  238. end;
  239. procedure proc_const_largerecord(const largerec : tlargerecord);
  240. begin
  241. if (largerec.b[1] = RESULT_U8BIT) and (largerec.b[2] = RESULT_U8BIT) then
  242. global_u8bit := RESULT_U8BIT;
  243. end;
  244. procedure proc_const_smallset(const smallset : tsmallset);
  245. begin
  246. if A_D in smallset then
  247. global_u8bit := RESULT_U8BIT;
  248. end;
  249. procedure proc_const_largeset(const largeset : tlargeset);
  250. begin
  251. if 'I' in largeset then
  252. global_u8bit := RESULT_U8BIT;
  253. end;
  254. procedure proc_const_smallstring(const s:tsmallstring);
  255. begin
  256. if s = RESULT_SMALLSTRING then
  257. global_u8bit := RESULT_u8BIT;
  258. end;
  259. procedure proc_const_bigstring(const s:shortstring);
  260. begin
  261. if s = RESULT_BIGSTRING then
  262. global_u8bit := RESULT_u8BIT;
  263. end;
  264. procedure proc_const_smallarray(const arr : tsmallarray);
  265. begin
  266. if arr[SMALL_INDEX] = RESULT_U8BIT then
  267. global_u8bit := RESULT_U8BIT;
  268. end;
  269. procedure proc_const_smallarray_open(const arr : array of byte);
  270. begin
  271. { form 0 to N-1 indexes in open arrays }
  272. if arr[SMALL_INDEX-1] = RESULT_U8BIT then
  273. global_u8bit := RESULT_U8BIT;
  274. end;
  275. procedure proc_const_formaldef_array(const buf);
  276. var
  277. p: pchar;
  278. begin
  279. { array is indexed from 1 }
  280. p := @buf;
  281. global_u8bit := byte(p[SMALL_INDEX-1]);
  282. end;
  283. {************************************************************************}
  284. { MIXED CONST PARAMETERS }
  285. {************************************************************************}
  286. procedure proc_const_s32bit_mixed(b1: byte; const v : longint; b2: byte);
  287. begin
  288. global_s32bit := v;
  289. value_u8bit := b2;
  290. end;
  291. {$ifndef tp}
  292. procedure proc_const_s64bit_mixed(b1 : byte; const v: int64; b2: byte);
  293. begin
  294. global_s64bit:= v;
  295. value_u8bit := b2;
  296. end;
  297. procedure proc_const_smallarray_const_1_mixed(b1 : byte; const arr : array of const; b2: byte);
  298. var
  299. i: integer;
  300. begin
  301. for i:=0 to high(arr) do
  302. begin
  303. case arr[i].vtype of
  304. vtInteger : global_u8bit := arr[i].vinteger and $ff;
  305. vtBoolean : global_boolean := arr[i].vboolean;
  306. vtChar : global_char := arr[i].vchar;
  307. vtExtended : global_s64real := arr[i].VExtended^;
  308. vtString : global_bigstring := arr[i].VString^;
  309. vtPointer : ;
  310. vtPChar : global_ptr := arr[i].VPchar;
  311. vtObject : ;
  312. { vtClass : global_class := (arr[i].VClass) as tclass1;}
  313. vtAnsiString : ;
  314. vtInt64 : global_s64bit := arr[i].vInt64^;
  315. else
  316. RunError(255);
  317. end;
  318. end; {endfor}
  319. value_u8bit := b2;
  320. end;
  321. procedure proc_const_smallarray_const_2_mixed(b1: byte; const arr : array of const; b2: byte);
  322. var
  323. i: integer;
  324. begin
  325. if high(arr)<0 then
  326. global_u8bit := RESULT_U8BIT;
  327. value_u8bit := b2;
  328. end;
  329. {$endif}
  330. procedure proc_const_smallrecord_mixed(b1 : byte; const smallrec : tsmallrecord; b2: byte);
  331. begin
  332. if (smallrec.b = RESULT_U8BIT) and (smallrec.w = RESULT_U16BIT) then
  333. global_u8bit := RESULT_U8BIT;
  334. value_u8bit := b2;
  335. end;
  336. procedure proc_const_largerecord_mixed(b1: byte; const largerec : tlargerecord; b2: byte);
  337. begin
  338. if (largerec.b[1] = RESULT_U8BIT) and (largerec.b[2] = RESULT_U8BIT) then
  339. global_u8bit := RESULT_U8BIT;
  340. value_u8bit := b2;
  341. end;
  342. procedure proc_const_smallset_mixed(b1: byte; const smallset : tsmallset; b2: byte);
  343. begin
  344. if A_D in smallset then
  345. global_u8bit := RESULT_U8BIT;
  346. value_u8bit := b2;
  347. end;
  348. procedure proc_const_largeset_mixed(b1: byte; const largeset : tlargeset; b2: byte);
  349. begin
  350. if 'I' in largeset then
  351. global_u8bit := RESULT_U8BIT;
  352. value_u8bit := b2;
  353. end;
  354. procedure proc_const_smallstring_mixed(b1: byte; const s:tsmallstring; b2: byte);
  355. begin
  356. if s = RESULT_SMALLSTRING then
  357. global_u8bit := RESULT_u8BIT;
  358. value_u8bit := b2;
  359. end;
  360. procedure proc_const_bigstring_mixed(b1: byte; const s:shortstring; b2: byte);
  361. begin
  362. if s = RESULT_BIGSTRING then
  363. global_u8bit := RESULT_u8BIT;
  364. value_u8bit := b2;
  365. end;
  366. procedure proc_const_smallarray_mixed(b1: byte; const arr : tsmallarray; b2: byte);
  367. begin
  368. if arr[SMALL_INDEX] = RESULT_U8BIT then
  369. global_u8bit := RESULT_U8BIT;
  370. value_u8bit := b2;
  371. end;
  372. procedure proc_const_smallarray_open_mixed(b1: byte; const arr : array of byte; b2: byte);
  373. begin
  374. { form 0 to N-1 indexes in open arrays }
  375. if arr[high(arr)] = RESULT_U8BIT then
  376. global_u8bit := RESULT_U8BIT;
  377. value_u8bit := b2;
  378. end;
  379. procedure proc_const_formaldef_array_mixed(b1: byte; const buf; b2: byte);
  380. var
  381. p: pchar;
  382. begin
  383. { array is indexed from 1 }
  384. p := @buf;
  385. global_u8bit := byte(p[SMALL_INDEX-1]);
  386. value_u8bit := b2;
  387. end;
  388. var
  389. failed: boolean;
  390. pp : ^pchar;
  391. begin
  392. {***************************** NORMAL TESTS *******************************}
  393. write('Const parameter test (src : LOC_REGISTER (orddef)))...');
  394. clear_globals;
  395. clear_values;
  396. failed:=false;
  397. proc_const_s32bit(gets32bit);
  398. if global_s32bit <> RESULT_S32BIT then
  399. failed:=true;
  400. {$ifndef tp}
  401. proc_const_s64bit(gets64bit);
  402. if global_s64bit <> RESULT_S64BIT then
  403. failed:=true;
  404. {$endif}
  405. if failed then
  406. fail
  407. else
  408. WriteLn('Passed!');
  409. write('Const parameter test (src : LOC_REFERENCE (recorddef)))...');
  410. clear_globals;
  411. clear_values;
  412. failed := false;
  413. value_smallrec.b := RESULT_U8BIT;
  414. value_smallrec.w := RESULT_U16BIT;
  415. proc_const_smallrecord(value_smallrec);
  416. if global_u8bit <> RESULT_U8BIT then
  417. failed := true;
  418. clear_globals;
  419. clear_values;
  420. fillchar(value_largerec,sizeof(value_largerec),RESULT_U8BIT);
  421. proc_const_largerecord(value_largerec);
  422. if global_u8bit <> RESULT_U8BIT then
  423. failed := true;
  424. if failed then
  425. fail
  426. else
  427. WriteLn('Passed!');
  428. write('const parameter test (src : LOC_REFERENCE (setdef)))...');
  429. clear_globals;
  430. clear_values;
  431. failed := false;
  432. value_smallset := [A_A,A_D];
  433. proc_const_smallset(value_smallset);
  434. if global_u8bit <> RESULT_U8BIT then
  435. failed := true;
  436. clear_globals;
  437. clear_values;
  438. value_largeset := ['I'];
  439. proc_const_largeset(value_largeset);
  440. if global_u8bit <> RESULT_U8BIT then
  441. failed := true;
  442. if failed then
  443. fail
  444. else
  445. WriteLn('Passed!');
  446. write('const parameter test (src : LOC_REFERENCE (stringdef)))...');
  447. clear_globals;
  448. clear_values;
  449. failed := false;
  450. value_smallstring := RESULT_SMALLSTRING;
  451. proc_const_smallstring(value_smallstring);
  452. if global_u8bit <> RESULT_U8BIT then
  453. failed := true;
  454. clear_globals;
  455. clear_values;
  456. value_bigstring := RESULT_BIGSTRING;
  457. proc_const_bigstring(value_bigstring);
  458. if global_u8bit <> RESULT_U8BIT then
  459. failed := true;
  460. if failed then
  461. fail
  462. else
  463. WriteLn('Passed!');
  464. write('Const parameter test (src : LOC_REFERENCE (formaldef)))...');
  465. clear_globals;
  466. clear_values;
  467. failed:=false;
  468. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  469. proc_const_formaldef_array(value_smallarray);
  470. if global_u8bit <> RESULT_U8BIT then
  471. failed := true;
  472. if failed then
  473. fail
  474. else
  475. WriteLn('Passed!');
  476. write('Const parameter test (src : LOC_REFERENCE (arraydef)))...');
  477. clear_globals;
  478. clear_values;
  479. failed:=false;
  480. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  481. proc_const_smallarray(value_smallarray);
  482. if global_u8bit <> RESULT_U8BIT then
  483. failed := true;
  484. clear_globals;
  485. clear_values;
  486. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  487. proc_const_smallarray_open(value_smallarray);
  488. if global_u8bit <> RESULT_U8BIT then
  489. failed := true;
  490. {$ifndef tp}
  491. clear_globals;
  492. clear_values;
  493. value_u8bit := RESULT_U8BIT;
  494. value_ptr := RESULT_PCHAR;
  495. value_s64bit := RESULT_S64BIT;
  496. value_smallstring := RESULT_SMALLSTRING;
  497. value_class := tclass1.create;
  498. value_boolean := RESULT_BOOLEAN;
  499. value_char := RESULT_CHAR;
  500. value_s64real:=RESULT_S64REAL;
  501. proc_const_smallarray_const_1([value_u8bit,value_ptr,value_s64bit,value_char,value_smallstring,value_s64real,
  502. value_boolean,value_class]);
  503. if global_u8bit <> RESULT_U8BIT then
  504. failed := true;
  505. if global_char <> RESULT_CHAR then
  506. failed := true;
  507. if global_boolean <> RESULT_BOOLEAN then
  508. failed:=true;
  509. if trunc(global_s64real) <> trunc(RESULT_S64REAL) then
  510. failed := true;
  511. if global_bigstring <> RESULT_SMALLSTRING then
  512. failed := true;
  513. if global_ptr <> value_ptr then
  514. failed := true;
  515. { if value_class <> global_class then
  516. failed := true;!!!!!!!!!!!!!!!!!!!!}
  517. if global_s64bit <> RESULT_S64BIT then
  518. failed := true;
  519. if assigned(value_class) then
  520. value_class.destroy;
  521. global_u8bit := 0;
  522. proc_const_smallarray_const_2([]);
  523. if global_u8bit <> RESULT_U8BIT then
  524. failed := true;
  525. {$endif}
  526. if failed then
  527. fail
  528. else
  529. WriteLn('Passed!');
  530. {***************************** MIXED TESTS *******************************}
  531. write('Mixed const parameter test (src : LOC_REGISTER (orddef)))...');
  532. clear_globals;
  533. clear_values;
  534. failed:=false;
  535. proc_const_s32bit_mixed(RESULT_U8BIT,gets32bit,RESULT_U8BIT);
  536. if global_s32bit <> RESULT_S32BIT then
  537. failed:=true;
  538. if value_u8bit <> RESULT_U8BIT then
  539. failed := true;
  540. {$ifndef tp}
  541. proc_const_s64bit_mixed(RESULT_U8BIT,gets64bit,RESULT_U8BIT);
  542. if global_s64bit <> RESULT_S64BIT then
  543. failed:=true;
  544. if value_u8bit <> RESULT_U8BIT then
  545. failed := true;
  546. {$endif}
  547. if failed then
  548. fail
  549. else
  550. WriteLn('Passed!');
  551. write('Mixed const parameter test (src : LOC_REFERENCE (recorddef)))...');
  552. clear_globals;
  553. clear_values;
  554. failed := false;
  555. value_smallrec.b := RESULT_U8BIT;
  556. value_smallrec.w := RESULT_U16BIT;
  557. proc_const_smallrecord_mixed(RESULT_U8BIT,value_smallrec,RESULT_U8BIT);
  558. if global_u8bit <> RESULT_U8BIT then
  559. failed := true;
  560. if value_u8bit <> RESULT_U8BIT then
  561. failed := true;
  562. clear_globals;
  563. clear_values;
  564. fillchar(value_largerec,sizeof(value_largerec),RESULT_U8BIT);
  565. proc_const_largerecord_mixed(RESULT_U8BIT,value_largerec,RESULT_U8BIT);
  566. if global_u8bit <> RESULT_U8BIT then
  567. failed := true;
  568. if value_u8bit <> RESULT_U8BIT then
  569. failed := true;
  570. if failed then
  571. fail
  572. else
  573. WriteLn('Passed!');
  574. write('Mixed const parameter test (src : LOC_REFERENCE (setdef)))...');
  575. clear_globals;
  576. clear_values;
  577. failed := false;
  578. value_smallset := [A_A,A_D];
  579. proc_const_smallset_mixed(RESULT_U8BIT,value_smallset,RESULT_U8BIT);
  580. if global_u8bit <> RESULT_U8BIT then
  581. failed := true;
  582. if value_u8bit <> RESULT_U8BIT then
  583. failed := true;
  584. clear_globals;
  585. clear_values;
  586. value_largeset := ['I'];
  587. proc_const_largeset_mixed(RESULT_U8BIT,value_largeset,RESULT_U8BIT);
  588. if global_u8bit <> RESULT_U8BIT then
  589. failed := true;
  590. if value_u8bit <> RESULT_U8BIT then
  591. failed := true;
  592. if failed then
  593. fail
  594. else
  595. WriteLn('Passed!');
  596. write('Mixed const parameter test (src : LOC_REFERENCE (stringdef)))...');
  597. clear_globals;
  598. clear_values;
  599. failed := false;
  600. value_smallstring := RESULT_SMALLSTRING;
  601. proc_const_smallstring_mixed(RESULT_U8BIT,value_smallstring,RESULT_U8BIT);
  602. if global_u8bit <> RESULT_U8BIT then
  603. failed := true;
  604. if value_u8bit <> RESULT_U8BIT then
  605. failed := true;
  606. clear_globals;
  607. clear_values;
  608. value_bigstring := RESULT_BIGSTRING;
  609. proc_const_bigstring_mixed(RESULT_U8BIT,value_bigstring,RESULT_U8BIT);
  610. if global_u8bit <> RESULT_U8BIT then
  611. failed := true;
  612. if value_u8bit <> RESULT_U8BIT then
  613. failed := true;
  614. if failed then
  615. fail
  616. else
  617. WriteLn('Passed!');
  618. write('Mixed const parameter test (src : LOC_REFERENCE (formaldef)))...');
  619. clear_globals;
  620. clear_values;
  621. failed:=false;
  622. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  623. proc_const_formaldef_array_mixed(RESULT_U8BIT,value_smallarray,RESULT_U8BIT);
  624. if global_u8bit <> RESULT_U8BIT then
  625. failed := true;
  626. if value_u8bit <> RESULT_U8BIT then
  627. failed := true;
  628. if failed then
  629. fail
  630. else
  631. WriteLn('Passed!');
  632. write('Mixed const parameter test (src : LOC_REFERENCE (arraydef)))...');
  633. clear_globals;
  634. clear_values;
  635. failed:=false;
  636. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  637. proc_const_smallarray_mixed(RESULT_U8BIt,value_smallarray,RESULT_U8BIT);
  638. if global_u8bit <> RESULT_U8BIT then
  639. failed := true;
  640. if value_u8bit <> RESULT_U8BIT then
  641. failed := true;
  642. clear_globals;
  643. clear_values;
  644. value_smallarray[SMALL_INDEX] := RESULT_U8BIT;
  645. proc_const_smallarray_open_mixed(RESULT_U8BIT,value_smallarray,RESULT_U8BIT);
  646. if global_u8bit <> RESULT_U8BIT then
  647. failed := true;
  648. if value_u8bit <> RESULT_U8BIT then
  649. failed := true;
  650. {$ifndef tp}
  651. clear_globals;
  652. clear_values;
  653. value_u8bit := RESULT_U8BIT;
  654. value_ptr := RESULT_PCHAR;
  655. value_s64bit := RESULT_S64BIT;
  656. value_smallstring := RESULT_SMALLSTRING;
  657. value_class := tclass1.create;
  658. value_boolean := RESULT_BOOLEAN;
  659. value_char := RESULT_CHAR;
  660. value_s64real:=RESULT_S64REAL;
  661. proc_const_smallarray_const_1_mixed(RESULT_U8BIT, [value_u8bit,value_ptr,value_s64bit,value_char,value_smallstring,
  662. value_s64real,value_boolean,value_class],RESULT_U8BIT);
  663. if global_u8bit <> RESULT_U8BIT then
  664. failed := true;
  665. if global_char <> RESULT_CHAR then
  666. failed := true;
  667. if global_boolean <> RESULT_BOOLEAN then
  668. failed:=true;
  669. if trunc(global_s64real) <> trunc(RESULT_S64REAL) then
  670. failed := true;
  671. if global_bigstring <> RESULT_SMALLSTRING then
  672. failed := true;
  673. if global_ptr <> value_ptr then
  674. failed := true;
  675. { if value_class <> global_class then
  676. failed := true;!!!!!!!!!!!!!!!!!!!!}
  677. if global_s64bit <> RESULT_S64BIT then
  678. failed := true;
  679. if assigned(value_class) then
  680. value_class.destroy;
  681. if value_u8bit <> RESULT_U8BIT then
  682. failed := true;
  683. global_u8bit := 0;
  684. proc_const_smallarray_const_2_mixed(RESULT_U8BIT,[],RESULT_U8BIT);
  685. if global_u8bit <> RESULT_U8BIT then
  686. failed := true;
  687. if value_u8bit <> RESULT_U8BIT then
  688. failed := true;
  689. {$endif}
  690. if failed then
  691. fail
  692. else
  693. WriteLn('Passed!');
  694. end.