/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:B.1.5.6, Ensure that the IUT correctly handles character pattern compatibility rules of template case sensitive matching (@nocase)
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

/* The following requirements are tested:
When the "@nocase" modifier is used after the pattern keyword, the matching is evaluated in a case insensitive way
*/

module Sem_B010506_case_sensitive_pattern_matching_002 {


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

    type port loopbackPort message {
      inout MessageType
    }

type component GeneralComp {
      port loopbackPort messagePort
}
    const universal charstring MyCons :="A";

testcase TC_Sem_B010506_case_sensitive_pattern_matching_002(charstring p_Ref) runs on GeneralComp {

    var MessageType v_testMessage;
    template charstring m_Ref:= pattern "abc";


 template MessageType mw_matchingTemplate:=
 {
  field1 := pattern @nocase "{m_Ref} \q{0,0,1,113}",        // expected value: abc ű
  field2 := pattern @nocase "\N{MyCons}"                    // expected value: A
 }

 v_testMessage:=  {
  field1 := "aBc Ű",        // with @nocase - this is also valid
  field2 := "a"             // with @nocase - this is also valid
 }

 messagePort.send(v_testMessage);

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

control{
    execute(TC_Sem_B010506_case_sensitive_pattern_matching_002("parameter reference"));
}

}
