0247c2c3d2dc421b57c26d80d27f5823852c7caa
[deliverable/titan.core.git] / conformance_test / positive_tests / B_matching_incoming_values / B01_template_matching / B0102_matching_mechanisms / B010209_decoded_content / Sem_B010209_decoded_content_003.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:B.1.2.8, Ensure that the IUT correctly handles content decoding
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 //Restriction a)
17 /*It can be assigned to templates and template fields of bitstring, hexstring, octetstring,
18 charstring and universal charstring types.*/
19
20 //RAW encoding adds extra bits, up to 8 bit, to a bitstring because it encodes anything into an octetstring
21
22 module Sem_B010209_decoded_content_003 {
23
24 type record MessageType {
25 octetstring payload
26 }
27
28 type record Mymessage {
29 integer field1,
30 bitstring field2 optional
31 } with { variant " "};
32
33 type port loopbackPort message {
34 inout MessageType
35 } with {extension "internal"};
36
37 type component GeneralComp {
38 port loopbackPort messagePort
39 }
40
41 testcase TC_Sem_B010209_decoded_content_003() runs on GeneralComp {
42 var bitstring v_enc;
43 var Mymessage v_testMessage;
44 var MessageType Message;
45
46 v_testMessage:= {
47 field1 := 10,
48 field2 := '1001'B
49 }
50
51 Message.payload := bit2oct(encvalue(v_testMessage))//encode message to payload, octetstring
52
53 template MessageType mw_matchingTemplate:= {
54 payload := decmatch Mymessage: {field1:= 10, field2 := '00001001'B}
55 }
56
57 connect(self:messagePort, self:messagePort);
58 messagePort.send(Message); //send message
59
60 alt {
61 [] messagePort.receive(mw_matchingTemplate) {
62 setverdict(pass);
63 }
64 [] messagePort.receive {
65 setverdict(fail);
66 }
67 }
68
69 }
70
71 control{
72 execute(TC_Sem_B010209_decoded_content_003());
73 }
74
75 } with { encode "RAW"}
76
This page took 0.041304 seconds and 5 git commands to generate.