/***************************************************
 ** @author   STF 521
 ** @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
 ***************************************************/


// formerly: NegSem_B010208_omit_value_003

module Sem_B010208_omit_value_005 {

	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_005() 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({},mw_MyRecofTemplate);    // does not match and returns false
         if(v_boolean == false){
           setverdict(pass);
         }
     }
     [] messagePort.receive {
        setverdict(fail);
     }
    }
}

control{
    execute(TC_Sem_B010208_omit_value_005());
}

}
