{: test that assigning to a set outside its bounds causes a fatal error
   here we test various values where sets overlap on the upper bound,
   vary the test element of src set
}

{ this is ageneric test, many versions of this test will be built with
  cpp -D ARG1=ARG -D ARG2=(ARG+ADJ)
  for all combinatiopns of ARG & ADJ

ARG   -8 -7 -2 -1 0 1 2 7 8 9 15 16 17 23 24 25 31 32 33
ADJ    1 2 7 8 9 15 16 17

}

{$d+}
program d201( output );

#if !defined ARG1 || ! defined ARG2
#error "ARG2 or ARG1 not defined"
#endif
#if ARG2 <= ARG1
#error "ARG2 must be greater than ARG1"
#endif

const
   lo  =  -20;
   lo1 =  -10;
   hi  = ARG1;
   hi1 = 50;
   t   = ARG2;
var
   i  : integer;
   s1 : set of lo1..hi1;  {src}
   s  : set of lo..hi;   {dst}

begin {d201}

   i := hi-1;
   s1 := [i];
   s := s1; {this should be OK}

   i := t;
   writeln( 'INFO: s is [', lo:1, '..', hi:1, '], s1 is [', lo:1, '..', hi1:1, '], test bit ', i:1);
   s1 := [i];
   s := s1; {!!! assign beyond upper bound}

   writeln('failed to detect set assign error');

end. { d201 }

