home *** CD-ROM | disk | FTP | other *** search
/ ftp.ee.pdx.edu / 2014.02.ftp.ee.pdx.edu.tar / ftp.ee.pdx.edu / pub / users / Harry / compilers / p9 / tst / relat.pcat < prev    next >
Text File  |  2006-02-07  |  2KB  |  109 lines

  1. (* This program tests IR code generation for relational operators *)
  2.  
  3. program is
  4.  
  5.   type MyArr is array of integer;
  6.        MyRec is record f1: integer; end;
  7.   var i,j: integer := 0;
  8.   var x,y: real := 0.0;
  9.   var b, b1, b2: boolean := false;
  10.   var a1, a2: MyArr := nil;
  11.   var r1, r2: MyRec := nil;
  12.  
  13. begin
  14.   (* Test relational operators on integers. *)
  15.   if i = j then
  16.     i := 123;
  17.   end;
  18.   b := i = j;
  19.  
  20.   if i <> j then
  21.     i := 123;
  22.   end;
  23.   b := i <> j;
  24.  
  25.   if i < j then
  26.     i := 123;
  27.   end;
  28.   b := i < j;
  29.  
  30.   if i <= j then
  31.     i := 123;
  32.   end;
  33.   b := i <= j;
  34.  
  35.   if i > j then
  36.     i := 123;
  37.   end;
  38.   b := i > j;
  39.  
  40.   if i >= j then
  41.     i := 123;
  42.   end;
  43.   b := i >= j;
  44.  
  45.   (* Test relational operators on reals. *)
  46.   if x = y then
  47.     i := 123;
  48.   end;
  49.   b := x = y;
  50.  
  51.   if x <> y then
  52.     i := 123;
  53.   end;
  54.   b := x <> y;
  55.  
  56.   if x < y then
  57.     i := 123;
  58.   end;
  59.   b := x < y;
  60.  
  61.   if x <= y then
  62.     i := 123;
  63.   end;
  64.   b := x <= y;
  65.  
  66.   if x > y then
  67.     i := 123;
  68.   end;
  69.   b := x > y;
  70.  
  71.   if x >= y then
  72.     i := 123;
  73.   end;
  74.   b := x >= y;
  75.  
  76.   (* Test relational operators on Booleans. *)
  77.   if b1 = b2 then
  78.     i := 123;
  79.   end;
  80.   b := b1 = b2;
  81.  
  82.   if b1 <> b2 then
  83.     i := 123;
  84.   end;
  85.   b := b1 <> b2;
  86.  
  87.   (* Test relational operators on ptrs to records. *)
  88.   if r1 = r2 then
  89.     i := 123;
  90.   end;
  91.   b := r1 = r2;
  92.  
  93.   if r1 <> r2 then
  94.     i := 123;
  95.   end;
  96.   b := r1 <> r2;
  97.  
  98.   (* Test relational operators on ptrs to arrays. *)
  99.   if a1 = a2 then
  100.     i := 123;
  101.   end;
  102.   b := a1 = a2;
  103.  
  104.   if a1 <> a2 then
  105.     i := 123;
  106.   end;
  107.   b := a1 <> a2;
  108. end;
  109.