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


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

    type port loopbackPort message {
	  inout MessageType
	}


type component GeneralComp {
	  port loopbackPort messagePort
}

testcase TC_Sem_B010502_reference_expression_011() runs on GeneralComp {

    var MessageType v_testMessage;
    const MessageType m_Ref:={"1","ABCabc"};
    const charstring referencedConstant_1 := m_Ref.field1;
    const charstring referencedConstant_2 := m_Ref.field2;


 template MessageType mw_matchingTemplate:=
 {
  field1 := pattern "{referencedConstant_1}",
  field2 := pattern "{referencedConstant_2}"
 };

 v_testMessage:=  {
  field1 := "1",
  field2 := "ABCabc"
 };

 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_011());
}

}
