/***************************************************
 ** @author   STF 433, modified by TTF 014
 ** @version  0.0.1
 ** @purpose  1:16.1.2, Verify that enum2int works correctly with typed enumerated items
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/
module Sem_160102_predefined_functions_118 {
    type enumerated EnumeratedType {e_black, e_white};
    type enumerated EnumeratedTypeWithLabels1 {e_black (1), e_white};
    type enumerated EnumeratedTypeWithLabels2 {e_black (-1), e_white};
    type enumerated EnumeratedTypeWithLabels3 {e_black (-1), e_white , e_yellow (0) };
    type enumerated Fruits {e_apple, e_peach, e_cherry};

type component GeneralComp {
}


testcase TC_Sem_160102_predefined_functions_118 () runs on GeneralComp {

 var EnumeratedType vl_enum_black := e_black;
 var EnumeratedType vl_enum_white := e_white;
 var EnumeratedTypeWithLabels1 vl_enum1_black := e_black;
 var EnumeratedTypeWithLabels1 vl_enum1_white := e_white;
 var EnumeratedTypeWithLabels2 vl_enum2_black := e_black;
 var EnumeratedTypeWithLabels2 vl_enum2_white := e_white;
 var EnumeratedTypeWithLabels3 vl_enum3_black := e_black;
 var EnumeratedTypeWithLabels3 vl_enum3_white := e_white;
 var EnumeratedTypeWithLabels3 vl_enum3_yellow := e_yellow;


    if( match(enum2int(EnumeratedTypeWithLabels1.e_black), 1)	// EnumeratedTypeWithLabels1.e_black resolves to 1; please note that the type prefix was not available in older TTCN-3 versions
      ) {
        setverdict(pass);
    }
    else {
        setverdict(fail);
    }


}


control{

    execute(TC_Sem_160102_predefined_functions_118());

}

}
