/***************************************************
 ** @author   STF 409
 ** @version  0.0.1
 ** @purpose  1:B.1.3.1, Ensure that the IUT correctly handles template matching of ? symbols in value elements
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_B010301_any_element_002 {


	type record MessageType {
  	 charstring  	field1,
  	 bitstring		field2,
  	 hexstring		field3
	}

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010301_any_element_002() runs on GeneralComp {

    var MessageType v_testMessage;

 template MessageType mw_matchingTemplate:=
 {
  field1 := pattern "test s?ring",	//attempting to match a missing character
  field2 := '10???'B,
  field3 := '8?A?C'H
 }

 v_testMessage:=  {
  field1 := "test sring",
  field2 := '10101'B,
  field3 := '89ABC'H
 }

 messagePort.send(v_testMessage);

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

control{
    execute(TC_Sem_B010301_any_element_002());
}

}
