Sem_B010209_decoded_content_005.ttcn 1.51 KB
Newer Older
kovacsa's avatar
kovacsa committed
/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:B.1.2.8, Ensure that the IUT correctly handles content decoding 
 ** @verdict  pass accept, ttcn3verdict:pass
 ***************************************************/

//Restriction a)
/*It can be assigned to templates and template fields of bitstring, hexstring, octetstring,
charstring and universal charstring types.*/


module Sem_B010209_decoded_content_005 { 

	type record MessageType {
	  universal charstring payload
	}
	
	type record Mymessage {
	  integer field1,
	 universal charstring field2 optional
    }
	

    type port loopbackPort message{inout MessageType};
	

type component GeneralComp {	    	    
	  port loopbackPort messagePort
}	

testcase TC_Sem_B010209_decoded_content_005() runs on GeneralComp {

    var Mymessage v_testMessage;
    var MessageType Message;
    
    v_testMessage:= {1,"A"} ;

      Message.payload :=any2unistr(v_testMessage);		//encode message to payload,universal charstring UTF-8
          
    
    

 template MessageType mw_matchingTemplate:=
  {  			
  payload :=  decmatch("UTF-8") Mymessage: {1,"A"}
  } 


  messagePort.send(Message);	//send message

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

control{
    execute(TC_Sem_B010209_decoded_content_005());
}

}