Enumerated types

This test case it part of the test suite proposed for new devices.

Test case ID: R0008
Language: ST

Code:
tests2/t0008a.st

(* see also enum_types *)
PROGRAM T0008
 VAR 
       C0, C1 , C2 ,C4: COLOR; // default: GREEN
       C5 : COLORBLUE;
       C3 : COLOR := COLOR#RED;
       STAT1,STAT2 : STATUS;
       I , I2:INT;
 END_VAR
       I2 := 3; // I2=3
       STAT2 := STATUS#ERROR;
       C1 := COLOR#BLUE; // C1=BLUE
       C0 := C3;         // C0=RED 
       
       // C4 := I; // error
       // I := C4; // we accept this, this is not an error
       
       IF EQ(C1, COLOR#BLUE) THEN
         I2 := I2 + 10; // I2 = 13
       END_IF;
       
       IF C1 = COLOR#RED THEN 
         I2 := I2 + 100;   // false
       END_IF;

       C0 := MUX(K:=3, IN2:=C1, IN3:=C4); (* C0 := C4  = GREEN  *) 
       C2 := F_R008(0,C3); (* C2 := C3 = RED *)
       //   C2 := F_R008(0,1); // error
       C1 := F_R008(1,C1); (* C1 := BLUE *)

       I := ADD(20,30,40); // I=90
       I := I + MUX(K:=0,IN0:=10,IN3:=20); // I=100 
       I := I +  MUX(1,51,11);            // I=111
         
               _GEB_ASSERT_(C0=COLOR#GREEN); // GREEN
        _GEB_ASSERT_(C1=COLOR#BLUE); // BLUE
        _GEB_ASSERT_(C2=COLOR#RED); // RED
        _GEB_ASSERT_(C3=COLOR#RED); // RED
        _GEB_ASSERT_(C4=COLOR#GREEN); // GREEN
        _GEB_ASSERT_(C5=COLOR#BLUE); // BLUE
        _GEB_ASSERT_(STAT1=STATUS#OK); // OK
        _GEB_ASSERT_(STAT2=STATUS#ERROR); // ERROR
        _GEB_ASSERT_(I2=13);
        _GEB_ASSERT_(I=111);  
END_PROGRAM

FUNCTION F_R008 : COLOR (* if I=0 returns the same color, else returns BLUE *)
   VAR_INPUT 
      I: INT;
      C: COLOR;
   END_VAR
   
   IF I = 0 THEN
      F_R008 := C;
   ELSE 
      F_R008 := COLOR#BLUE;
   END_IF; 

END_FUNCTION
tests2/t0008b.st
TYPE
    COLOR  : (RED,GREEN,BLUE) := GREEN;
    COLORBLUE  : COLOR := COLOR#BLUE;
    STATUS : (OK,ERROR); // default: OK
END_TYPE