// Test of enumeration and subrange types
//
// $Id: test6.mgl,v 1.3 2004/11/29 11:17:21 gkminix Exp $

program test6;

type
  myenum = (Mon, Tue, Wed, Thu, Fri, Sat, Sun);
  myrange = -10..20;

var
  e1, e2 : myenum;
  r1, r2 : myrange;
  i : integer;

begin

// Assignments
  e1 := Wed;
  e2 := e1;
  r2 := 10;
  r1 := r2;
  i  := ord(Sat);

// Expressions
  r2 := r1 + 5;		// result = 15
  r2 := 10 - r2;	// result = -5
  r2 := succ(r2);	// result = -4
  r2 := pred(r2);	// result = -5
  i  := ord(r2);
  e1 := pred(e2);	// result = Tue
  e1 := succ(e2);	// result = Wed
  i  := ord(e1);

// This should produce a runtime error
  e1 := Sun;
  e1 := succ(e1);
end.

