conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 09_test_configurations / 0901_communication_ports / Sem_0901_Communication_ports_002.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 // Two component mycompA and B message exchange
18 module Sem_0901_Communication_ports_002{
19
20 type port myport message {
21 inout integer
22 } with {extension "internal"}
23
24 type component Mysystem
25 {
26 timer t_rec,t_rec2;
27 port myport messagePort;
28 }
29
30 function fsend() runs on Mysystem { //send
31 messagePort.send(2);
32 t_rec2.start(20.0);
33 alt {
34 [] messagePort.receive(3) {
35 setverdict(pass);
36 }
37 [] messagePort.receive {
38 setverdict(fail);
39 }
40 [] t_rec2.timeout {
41 setverdict( inconc );
42 }
43 }
44 t_rec2.stop;
45 }
46
47 function frec() runs on Mysystem { // recieve
48 log("RECIEVE");
49 t_rec.start( 20.0 );
50 alt {
51 [] messagePort.receive(2) {
52 messagePort.send(3);
53 setverdict( pass );
54 }
55 [] messagePort.receive {
56 setverdict( fail );
57 }
58 [] t_rec.timeout {
59 setverdict( inconc );
60 }
61 }
62 t_rec.stop;
63 }
64
65 testcase TC_Sem_0901_Communication_ports_002() runs on Mysystem system Mysystem {
66 var Mysystem MyCompA;
67 var Mysystem MyCompB;
68
69 MyCompA:=Mysystem.create;
70 MyCompB:=Mysystem.create;
71 connect(MyCompA:messagePort,MyCompB:messagePort);
72 //connect(MyCompB:messagePort,MyCompA:messagePort);
73
74 log("before RECEIVE");
75
76 MyCompA.start(fsend());
77 //MyCompA.done; // waits MycompA to finish, finish with inco
78 MyCompB.start(frec());
79 MyCompB.done; // B always committed suicide without done
80
81 //MyCompB.stop;
82 //MyCompA.stop;
83 }
84 control{
85 execute(TC_Sem_0901_Communication_ports_002());
86 }
87 }
88
This page took 0.033443 seconds and 5 git commands to generate.