conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 09_test_configurations / 0901_communication_ports / Sem_0901_Communication_ports_005.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:9, Ensure that the the IUT receives the message sent by mycompA
13 ** @verdict pass accept, ttcn3verdict:pass
14 ** @configuration port:broadcast
15 ***************************************************/
16
17 //Mycomp A has two ports and MycompB has two ports.
18 module Sem_0901_Communication_ports_005{
19
20 type port myport message {
21 inout integer
22 } with {extension "internal"}
23
24
25 type component Mysystem
26 {
27 timer t_rec, t_rec2;
28 port myport messagePort1, messagePort2;
29 }
30
31 function fsend() runs on Mysystem {
32 messagePort1.send(1);
33 messagePort2.send(2);
34 t_rec2.start(20.0);
35
36 alt {
37 [] messagePort1.receive(3) {
38 setverdict(pass);
39 }
40 [] messagePort1.receive {
41 setverdict(fail);
42 }
43 [] t_rec2.timeout {
44 setverdict( inconc );
45 }
46 }
47
48 alt {
49 [] messagePort2.receive(4) {
50 setverdict(pass);
51 }
52 [] messagePort2.receive {
53 setverdict(fail);
54 }
55 [] t_rec2.timeout {
56 setverdict( inconc );
57 }
58 }
59
60 t_rec2.stop;
61 }
62
63
64 function frec() runs on Mysystem {
65 t_rec.start( 20.0 );
66
67 alt {
68 [] messagePort1.receive(1) {
69 messagePort1.send(3);
70 setverdict( pass );
71 }
72 [] messagePort1.receive {
73 setverdict( fail );
74 }
75 [] t_rec.timeout {
76 setverdict( inconc );
77 }
78 }
79
80 alt {
81 [] messagePort2.receive(2) {
82 messagePort2.send(4);
83 setverdict( pass );
84 }
85 [] messagePort2.receive {
86 setverdict( fail );
87 }
88 [] t_rec.timeout {
89 setverdict( inconc );
90 }
91 }
92 t_rec.stop;
93 }
94
95 testcase TC_Sem_0901_Communication_ports_005() runs on Mysystem {
96 var Mysystem MyCompA;
97 var Mysystem MyCompB;
98
99 MyCompA:=Mysystem.create;
100 MyCompB:=Mysystem.create;
101 connect(MyCompA:messagePort1,MyCompB:messagePort1);
102 connect(MyCompB:messagePort2,MyCompA:messagePort2);
103
104
105 MyCompB.start(frec());
106 MyCompA.start(fsend());
107
108 MyCompB.done; // reciever need to wait
109
110 MyCompB.stop;
111 MyCompA.stop;
112 }
113
114 control{
115 execute(TC_Sem_0901_Communication_ports_005());
116 }
117 }
This page took 0.033886 seconds and 5 git commands to generate.