/***************************************************
 ** @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_002 {

	type enumerated EnumeratedType {e_black, e_white, e_green};

	type record RecordType {
 	 integer  a optional,
 	 integer  b optional,
 	 boolean  c
	}

	type union UnionType {
 	 integer  a,
 	 EnumeratedType  b,
 	 boolean  c
	}

	type record MessageType {
  	 integer  		field1,
  	 charstring  	field2 optional,
  	 EnumeratedType field3 optional,
  	 RecordType		field4 optional,
  	 UnionType		field5 optional,
  	 RecordType		field6 optional,
  	 UnionType		field7 optional
	}

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010208_omit_value_002() runs on GeneralComp {

    var MessageType v_testMessage;

 template MessageType mw_matchingTemplate:=
 {
  field1 := ?,
  field2 := *,
  field3 := *,
  field4 := *,
  field5 := *,
  field6 := {a:=1,b:=omit,c:=true},    //omits the optional field
  field7 := *
 }

 v_testMessage:=  {
  field1 := 2,
  field2 := omit,
  field3 := omit,
  field4 := omit,
  field5 := omit,
  field6 := {a:=1,b:=omit,c:=true},
  field7 := omit
 }

 messagePort.send(v_testMessage);

    alt {
     [] messagePort.receive(mw_matchingTemplate) {
        setverdict(pass);
     }
     [] messagePort.receive {
        setverdict(fail);
     }
    }
}

control{
    execute(TC_Sem_B010208_omit_value_002());
}

}
