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
9 * Adrien Kirjak – initial implementation
12 ** @purpose 1:24, Ensure instances of messages can be declared by in-line templates
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
16 * #reqname /Requirements/13 Declaring messages/Sorts of message insances/Variable as a message
20 module Sem_13_declaring_msg_003 {
21 type record CompositeType{
30 type enumerated MyEnum{
34 type integer MyArray[3];
50 universal charstring ucs,
62 type port MyPort1 message{
65 } with {extension "internal"}
67 type port MyPort2 message{
70 } with {extension "internal"}
72 type component Sender{
76 type component Receiver{
82 function make_union() return MyUnion
89 const MsgType1 c_message := {
100 set1 := {int1:=1, str1:="the"},
101 union1 := {int := 1},
106 function f_sender() runs on Sender
108 var MsgType1 msg1 := c_message;
112 function f_receiver() runs on Receiver
114 var MsgType1 v_message;
115 timer t_timer := 3.0;
119 [] dst.receive(MsgType1: {1, 1.0, true, pass, '0101'B, '123ABD'H, 'FF96'O,
120 """ab""", "the", {i:=1}, {int1:=1, str1:="the"}, make_union(), Bash, {1,2,3}})
125 [] t_timer.timeout { setverdict(fail, "The template failed to match the message"); }
129 testcase TC_Sem_13_declaring_msg_003() runs on MTC system MTC
131 var Sender c_sender := Sender.create;
132 var Receiver c_receiver := Receiver.create;
133 connect(c_sender:src, c_receiver:dst);
134 c_sender.start(f_sender());
135 c_receiver.start(f_receiver());
141 execute(TC_Sem_13_declaring_msg_003())