2
0

taddset3.pp 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. {$ifdef fpc}
  2. {$packset 1}
  3. {$endif}
  4. {****************************************************************}
  5. { CODE GENERATOR TEST PROGRAM }
  6. {****************************************************************}
  7. { NODE TESTED : secondadd() }
  8. {****************************************************************}
  9. { PRE-REQUISITES: secondload() }
  10. { secondassign() }
  11. { secondsetelement() }
  12. {****************************************************************}
  13. { DEFINES: }
  14. { FPC = Target is FreePascal compiler }
  15. {****************************************************************}
  16. { REMARKS: }
  17. { }
  18. { }
  19. { }
  20. {****************************************************************}
  21. Program tneg;
  22. var
  23. Err : boolean;
  24. type
  25. { DO NOT CHANGE THE VALUES OF THESE ENUMERATIONS! }
  26. tsmallenum = (dA=23,dB,dC,dd,de,df,dg,dh,di,dj,dk,dl,dm,dn,dop,dp,dq,dr);
  27. tsmallsubenum = dk..dr;
  28. tasmop = (A_ABCD=13,
  29. A_ADD,A_ADDA,A_ADDI,A_ADDQ,A_ADDX,A_AND,A_ANDI,
  30. A_ASL,A_ASR,A_BCC,A_BCS,A_BEQ,A_BGE,A_BGT,A_BHI,
  31. A_BLE,A_BLS,A_BLT,A_BMI,A_BNE,A_BPL,A_BVC,A_BVS,
  32. A_BCHG,A_BCLR,A_BRA,A_BSET,A_BSR,A_BTST,A_CHK,
  33. A_CLR,A_CMP,A_CMPA,A_CMPI,A_CMPM,A_DBCC,A_DBCS,A_DBEQ,A_DBGE,
  34. A_DBGT,A_DBHI,A_DBLE,A_DBLS,A_DBLT,A_DBMI,A_DBNE,A_DBRA,
  35. A_DBPL,A_DBT,A_DBVC,A_DBVS,A_DBF,A_DIVS,A_DIVU,
  36. A_EOR,A_EORI,A_EXG,A_ILLEGAL,A_EXT,A_JMP,A_JSR,
  37. A_LEA,A_LINK,A_LSL,A_LSR,A_MOVE,A_MOVEA,A_MOVEI,A_MOVEQ,
  38. A_MOVEM,A_MOVEP,A_MULS,A_MULU,A_NBCD,A_NEG,A_NEGX,
  39. A_NOP,A_NOT,A_OR,A_ORI,A_PEA,A_ROL,A_ROR,A_ROXL,
  40. A_ROXR,A_RTR,A_RTS,A_SBCD,A_SCC,A_SCS,A_SEQ,A_SGE,
  41. A_SGT,A_SHI,A_SLE,A_SLS,A_SLT,A_SMI,A_SNE,
  42. A_SPL,A_ST,A_SVC,A_SVS,A_SF,A_SUB,A_SUBA,A_SUBI,A_SUBQ,
  43. A_SUBX,A_SWAP,A_TAS,A_TRAP,A_TRAPV,A_TST,A_UNLK,
  44. A_RTE,A_RESET,A_STOP,
  45. { MC68010 instructions }
  46. A_BKPT,A_MOVEC,A_MOVES,A_RTD,
  47. { MC68020 instructions }
  48. A_BFCHG,A_BFCLR,A_BFEXTS,A_BFEXTU,A_BFFFO,
  49. A_BFINS,A_BFSET,A_BFTST,A_CALLM,A_CAS,A_CAS2,
  50. A_CHK2,A_CMP2,A_DIVSL,A_DIVUL,A_EXTB,A_PACK,A_RTM,
  51. A_TRAPCC,A_TRACS,A_TRAPEQ,A_TRAPF,A_TRAPGE,A_TRAPGT,
  52. A_TRAPHI,A_TRAPLE,A_TRAPLS,A_TRAPLT,A_TRAPMI,A_TRAPNE,
  53. A_TRAPPL,A_TRAPT,A_TRAPVC,A_TRAPVS,A_UNPK,
  54. { FPU Processor instructions - directly supported only. }
  55. { IEEE aware and misc. condition codes not supported }
  56. A_FABS,A_FADD,
  57. A_FBEQ,A_FBNE,A_FBNGT,A_FBGT,A_FBGE,A_FBNGE,
  58. A_FBLT,A_FBNLT,A_FBLE,A_FBGL,A_FBNGL,A_FBGLE,A_FBNGLE,
  59. A_FDBEQ,A_FDBNE,A_FDBGT,A_FDBNGT,A_FDBGE,A_FDBNGE,
  60. A_FDBLT,A_FDBNLT,A_FDBLE,A_FDBGL,A_FDBNGL,A_FDBGLE,A_FBDNGLE,
  61. A_FSEQ,A_FSNE,A_FSGT,A_FSNGT,A_FSGE,A_FSNGE,
  62. A_FSLT,A_FSNLT,A_FSLE,A_FSGL,A_FSNGL,A_FSGLE,A_FSNGLE,
  63. A_FCMP,A_FDIV,A_FMOVE,A_FMOVEM,
  64. A_FMUL,A_FNEG,A_FNOP,A_FSQRT,A_FSUB,A_FSGLDIV,
  65. A_FSFLMUL,A_FTST,
  66. A_FTRAPEQ,A_FTRAPNE,A_FTRAPGT,A_FTRAPNGT,A_FTRAPGE,A_FTRAPNGE,
  67. A_FTRAPLT,A_FTRAPNLT,A_FTRAPLE,A_FTRAPGL,A_FTRAPNGL,A_FTRAPGLE,A_FTRAPNGLE,
  68. { Protected instructions }
  69. A_CPRESTORE,A_CPSAVE,
  70. { FPU Unit protected instructions }
  71. { and 68030/68851 common MMU instructions }
  72. { (this may include 68040 MMU instructions) }
  73. A_FRESTORE,A_FSAVE,A_PFLUSH,A_PFLUSHA,A_PLOAD,A_PMOVE,A_PTEST,
  74. { Useful for assembly langage output }
  75. A_LABEL,A_NONE);
  76. tsubasmop = A_BFINS..A_FSEQ;
  77. tsubasmop2 = A_BCS..A_BHI;
  78. type
  79. topset = set of tasmop;
  80. tsubopset = set of tsubasmop;
  81. tsmallset = set of tsmallenum;
  82. tsubsmallset = set of tsmallsubenum;
  83. const
  84. { NORMAL SETS }
  85. constset1 : array[1..3] of topset =
  86. (
  87. { 66 } { 210 } { 225 }
  88. ([A_MOVE, { 66 : LONG 2 - BIT 2 }
  89. A_FTST, { 210 : LONG 6 - BIT 18 }
  90. A_CPSAVE]),{ 225 : LONG 7 - BIT 1 }
  91. { 1..8 }
  92. ([A_ADD..A_ASL]),
  93. { 134 }
  94. ([A_CHK2])
  95. );
  96. constset2 : array[1..4] of topset =
  97. (
  98. ([A_MOVE,A_FTST,A_CPSAVE]),
  99. ([A_ADD..A_ASL]),
  100. ([A_CHK2]),
  101. ([A_CMP2,A_TRAPVC,A_FADD])
  102. );
  103. { SMALL SETS }
  104. constset3 : array[1..3] of tsmallset =
  105. (
  106. ([DA, { 0 : LONG 0 : bit 0 }
  107. DD, { 3 : LONG 0 : bit 3 }
  108. DM]), { 12 : LONG 0 : bit 12 }
  109. ([DB..DI]), { 1..8 : LONG 0 : bits 1-8 }
  110. ([DR]) { 17 : LONG 0 : bit 17 }
  111. );
  112. constset4 : array[1..3] of tsmallset =
  113. (
  114. ([DA,DD,DM]),
  115. ([DB..DI]),
  116. ([DR])
  117. );
  118. constsubset1: array[1..1] of tsubopset =
  119. (
  120. ([A_CMP2,A_TRAPVC,A_FADD])
  121. );
  122. procedure CheckPassed(passed:boolean);
  123. begin
  124. if passed then
  125. WriteLn('Success.')
  126. else
  127. begin
  128. WriteLn('Failure.');
  129. Halt(1);
  130. Err:=true;
  131. end;
  132. end;
  133. procedure SetTestEqual;
  134. { FPC_SET_COMP_SETS }
  135. var
  136. op2list :set of tasmop;
  137. oplist: set of tasmop;
  138. soplist : tsubopset;
  139. soplist2: set of tsubasmop2;
  140. passed : boolean;
  141. Begin
  142. Write('Normal Set == Normal Set test...');
  143. passed := true;
  144. op2list:=[];
  145. oplist:=[];
  146. soplist:=[];
  147. soplist2:=[];
  148. if not (oplist=op2list) then
  149. passed := false;
  150. if not (soplist=op2list) then
  151. passed := false;
  152. if not(soplist=soplist2) then
  153. passed:=false;
  154. if not (constset1[2] = constset2[2]) then
  155. passed := false;
  156. if not(constset2[4] = constsubset1[1]) then
  157. passed:=false;
  158. if (constset1[1] = constset2[2]) then
  159. passed := false;
  160. if (constset1[1] = constsubset1[1]) then
  161. passed := false;
  162. if soplist2 = constsubset1[1] then
  163. passed:=false;
  164. if not (constset1[1] = [A_MOVE,A_FTST,A_CPSAVE]) then
  165. passed := false;
  166. if not (constsubset1[1] = [A_CMP2,A_TRAPVC,A_FADD]) then
  167. passed := false;
  168. CheckPassed(passed);
  169. end;
  170. procedure SetTestNotEqual;
  171. { FPC_SET_COMP_SETS }
  172. var
  173. op2list :set of tasmop;
  174. oplist: set of tasmop;
  175. soplist: set of tsubasmop;
  176. passed : boolean;
  177. Begin
  178. Write('Normal Set <> Normal Set test...');
  179. passed := true;
  180. op2list:=[];
  181. oplist:=[];
  182. soplist:=[];
  183. if not (oplist=op2list) then
  184. passed := false;
  185. if not (oplist=soplist) then
  186. passed := false;
  187. if (constset1[2] <> constset2[2]) then
  188. passed := false;
  189. if not (constset1[1] <> constset2[2]) then
  190. passed := false;
  191. { if ( [A_ADD] <> [A_ADD] ) then optimized out.
  192. passed := false;
  193. if ( [A_BLE..A_BPL] <> [A_BLE..A_BPL] ) then
  194. passed := false; }
  195. if (constset1[1] <> [A_MOVE,A_FTST,A_CPSAVE]) then
  196. passed := false;
  197. CheckPassed(passed);
  198. end;
  199. procedure SetTestLt;
  200. var
  201. op2list :set of tasmop;
  202. oplist: set of tasmop;
  203. soplist : tsubopset;
  204. soplist2: set of tsubasmop2;
  205. passed : boolean;
  206. begin
  207. Write('Normal Set <= Normal Set test...');
  208. passed := true;
  209. if constset1[1] <= constset2[2] then
  210. passed := false;
  211. if constset1[1] <= constsubset1[1] then
  212. passed := false;
  213. oplist := [];
  214. op2list := [A_MOVE];
  215. if op2list <= oplist then
  216. passed := false;
  217. oplist := [A_MOVE,A_CPRESTORE..A_CPSAVE];
  218. if oplist <= op2list then
  219. passed := false;
  220. soplist2:=[A_BHI];
  221. soplist:=[A_BFINS..A_FSEQ];
  222. if soplist2<=soplist then
  223. passed:=false;
  224. CheckPassed(passed);
  225. end;
  226. Procedure SetTestAddOne;
  227. { FPC_SET_SET_BYTE }
  228. { FPC_SET_ADD_SETS }
  229. var
  230. op : tasmop;
  231. sop : tsubasmop;
  232. sop2: tsubasmop2;
  233. oplist: set of tasmop;
  234. soplist: set of tsubasmop;
  235. soplist2, soplist3: set of tsubasmop2;
  236. passed: boolean;
  237. Begin
  238. Write('Set + Set element testing...');
  239. passed:=true;
  240. op:=A_LABEL;
  241. oplist:=[];
  242. oplist:=oplist+[op];
  243. if oplist<>[A_LABEL] then
  244. passed:=false;
  245. sop:=A_UNPK;
  246. oplist:=[];
  247. oplist:=[sop];
  248. if oplist<>[A_UNPK] then
  249. passed:=false;
  250. soplist:=[];
  251. op:=A_UNPK;
  252. soplist:=[op];
  253. if soplist<>[A_UNPK] then
  254. passed:=false;
  255. soplist:=[];
  256. op:=A_FBLE;
  257. sop:=A_FABS;
  258. soplist:=[op,sop];
  259. if soplist<>[A_FBLE,A_FABS] then
  260. passed:=false;
  261. soplist:=[];
  262. soplist:=[sop,op];
  263. if soplist<>[A_FBLE,A_FABS] then
  264. passed:=false;
  265. oplist:=[];
  266. oplist:=soplist+[A_FADD];
  267. if (oplist<>[A_FBLE,A_FABS,A_FADD]) then
  268. passed:=false;
  269. oplist:=[];
  270. sop:=A_UNPK;
  271. oplist:=soplist+[sop];
  272. if (oplist<>[A_FBLE,A_FABS,A_UNPK]) then
  273. passed:=false;
  274. soplist2:=[];
  275. oplist:=soplist2+[A_BGE];
  276. if (oplist<>[A_BGE]) then
  277. passed:=false;
  278. include(soplist2,A_BGT);
  279. oplist:=soplist2-[A_BHI];
  280. if (oplist<>[A_BGT]) then
  281. passed:=false;
  282. soplist3:=[A_BGT,A_BHI];
  283. oplist:=soplist2*soplist3;
  284. if (oplist<>[A_BGT]) then
  285. passed:=false;
  286. sop2:=A_BHI;
  287. oplist:=[sop2];
  288. if (oplist<>[A_BHI]) then
  289. passed:=false;
  290. CheckPassed(passed);
  291. end;
  292. Procedure SetTestAddTwo;
  293. { SET_ADD_SETS }
  294. var
  295. op2list :set of tasmop;
  296. oplist: set of tasmop;
  297. Begin
  298. Write('Complex Set + Set element testing...');
  299. op2list:=[];
  300. oplist:=[];
  301. oplist:=[A_MOVE]+[A_JSR];
  302. op2list:=[A_LABEL];
  303. oplist:=op2list+oplist;
  304. CheckPassed(oplist = [A_MOVE,A_JSR,A_LABEL]);
  305. end;
  306. Procedure SetTestSubOne;
  307. { SET_SUB_SETS }
  308. var
  309. op2list :set of tasmop;
  310. oplist: set of tasmop;
  311. op :tasmop;
  312. passed : boolean;
  313. Begin
  314. Write('Set - Set element testing...');
  315. passed := true;
  316. op2list:=[];
  317. oplist:=[];
  318. op := A_TRACS;
  319. oplist:=[A_MOVE]+[A_JSR]+[op];
  320. op2list:=[A_MOVE]+[A_JSR];
  321. oplist:=oplist-op2list;
  322. if oplist <> [A_TRACS] then
  323. passed := false;
  324. oplist:=[A_MOVE]+[A_JSR]+[op];
  325. op2list:=[A_MOVE]+[A_JSR];
  326. oplist:=op2list-oplist;
  327. if oplist <> [] then
  328. passed := false;
  329. CheckPassed(passed);
  330. end;
  331. Procedure SetTestSubTwo;
  332. { FPC_SET_SUB_SETS }
  333. const
  334. b: tasmop = (A_BSR);
  335. var
  336. op2list :set of tasmop;
  337. oplist: set of tasmop;
  338. op : tasmop;
  339. passed : boolean;
  340. Begin
  341. Write('Complex Set - Set element testing...');
  342. op := A_BKPT;
  343. passed := true;
  344. oplist:=[A_MOVE]+[A_JSR]-[op];
  345. op2list:=[A_MOVE]+[A_JSR];
  346. if oplist <> op2list then
  347. passed := false;
  348. oplist := [A_MOVE];
  349. oplist := oplist - [A_MOVE];
  350. if oplist <> [] then
  351. passed := false;
  352. oplist := oplist + [b];
  353. if oplist <> [b] then
  354. passed := false;
  355. oplist := oplist - [b];
  356. if oplist <> [] then
  357. passed := false;
  358. CheckPassed(passed);
  359. end;
  360. Procedure SetTestMulSets;
  361. { FPC_SET_MUL_SETS }
  362. var
  363. op2list :set of tasmop;
  364. oplist: set of tasmop;
  365. passed : boolean;
  366. Begin
  367. passed := true;
  368. Write('Set * Set element testing...');
  369. op2list:=[];
  370. oplist:=[];
  371. oplist:=[A_MOVE]+[A_JSR];
  372. op2list:=[A_MOVE];
  373. oplist:=oplist*op2list;
  374. if oplist <> [A_JSR] then
  375. passed := false;
  376. oplist := [A_MOVE,A_FTST];
  377. op2list := [A_MOVE,A_FTST];
  378. oplist := oplist * op2list;
  379. if oplist <> [A_MOVE,A_FTST] then
  380. passed := false;
  381. CheckPassed(passed);
  382. end;
  383. procedure SetTestRange;
  384. var
  385. op2list :set of tasmop;
  386. oplist: set of tasmop;
  387. passed : boolean;
  388. op1 : tasmop;
  389. op2 : tasmop;
  390. begin
  391. passed := true;
  392. Write('Range Set + element testing...');
  393. op1 := A_ADD;
  394. op2 := A_ASL;
  395. oplist := [];
  396. oplist := [op1..op2];
  397. if oplist <> constset1[2] then
  398. passed := false;
  399. CheckPassed(passed);
  400. end;
  401. procedure SetTestByte;
  402. var
  403. op2list :set of tasmop;
  404. oplist: set of tasmop;
  405. passed : boolean;
  406. op1 : tasmop;
  407. op2 : tasmop;
  408. op : tasmop;
  409. begin
  410. Write('Simple Set + element testing...');
  411. passed := true;
  412. op := A_LABEL;
  413. oplist := [A_MOVE,op,A_JSR];
  414. if oplist <> [A_MOVE,A_LABEL,A_JSR] then
  415. passed := false;
  416. CheckPassed(passed);
  417. end;
  418. {------------------------------ TESTS FOR SMALL VALUES ---------------------}
  419. procedure SmallSetTestEqual;
  420. var
  421. op2list :set of tsmallenum;
  422. oplist: set of tsmallenum;
  423. passed : boolean;
  424. Begin
  425. Write('Small Set == Small Set test...');
  426. passed := true;
  427. op2list:=[];
  428. oplist:=[];
  429. if not (oplist=op2list) then
  430. passed := false;
  431. if not (constset3[2] = constset4[2]) then
  432. passed := false;
  433. if (constset3[1] = constset4[2]) then
  434. passed := false;
  435. if not (constset3[1] = [DA,DD,DM]) then
  436. passed := false;
  437. CheckPassed(passed);
  438. end;
  439. procedure SmallSetTestNotEqual;
  440. var
  441. op2list :set of tsmallenum;
  442. oplist: set of tsmallenum;
  443. passed : boolean;
  444. Begin
  445. Write('Small Set <> Small Set test...');
  446. passed := true;
  447. op2list:=[];
  448. oplist:=[];
  449. if not (oplist=op2list) then
  450. passed := false;
  451. if (constset3[2] <> constset4[2]) then
  452. passed := false;
  453. if not (constset3[1] <> constset4[2]) then
  454. passed := false;
  455. { if ( [A_ADD] <> [A_ADD] ) then optimized out.
  456. passed := false;
  457. if ( [A_BLE..A_BPL] <> [A_BLE..A_BPL] ) then
  458. passed := false; }
  459. if (constset3[1] <> [DA,DD,DM]) then
  460. passed := false;
  461. CheckPassed(passed);
  462. end;
  463. procedure SmallSetTestLt;
  464. var
  465. op2list :set of tsmallenum;
  466. oplist: set of tsmallenum;
  467. passed : boolean;
  468. begin
  469. Write('Small Set <= Small Set test...');
  470. passed := true;
  471. if constset3[1] <= constset4[2] then
  472. passed := false;
  473. oplist := [];
  474. op2list := [DC];
  475. if op2list <= oplist then
  476. passed := false;
  477. oplist := [DC,DF..DM];
  478. if oplist <= op2list then
  479. passed := false;
  480. CheckPassed(passed);
  481. end;
  482. Procedure SmallSetTestAddOne;
  483. var
  484. op : tsmallenum;
  485. oplist: set of tsmallenum;
  486. Begin
  487. Write('Small Set + Small Set element testing...');
  488. op:=DG;
  489. oplist:=[];
  490. oplist:=oplist+[op];
  491. CheckPassed( oplist = [DG] );
  492. end;
  493. Procedure SmallSetTestAddTwo;
  494. var
  495. op2list :set of tsmallenum;
  496. oplist: set of tsmallenum;
  497. Begin
  498. Write('Small Complex Set + Small Set element testing...');
  499. op2list:=[];
  500. oplist:=[];
  501. oplist:=[DG]+[DI];
  502. op2list:=[DM];
  503. oplist:=op2list+oplist;
  504. CheckPassed( oplist = [DG,DI,DM] );
  505. end;
  506. Procedure SmallSetTestSubOne;
  507. var
  508. op2list :set of tsmallenum;
  509. oplist: set of tsmallenum;
  510. op :tsmallenum;
  511. passed : boolean;
  512. Begin
  513. Write('Small Set - Small Set element testing...');
  514. passed := true;
  515. op2list:=[];
  516. oplist:=[];
  517. op := DL;
  518. oplist:=[DG]+[DI]+[op];
  519. op2list:=[DG]+[DI];
  520. oplist:=oplist-op2list;
  521. if oplist <> [DL] then
  522. passed := false;
  523. oplist:=[DG]+[DI]+[op];
  524. op2list:=[DG]+[DI];
  525. oplist:=op2list-oplist;
  526. if oplist <> [] then
  527. passed := false;
  528. CheckPassed(passed);
  529. end;
  530. Procedure SmallSetTestSubTwo;
  531. const
  532. b: tsmallenum = (DH);
  533. var
  534. op2list :set of tsmallenum;
  535. oplist: set of tsmallenum;
  536. op : tsmallenum;
  537. passed : boolean;
  538. Begin
  539. Write('Small Complex Set - Small Set element testing...');
  540. op := DL;
  541. passed := true;
  542. oplist:=[DG]+[DI]-[op];
  543. op2list:=[DG]+[DI];
  544. if oplist <> op2list then
  545. passed := false;
  546. oplist := [DG];
  547. oplist := oplist - [DG];
  548. if oplist <> [] then
  549. passed := false;
  550. oplist := oplist + [b];
  551. if oplist <> [b] then
  552. passed := false;
  553. oplist := oplist - [b];
  554. if oplist <> [] then
  555. passed := false;
  556. CheckPassed(passed);
  557. end;
  558. Procedure SmallSetTestMulSets;
  559. var
  560. op2list : set of tsmallenum;
  561. oplist: set of tsmallenum;
  562. passed : boolean;
  563. Begin
  564. passed := true;
  565. Write('Small Set * Small Set element testing...');
  566. op2list:=[];
  567. oplist:=[];
  568. oplist:=[DG]+[DI];
  569. op2list:=[DG];
  570. oplist:=oplist*op2list;
  571. if oplist <> [DI] then
  572. passed := false;
  573. oplist := [DG,DK];
  574. op2list := [DG,DK];
  575. oplist := oplist * op2list;
  576. if oplist <> [DG,DK] then
  577. passed := false;
  578. CheckPassed(passed);
  579. end;
  580. procedure SmallSetTestRange;
  581. var
  582. op2list :set of tsmallenum;
  583. oplist: set of tsmallenum;
  584. passed : boolean;
  585. op1 : tsmallenum;
  586. op2 : tsmallenum;
  587. begin
  588. passed := true;
  589. Write('Small Range Set + element testing...');
  590. op1 := DB;
  591. op2 := DI;
  592. oplist := [];
  593. oplist := [op1..op2];
  594. if oplist <> constset3[2] then
  595. passed := false;
  596. CheckPassed(passed);
  597. end;
  598. procedure SmallSetTestByte;
  599. var
  600. op2list : set of tsmallenum;
  601. oplist: set of tsmallenum;
  602. passed : boolean;
  603. op1 : tsmallenum;
  604. op2 : tsmallenum;
  605. op : tsmallenum;
  606. begin
  607. Write('Small Simple Set + element testing...');
  608. passed := true;
  609. op := DD;
  610. oplist := [DG,op,DI];
  611. if oplist <> [DG,DD,DI] then
  612. passed := false;
  613. CheckPassed(passed);
  614. end;
  615. (*
  616. const
  617. b: myenum = (dA);
  618. var
  619. enum: set of myenum;
  620. oplist: set of tasmop;
  621. l : word;
  622. Begin
  623. SetTestEqual;
  624. SetTestNotEqual;
  625. { small sets }
  626. enum:=[];
  627. { add }
  628. enum:=enum+[da];
  629. { subtract }
  630. enum:=enum-[da];
  631. if DA in enum then
  632. WriteLn('Found A_LABEL');
  633. { very large sets }
  634. { copy loop test }
  635. WRITELN('LARGE SETS:');
  636. oplist := [A_LABEL];
  637. { secondin test }
  638. if A_LABEL in oplist then
  639. WriteLn('TESTING SIMPLE SECOND_IN: PASSED.');
  640. { }
  641. oplist:=[];
  642. if A_LABEL in oplist then
  643. WriteLn('SECOND IN FAILED.');
  644. { SecondinSets;}
  645. SetSetByte;
  646. SetAddSets;
  647. SetSubSets;
  648. SetCompSets;
  649. SetMulSets;
  650. WRITELN('SMALL SETS:');
  651. SmallInSets;
  652. SmallAddSets;
  653. SmallSubSets;
  654. SmallCompSets;
  655. SmallMulSets;
  656. l:=word(A_CPRESTORE);
  657. if l = word(A_CPRESTORE) then
  658. Begin
  659. end;
  660. *)
  661. Begin
  662. WriteLn('----------------------- Normal sets -----------------------');
  663. { Normal sets }
  664. SetTestEqual;
  665. SetTestNotEqual;
  666. SetTestAddOne;
  667. SetTestAddTwo;
  668. SetTestSubOne;
  669. SetTestSubTwo;
  670. SetTestRange;
  671. SetTestLt;
  672. SetTestByte;
  673. { Small sets }
  674. WriteLn('----------------------- Small sets -----------------------');
  675. SmallSetTestEqual;
  676. SmallSetTestNotEqual;
  677. SmallSetTestAddOne;
  678. SmallSetTestAddTwo;
  679. SmallSetTestSubOne;
  680. SmallSetTestSubTwo;
  681. SmallSetTestRange;
  682. SmallSetTestLt;
  683. SmallSetTestByte;
  684. if Err then
  685. Halt(1);
  686. end.