{: test that assigning to a set outside its bounds causes a fatal error
   here we test a list of variables assigned to a 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   -12 -11 11 12
ADJ   7

}

{$d+}
program d211( output );

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

const
   lo  = -10;
   hi  = 10;
   t = ARG1;
   hi1 = ARG2; {unused}
var
   i  : integer;
   s  : set of lo..hi;    {dst}

begin {d211}

   i := lo;
   s := [lo, lo+4, hi-4, hi]; {this should be OK}

   i := t;
   writeln( 'INFO: s is [', lo:1, '..', hi:1, '], assign element [', i:1, ']' );

   s := [lo, lo+4, hi-4, hi, i];  {!!! assignment outside bounds}

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

end. { d211 }

