/****************************************************************************** * Copyright (c) 2000-2016 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Adrien Kirjak – initial implementation * ** @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.*/ //RAW encoding adds extra bits, up to 8 bit, to a bitstring because it encodes anything into an octetstring module Sem_B010209_decoded_content_003 { type record MessageType { octetstring payload } type record Mymessage { integer field1, bitstring field2 optional } with { variant " "}; type port loopbackPort message { inout MessageType } with {extension "internal"}; type component GeneralComp { port loopbackPort messagePort } testcase TC_Sem_B010209_decoded_content_003() runs on GeneralComp { var bitstring v_enc; var Mymessage v_testMessage; var MessageType Message; v_testMessage:= { field1 := 10, field2 := '1001'B } Message.payload := bit2oct(encvalue(v_testMessage))//encode message to payload, octetstring template MessageType mw_matchingTemplate:= { payload := decmatch Mymessage: {field1:= 10, field2 := '00001001'B} } connect(self:messagePort, self:messagePort); messagePort.send(Message); //send message alt { [] messagePort.receive(mw_matchingTemplate) { setverdict(pass); } [] messagePort.receive { setverdict(fail); } } } control{ execute(TC_Sem_B010209_decoded_content_003()); } } with { encode "RAW"}