/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:B.1.5.2, Ensure that the IUT correctly handles template matching of character pattern reference expressions
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

module Sem_B010502_reference_expression_010 {


	type record MessageType {
  	 universal charstring  field1,
     universal charstring  field2,
     universal charstring  field3
	}

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010502_reference_expression_010() runs on GeneralComp {

    var MessageType v_testMessage;
    const charstring m_Ref:="abc?def?";

 template MessageType mw_matchingTemplate:=
 {
  field1 := pattern "{\m_Ref}",      // this should accept pattern "abc?def?" only
  field2 := pattern "{m_Ref}\q{0,0,1,113}",   // this should accept pattern "abc?def?" only, with any character in ?
  field3 := pattern "{\m_Ref}\q{0,0,1,113}"   // this should accept pattern "abc?def?ű" only

 };
 v_testMessage:=  {
  field1 := "abc?def?",
  field2 := "abcDdefGű",
  field3 := "abc?def?ű"
 };

 messagePort.send(v_testMessage);

    alt {
     [] messagePort.receive(mw_matchingTemplate) {
        setverdict(pass,v_testMessage);
     }
     [] messagePort.receive {
        setverdict(fail,"Unexpected decoding result:",v_testMessage);
     }
    }
}

control{
    execute(TC_Sem_B010502_reference_expression_010());
}

}
