/***************************************************
 ** @author   STF 470
 ** @version  0.0.1
 ** @purpose  1:B.1.2.8, Ensure that the IUT correctly handles template matching of omit values
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_B010208_omit_value_004 {

	type record MessageType {
  	 integer  		field1,
     MyRecordof		field2 optional,
  	 boolean		field3 optional
	}

    type record of integer MyRecordof;

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010208_omit_value_004() runs on GeneralComp {

    var MessageType v_testMessage;
    var boolean v_boolean;
    template MyRecordof mw_MyRecofTemplate := omit; 	// this assignment is allowed
    template boolean mw_MyBoolTemplate := omit; 		// this assignment is allowed


 template MessageType mw_matchingTemplate:=
 {
  field1 := ?,
  field2 := mw_MyRecofTemplate,
  field3 := mw_MyBoolTemplate
 }

 v_testMessage:=  {
  field1 := 2,
  field2 := omit,
  field3 := omit
 }

 messagePort.send(v_testMessage);

    alt {
     [] messagePort.receive(mw_matchingTemplate) {
        v_boolean := match({2,omit,omit},mw_matchingTemplate);// matches and returns true
        setverdict(pass);
     }
     [] messagePort.receive {
        setverdict(fail);
     }
    }
}

control{
    execute(TC_Sem_B010208_omit_value_004());
}

}
