conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 21_configuration_operations / 2101_connection_operations / 210101_connect_and_map_operations / Sem_210101_connect_and_map_operations_004.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:21.1.1, Connect operation accepts ports where outlist of both ports are subsets of inlist of the counterpart ports
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirements are tested:
17 // For the connect operations, only consistent connections are allowed.
18 // a) Assuming the following:
19 // 1) ports PORT1 and PORT2 are the ports to be connected;
20 // 2) inlist-PORT1 defines the messages or procedures of the in-direction of PORT1;
21 // 3) outlist-PORT1defines the messages or procedures of the out-direction of PORT1;
22 // 4) inlist-PORT2 defines the messages or procedures of the in-direction of PORT2; and
23 // 5) outlist-PORT2 defines the messages or procedures of the out-direction of PORT2.
24 // b) The connect operation is allowed if and only if:
25 // outlist-PORT1 â\8a\86 inlist-PORT2 and outlist-PORT2 â\8a\86 inlist-PORT1.
26 //
27 // In this test, outlist-PORT1 â\8a\82inlist-PORT2 and outlist-PORT2 â\8a\82 inlist-PORT1
28
29 module Sem_210101_connect_and_map_operations_004 {
30 type record R {
31 integer field1,
32 charstring field2
33 }
34
35 type port P1 message {
36 inout integer, R;
37 in bitstring;
38 } with {extension "internal"}
39
40 type port P2 message {
41 in charstring, boolean, R, integer;
42 out integer;
43 } with {extension "internal"}
44
45 type component GeneralComp {
46 }
47
48 type component C1 {
49 port P1 p;
50 }
51
52 type component C2 {
53 port P2 p;
54 }
55
56 function f1() runs on C1
57 {
58 timer t := 1.0;
59 t.start;
60
61 p.send(5);
62
63 alt {
64 [] p.receive(10) {
65 setverdict(pass);
66 }
67 [] p.receive {
68 setverdict(fail);
69 }
70 }
71
72 /*if(p.checkstate("Connected")) {
73 setverdict(pass);
74 } else {
75 setverdict(fail);
76 } */ // checkstate op is not implemented
77
78 t.timeout; // keep alive for 1 second
79 }
80
81 function f2() runs on C2
82 {
83 timer t := 1.0;
84 t.start;
85
86 alt {
87 [] p.receive(5) {
88 p.send(10);
89 setverdict(pass);
90 }
91 [] p.receive {
92 setverdict(fail);
93 }
94 }
95
96 /*if(p.checkstate("Connected")) {
97 setverdict(pass);
98 } else {
99 setverdict(fail);
100 } */ // checkstate op is not implemented
101
102 t.timeout; // keep alive for 1 second
103 }
104
105 testcase TC_Sem_210101_connect_and_map_operations_004() runs on GeneralComp system GeneralComp {
106 var C1 v_ptc1 := C1.create;
107 var C2 v_ptc2 := C2.create;
108 // v_ptc1:p outlist is (integer, R) and v_ptc2:p inlist is (charstring, boolean, R, integer)
109 // v_ptc2:p outlist is (integer) and v_ptc2:p inlist is (R, integer, bitstring)
110 connect(v_ptc1:p, v_ptc2:p);
111 v_ptc1.start(f1());
112 v_ptc2.start(f2());
113 all component.done;
114 }
115
116 control{
117 execute(TC_Sem_210101_connect_and_map_operations_004());
118 }
119 }
This page took 0.045821 seconds and 5 git commands to generate.