tset3.pp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. program tset3;
  2. {$modeswitch exceptions}
  3. uses
  4. jdk15;
  5. {$macro on}
  6. {$define writeln:=JLSystem.fout.println}
  7. {$define write:=JLSystem.fout.print}
  8. {$packset 1}
  9. type
  10. tmini = 0..7;
  11. tminiset = set of tmini;
  12. procedure do_error(w : word);
  13. begin
  14. write('Error: ');
  15. writeln(w);
  16. raise jlexception.create('error!');
  17. end;
  18. {$ifdef proc}
  19. procedure testit;
  20. {$endif}
  21. var
  22. s1,s2,s3 : tminiset;
  23. b : byte;
  24. m : tmini;
  25. begin
  26. s1:=[];
  27. if s1<>[] then
  28. do_error(1);
  29. s1:=[1];
  30. if s1<>[1] then
  31. do_error(2);
  32. s2:=[2,3];
  33. if s2<>[2,3] then
  34. do_error(3);
  35. b:=6;
  36. s3:=[b,7];
  37. if s3<>[6,7] then
  38. do_error(4);
  39. s1:=s1+s2;
  40. if s1<>[1..3] then
  41. do_error(5);
  42. s2:=s1;
  43. if not(s1=s2) then
  44. do_error(6);
  45. s3:=[4];
  46. include(s1,4);
  47. if s1<>[1..4] then
  48. do_error(7);
  49. s2:=s1;
  50. exclude(s1,4);
  51. if s1<>[1..3] then
  52. do_error(8);
  53. s2:=s2-s3;
  54. if s1<>s2 then
  55. do_error(9);
  56. b:=4;
  57. include(s1,b);
  58. if s1<>[1..4] then
  59. do_error(10);
  60. s2:=s2+[b];
  61. if s1<>s2 then
  62. do_error(11);
  63. s2:=s1;
  64. m:=3;
  65. s1:=s1-[m];
  66. exclude(s2,m);
  67. if s1<>s2 then
  68. do_error(12);
  69. writeln('ok');
  70. {$ifdef proc}
  71. end;
  72. begin
  73. testit;
  74. {$endif}
  75. end.