{$e err.log.text}
Program test;

   type
      rec = record
               i1, i2, i3: longint;
            end;

      color = (black, brown, red, orange, yellow, green, blue, violet, gray,
               white);

      Symbol = (IDENTSY,   ICONSTSY,  RCONSTSY,  DOSY,      OFSY,
                TOSY,      FORSY,     ASSIGNSY,  NILSY,     IFSY,
                THENSY,    ELSESY,    DOWNTOSY,  BEGINSY,   ENDSY,
                WITHSY,    GOTOSY,    CONSTSY,   VARSY,     TYPESY,
                ARRAYSY,   RECORDSY,  SETSY,     FILESY,    FUNCTSY,
                PROCSY,    LABELSY,   PACKEDSY,  PROGRAMSY, STRINGSY,
                CASESY,    WHILESY,   UNTILSY,   REPEATSY,  CCONSTSY,
                SCONSTSY,  LPARENSY,  RPARENSY,  LBRACKSY,  RBRACKSY,
                PERIODSY,  COMMASY,   SEMISY,    COLONSY,   UPARROWSY,
                OTHERSY,   UNITSY,    USESSY,    INTERSY,   IMPLESY,
                INTRINSY,  SUBCLSY,   METHSY,    ATSIGNSY,  NOTSY,
                STARSY,    SLASHSY,   DIVSY,     MODSY,     ANDSY,
                PLUSSY,    MINUSSY,   ORSY,      LTSY,      GTSY,
                LESY,      GESY,      EQSY,      NESY,      INSY,
                ERRSY,     EOFSY,     DOLLARSY,  LBRACECL,  BLANKCL,
                LETCL,     DIGITCL);

      SetOfSys       = SET OF Symbol;

   var
      vrec: rec;

   const
       one = 1;
       two = - 2;
       three = one + two + 4;
       s1 = '1234567890';
       cr = chr(13);
       ch5 = chr(ord('0') + sqr(2) + ord4('5') - ord('4'));
       r1 = 2.0;
       r2 = r1 * 10;
       c1 = '1';
       b1 = true;
       b2 = false;
       b3 = b1 and not b2;
       i1 = (10*20 - 1000 div 10) * 5 + 12;
       set1 = [1, 3, 5];
       set2 = [2, 4, 6];
       set3 = [1..75];
       set4 = [];
       set5 = [10, 12, 14, 17, 19];
       set6 = set5 + set2;
       set7 = set2 + set5;
       set8 = set2 + [];
       set9 = [] + set2;
       set10 = set3 * set1;
       set11 = set1 * set3;
       set12 = set3 * [];
       set13 = [] * set3;
       set14 = [1..10] - set2;
       set15 = [1..10] - set3;
       set16 = set3 - [];
       set17 = [] - set3;
       set18 = [red..blue];
       set19 = [black, red, yellow, blue, gray];
       set20 = [black..white];
       set21 = set20 - set19;
       set22 = set19 + [brown, orange, green, violet, white];
       b4 = (set1 = set2);
       b5 = 'abcde' > 'abcd';
       b6 = 'a' < 'z';
       b7 = 10 > 100;
       b8 = r1 <= r2;
       b9 = 10 IN set3;
       b10 = 10 in set1;
       b11 = set1 <= set3;
       b12 = set3 >= set1;
       b13 = ([] = [2]) or ('a' = '1') or not (3.0 = 3.0) or not ('a' in ['a'..'z']);
       b14 = '1234567890123456789012345' = '1234567890123456789012345';
       b15 = set2 = set1;
       c2 = abs(-10);
       c3 = abs(-3.14159);
       b16 = odd(11);
       b17 = odd(12);
       c4 = sqr(-5);
       c5 = sqr(1.5);
       c6 = round(1.5);
       c7 = round(-1.5);
       c8 = trunc(3.14159);
       c9 = trunc(-1.5);
       c10 = ord('1');
       c11 = maxint - 1;
       c12 = maxint * maxint;
       c13 = 10 mod 15;
       c14 = sizeof(rec);
       c15 = sizeof(vrec);
       BlockBegSys = [LABELSY, CONSTSY, TYPESY, VARSY, PROCSY, FUNCTSY, BEGINSY,
                      METHSY];
       StatBegSys = [BEGINSY, GOTOSY, IFSY, WHILESY, REPEATSY, FORSY, WITHSY,
                     CASESY];
       AllBegSys = BlockBegSys + StatBegSys;

   type
      string255 = string[200+55];

   var
      i, failures, successes: integer;
      j, l1, l2: longint;
      c: char;
      r: real;
      p: packed array [1..10] of char;
      s: string[10];
      t: set of 0..255;
      xBlockBegSys, xStatBegSys, xAllBegSys, xxx: SetOfSys;

   procedure fail(test: string255);

      begin {fail}
         writeln('failed: ', test);
         failures := failures + 1;
      end; {fail}

   procedure ok(test: string255);

      begin {ok}
         successes := successes + 1;
         writeln('passed: ', test);
      end; {ok}

   procedure testsets;

      begin {testsets}
         if set1 <> [1, 3, 5] then
            fail('set1 = [1, 3, 5]')
         else
            ok('set1 = [1, 3, 5]');
         if set2 <> [2, 4, 6] then
            fail('set2 = [2, 4, 6]')
         else
            ok('set2 = [2, 4, 6]');
         if set3 <> [1..75] then
            fail('set3 = [1..75]')
         else
            ok('set3 = [1..75]');
         if set4 <> [] then
            fail('set4 = []')
         else
            ok('set4 = []');
         if set5 <> [10, 12, 14, 17, 19] THEN
            fail('set5 = [10, 12, 14, 17, 19]')
         else
            ok('set5 = [10, 12, 14, 17, 19]');
         if set6 <> [2, 4, 6, 10, 12, 14, 17, 19] THEN
            fail('set6 = set5 + set2')
         else
            ok('set6 = set5 + set2');
         if set7 <> [2, 4, 6, 10, 12, 14, 17, 19] THEN
            fail('set7 = set2 + set5')
         else
            ok('set7 = set2 + set5');
         if set8 <> [2, 4, 6] THEN
            fail('set8 = set2 + []')
         else
            ok('set8 = set2 + []');
         if set9 <> [2, 4, 6] THEN
            fail('set9 = [] + set2')
         else
            ok('set9 = [] + set2');
         if set10 <> [1..75] * [1, 3, 5] THEN
            fail('set10 = set3 * set1')
         else
            ok('set10 = set3 * set1');
         if set11 <> [1, 3, 5] * [1..75] THEN
            fail('set11 = set1 * set3')
         else
            ok('set11 = set1 * set3');
         if set12 <> [] then
            fail('set12 = set3 * []')
         else
            ok('set12 = set3 * []');
         if set13 <> [] then
            fail('set13 = [] * set3')
         else
            ok('set13 = [] * set3');
         if set14 <> [1..10] - [2, 4, 6] then
            fail('set14 = [1..10] - set2')
         else
            ok('set14 = [1..10] - set2');
         if set15 <> [1..10] - [1..75] then
            fail('set15 = [1..10] - set3')
         else
            ok('set15 = [1..10] - set3');
         if set16 <> [1..75] then
            fail('set16 = set3 - []')
         else
            ok('set16 = set3 - []');
         if set17 <> [] then
            fail('set17 = [] - set3')
         else
            ok('set17 = [] - set3');
         if set18 <> [red..blue] then
            fail('set18 = [red..blue]')
         else
            ok('set18 = [red..blue]');
         if set19 <> [black, red, yellow, blue, gray] then
            fail('set19 = [black, red, yellow, blue, gray]')
         else
            ok('set19 = [black, red, yellow, blue, gray]');
         if set20 <> [black..white] then
            fail('set20 = [black..white]')
         else
            ok('set20 = [black..white]');
         if set21 <> [black..white] - [black, red, yellow, blue, gray] then
            fail('set21 = set20 - set19')
         else
            ok('set21 = set20 - set19');
         if set22 <> [black..white]  then
            fail('set22 = set19 + [brown, orange, green, violet, white]')
         else
            ok('set22 = set19 + [brown, orange, green, violet, white]');
      end; {testsets}

   begin
      failures := 0; successes := 0;
      writeln;
      writeln('Test of constant expressions:'); writeln;

      if one <> 1 then
         fail('one = 1')
      else
         ok('one = 1');
      if two <> - 2 then
         fail('two = - 2')
      else
         ok('two = - 2');
      if three <> 3 then
         fail('three = one + two + 4')
      else
         ok('three = one + two + 4');
      if s1 <> '1234567890' then
         fail('s1 = ''1234567890''')
      else
         ok('s1 = ''1234567890''');
      if cr <> chr(13) then
         fail('cr = chr(13)')
      else
         ok('cr = chr(13)');
      if ch5 <> chr(ord('0') + sqr(2) + ord4('5') - ord('4')) then
         fail('ch5 = chr(ord(''0'') + sqr(2) + ord4(''5'') - ord(''4''))')
      else
         ok('ch5 = chr(ord(''0'') + sqr(2) + ord4(''5'') - ord(''4''))');
      if r1 <> 2.0 then
         fail('r1 = 2.0')
      else
         ok('r1 = 2.0');
      if r2 <> 20 then
         fail('r2 = r1 * 10')
      else
         ok('r2 = r1 * 10');
      if c1 <> '1' then
         fail('c1 = ''1''')
      else
         ok('c1 = ''1''');
      if (not b1) or (ord(b1) <> 1) then
         fail('b1 = true')
      else
         ok('b1 = true');
      if b2 or (ord(b2) <> 0) then
         fail('b2 = false')
      else
         ok('b2 = false');
      if not b3 or (ord(b3) <> 1) then
        fail('b3 = b1 and not b2')
      else
        ok('b3 = b1 and not b2');
      if i1 <> 512 then
        fail('i1 = (10*20 - 1000 div 10) * 5 + 12')
      else
        ok('i1 = (10*20 - 1000 div 10) * 5 + 12');
      testsets;
      if b4 or (ord(b4) <> 0) then
         fail('b4 = (set1 = set2)')
      else
         ok('b4 = (set1 = set2)');
      if not b5 or (ord(b5) <> 1) then
         fail('b5 = ''abcde'' > ''abcd''')
      else
         ok('b5 = ''abcde'' > ''abcd''');
      if not b6 or (ord(b6) <> 1) then
         fail('b6 = ''a'' < ''z''')
      else
         ok('b6 = ''a'' < ''z''');
      if b7 or (ord(b7) <> 0) then
         fail('b7 = 10 > 100')
      else
         ok('b7 = 10 > 100');
      if not b8 or (ord(b8) <> 1) then
         fail('b8 = r1 <= r2')
      else
         ok('b8 = r1 <= r2');
      if not b9 or (ord(b9) <> 1) then
         fail('b9 = 10 IN set3')
      else
         ok('b9 = 10 IN set3');
      if b10 or (ord(b10) <> 0) then
         fail('b10 = 10 in set1')
      else
         ok('b10 = 10 in set1');
      if not b11 or (ord(b11) <> 1) then
         fail('b11 = set1 <= set3')
      else
         ok('b11 = set1 <= set3');
      if not b12 or (ord(b12) <> 1) then
         fail('b12 = set3 >= set1')
      else
         ok('b12 = set3 >= set1');
      if b13 or (ord(b13) <> 0) then
         fail('b13 = ([] = [2]) or (''a'' = ''1'') or not ((3.0 = 3.0) and (''a'' in [''a''..''z'']))')
      else
         ok('b13 = ([] = [2]) or (''a'' = ''1'') or not ((3.0 = 3.0) and (''a'' in [''a''..''z'']))');
      if not b14 or (ord(b14) <> 1) then
         fail('b14 = ''1234567890123456789012345'' = ''1234567890123456789012345''')
      else
         ok('b14 = ''1234567890123456789012345'' = ''1234567890123456789012345''');
      if b15 or (ord(b15) <> 0) then
         fail('b15 = set2 = set1')
      else
         ok('b15 = set2 = set1');
      if c2 <> abs(-10) then
         fail('c2 = abs(-10)')
      else
         ok('c2 = abs(-10)');
      if c3 <> abs(-3.14159) then
         fail('c3 = abs(-3.14159)')
      else
         ok('c3 = abs(-3.14159)');
      if not b16 or (ord(b16) <> 1) then
         fail('b16 = odd(11)')
      else
         ok('b16 = odd(11)');
      if b17 or (ord(b17) <> 0) then
         fail('b17 = odd(12)')
      else
         ok('b17 = odd(12)');
      if c4 <> sqr(-5) then
         fail('c4 = sqr(-5)')
      else
         ok('c4 = sqr(-5)');
      if c5 <> sqr(1.5) then
         fail('c5 = sqr(1.5)')
      else
         ok('c5 = sqr(1.5)');
      if c6 <> round(1.5) then
         fail('c6 = round(1.5)')
      else
         ok('c6 = round(1.5)');
      if c7 <> round(-1.5) then
         fail('c7 = round(-1.5)')
      else
         ok('c7 = round(-1.5)');
      if c8 <> trunc(3.14159) then
         fail('c8 := trunc(3.14159)')
      else
         ok('c8 = trunc(3.14159)');
      if c9 <> trunc(-1.5) then
         fail('c9 = trunc(-1.5)')
      else
         ok('c9 = trunc(-1.5)');
      if c10 <> ord('1') then
         fail('c10 = ord(''1'')')
      else
         ok('c10 = ord(''1'')');
      if c11 <> maxint - 1 then
         fail('c11 = maxint - 1')
      else
         ok('c11 = maxint - 1');
      l1 := maxint; l2 := maxint;
      if c12 <> l1 * l2 then
         fail('c12 = maxint * maxint')
      else
         ok('c12 = maxint * maxint');
      if c13 <> 10 mod 15 then
         fail('c13 = 10 mod 15')
      else
         ok('c13 = 10 mod 15');
      if c14 <> sizeof(rec) then
         fail('c14 = sizeof(rec)')
      else
         ok('c14 = sizeof(rec)');
      if c15 <> sizeof(vrec) then
         fail('c15 = sizeof(vrec)')
      else
         ok('c15 = sizeof(vrec)');
      xBlockBegSys := [LABELSY, CONSTSY, TYPESY, VARSY, PROCSY, FUNCTSY, BEGINSY,
                       METHSY];
      xStatBegSys := [BEGINSY, GOTOSY, IFSY, WHILESY, REPEATSY, FORSY, WITHSY,
                      CASESY];
      xAllBegSys := xBlockBegSys + xStatBegSys;
      if xAllBegSys <> AllBegSys THEN
         fail('AllBegSys')
      else
         ok('AllBegSys');
      xxx := blockbegsys + statbegsys - [CASESY, METHSY];

      writeln;
      writeln(successes+failures:1, ' tests: ', successes:1, ' successes  ',
              failures:1, ' failures');
   end.

