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_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:21.1.1, Connect operation accepts ports where outlist of the 2nd port is a subset of inlist of the 1st port
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 == inlist-PORT2 and outlist-PORT2 â\8a\82 inlist-PORT1
28
29 module Sem_210101_connect_and_map_operations_003 {
30 type record R {
31 integer field1,
32 charstring field2
33 }
34
35 type port P1 message {
36 in charstring, boolean;
37 inout integer;
38 out R;
39 } with {extension "internal"}
40
41 type port P2 message {
42 in R, integer;
43 out integer;
44 } with {extension "internal"}
45
46 type component GeneralComp {
47 }
48
49 type component C1 {
50 port P1 p;
51 }
52
53 type component C2 {
54 port P2 p;
55 }
56
57 function f1() runs on C1
58 {
59 timer t := 1.0;
60 t.start;
61
62 p.send(5);
63
64 alt {
65 [] p.receive(10) {
66 setverdict(pass);
67 }
68 [] p.receive {
69 setverdict(fail);
70 }
71 }
72
73 /*if(p.checkstate("Connected")) {
74 setverdict(pass);
75 } else {
76 setverdict(fail);
77 }*/ // checkstate op is not implemented
78
79 t.timeout; // keep alive for 1 second
80 }
81
82 function f2() runs on C2
83 {
84 timer t := 1.0;
85 t.start;
86
87 alt {
88 [] p.receive(5) {
89 p.send(10);
90 setverdict(pass);
91 }
92 [] p.receive {
93 setverdict(fail);
94 }
95 }
96
97 /*if(p.checkstate("Connected")) {
98 setverdict(pass);
99 } else {
100 setverdict(fail);
101 }*/ // checkstate op is not implemented
102
103 t.timeout; // keep alive for 1 second
104 }
105
106
107 testcase TC_Sem_210101_connect_and_map_operations_003() runs on GeneralComp system GeneralComp {
108 var C1 v_ptc1 := C1.create;
109 var C2 v_ptc2 := C2.create;
110 // v_ptc2:p inlist is (charstring, boolean, R, integer) and v_ptc1:p outlist is (integer, R)
111 connect(v_ptc1:p, v_ptc2:p);
112 v_ptc1.start(f1());
113 v_ptc2.start(f2());
114 all component.done;
115 }
116
117 control{
118 execute(TC_Sem_210101_connect_and_map_operations_003());
119 }
120 }
This page took 0.046467 seconds and 5 git commands to generate.