Merge github.com:eclipse/titan.core
[deliverable/titan.core.git] / function_test / Semantic_Analyser / TTCN3_SA_11_TD.script
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 .* Balasko, Jeno
10 .* Pandi, Krisztian
11 .*
12 .******************************************************************************/
13 text.
14 :lang eng.
15 .*
16 :docname.Test Description
17 :docno. xy/152 91-CRL 113 200/5 Uen
18 :rev.A
19 :date.2015-04-27
20 .*
21 :prep.ETH/XZR ETHBAAT
22 :subresp.ETHBAAT
23 :appr.ETH/RZ (Gyula Koos)
24 :checked.ETHGRY
25 .*
26 :title.Test description of the TTCN-3 Semantic Analyzer: Import of Imports
27 :contents level=3.
28 .*---------------------------------------------------------------------*
29 :h1.PREREQUISITES AND PREPARATIONS
30 .*---------------------------------------------------------------------*
31 .*---------------------------------------------------------------------*
32 :h2.Scope of the Test Object
33 .*---------------------------------------------------------------------*
34 :xmp tab=1 nokeep.
35 This TD contains unified test cases related to TTCN3 Executor's import of imports function.
36 DON'T YOU DARE TO WRITE AN INSPECTION RECORD ABOUT THIS FILE
37
38 :exmp.
39
40 :p.:us.Revision Information:eus.
41
42 :xmp nokeep.
43 :us.History:eus.
44
45 REV DATE PREPARED CHANGE
46 === ========== ======== ======
47 PA1 2011.11.21 ETHBAAT
48
49
50 :exmp.
51
52 .*---------------------------------------------------------------------*
53 :h2.Test Tools
54 .*---------------------------------------------------------------------*
55 :p.:us.Software Tools:eus.
56 :xmp tab=2 nokeep.
57
58 SAtester
59
60 :exmp.
61 :np.
62 .*---------------------------------------------------------------------*
63 :h1.REQUIREMENT-BASED TESTS
64 .*---------------------------------------------------------------------*
65 .*---------------------------------------------------------------------*
66 :h2.Testing Import of Imports feature
67 .*---------------------------------------------------------------------*
68
69 .*---------------------------------------------------------------------*
70 :h3. Default private import lines - virtual but not real circular import
71 .*---------------------------------------------------------------------*
72 :xmp tab=0.
73
74 <TC - Default private import lines - virtual but not real circular import >
75
76 <COMPILE>
77
78 <MODULE TTCN A A.ttcn>
79 module A {
80 import from C {import all};
81 const integer i_A := 60;
82 }
83
84 <END_MODULE>
85
86 <MODULE TTCN B B.ttcn>
87 module B {
88 import from A all;
89 import from A {import all};
90 const integer i_B:=2;
91
92 type component CT {}
93 testcase tc_A() runs on CT {
94 var integer i:= i_A;
95 }
96 }
97
98 <END_MODULE>
99
100 <MODULE TTCN C C.ttcn>
101 module C{
102 import from B all;
103 import from B { import all };
104 const integer i_C:=3;
105 type component CT {}
106 //because of "import from B { import all };" -but B contatains only private imports!
107 testcase tc_A() runs on CT {
108 var integer i:= i_A; //wrong
109 }
110
111 testcase tc_B() runs on CT {
112 var integer i:= i_B;
113 }
114 }
115
116 <END_MODULE>
117
118 <RESULT>
119 C\.ttcn: In TTCN-3 module `C':
120 C\.ttcn:7.3-9.3: In testcase definition `tc_A':
121 C\.ttcn:8.17-23: In variable definition `i':
122 C\.ttcn:8.21-23: error: There is no local or imported definition with name `i_A'
123 (Notify: .* sec
124 )?(Notify: Error found in the input modules. Code will not be generated\.)
125 <END_RESULT>
126
127 <END_TC>
128
129 :exmp.
130
131 .*---------------------------------------------------------------------*
132 :h3. Explicit private import lines - No real circular import chain
133 .*---------------------------------------------------------------------*
134 :xmp tab=0.
135
136 <TC - Explicit private import lines - No real circular import chain>
137
138 <COMPILE>
139
140 <MODULE TTCN A_PR A_PR.ttcn>
141 module A_PR {
142 private import from C_PR {import all};
143 const integer i_A := 60;
144 }
145
146 <END_MODULE>
147
148 <MODULE TTCN B_PR B_PR.ttcn>
149 module B_PR {
150 private import from A_PR all;
151 private import from A_PR {import all};
152 const integer i_B:=2;
153 type component CT {}
154 testcase tc_A() runs on CT {
155 var integer i:= i_A;
156 }
157 }
158
159 <END_MODULE>
160
161 <MODULE TTCN C_PR C_PR.ttcn>
162 module C_PR{
163 private import from B_PR all;
164 private import from B_PR { import all };
165 const integer i_C:=3;
166 type component CT {}
167 //because of "private import from B_PR { import all };" -but B contatains only private imports!
168 testcase tc_A() runs on CT {
169 var integer i:= i_A; //wrong
170 }
171
172 testcase tc_B() runs on CT {
173 var integer i:= i_B;
174 }
175 }
176
177 <END_MODULE>
178
179 <RESULT>
180
181 C_PR\.ttcn: In TTCN-3 module `C_PR':
182 C_PR\.ttcn:7.3-9.3: In testcase definition `tc_A':
183 C_PR\.ttcn:8.17-23: In variable definition `i':
184 C_PR\.ttcn:8.21-23: error: There is no local or imported definition with name `i_A'
185 (Notify:.*.sec
186 )?(Notify: Error found in the input modules. Code will not be generated\.)
187 <END_RESULT>
188
189 <END_TC>
190
191 :exmp.
192 .*---------------------------------------------------------------------*
193 :h3. Chain of modules with public import statements - 3 circle of imports
194 .*---------------------------------------------------------------------*
195
196 <TC - Chain of modules with public import statements - 3 circle of imports>
197
198 <COMPILE>
199
200 :xmp tab=0.
201 <MODULE TTCN A_PU A_PU.ttcn>
202 module A_PU {
203 public import from C_PU {import all}; //circle!
204 const integer i_A := 60;
205 }
206 <END_MODULE>
207
208 <MODULE TTCN B_PU B_PU.ttcn>
209 module B_PU {
210 public import from A_PU all;
211 public import from A_PU {import all}; //circle
212 const integer i_b:=2;
213 type component CT {}
214 }
215
216 <END_MODULE>
217
218 <MODULE TTCN C_PU C_PU.ttcn>
219 module C_PU{
220 public import from B_PU all;
221 public import from B_PU { import all }; //circle
222 const integer i_C:=3;
223 type component CT {}
224 }
225
226 <END_MODULE>
227
228 <RESULT>
229 A_PU.ttcn: In TTCN-3 module `A_PU':
230 A_PU.ttcn:2.10-38: In import definition:
231 A_PU.ttcn: warning: Circular import chain is not recommended: `@A_PU' -> `@C_PU' -> `@B_PU' -> `@A_PU'
232 <END_RESULT>
233
234 <END_TC>
235 :exmp.
236 .*---------------------------------------------------------------------*
237 :h3. Chain of modules with public import statements - one circle of imports
238 .*---------------------------------------------------------------------*
239
240 <TC - Chain of modules with public import statements - one circle of imports >
241
242 <COMPILE>
243
244 :xmp tab=0.
245 <MODULE TTCN A_PU A_PU.ttcn>
246 module A_PU {
247 public import from C_PU {import all}; //circle !
248 const integer i_A := 60;
249 }
250 <END_MODULE>
251
252 <MODULE TTCN B_PU B_PU.ttcn>
253 module B_PU {
254 public import from A_PU all; //no circle
255 const integer i_B:=2;
256 }
257
258 <END_MODULE>
259
260 <MODULE TTCN C_PU C_PU.ttcn>
261 module C_PU{
262 public import from B_PU all; //sees i_B
263 public import from B_PU { import all };// sees: public import from A_PU all; =>sees: i_A. don't see: public import from C_PU {import all};(from A)
264 // no circe!
265 const integer i_C:=3;
266 }
267
268 <END_MODULE>
269
270 <RESULT>
271 A_PU.ttcn: In TTCN-3 module `A_PU':
272 A_PU.ttcn:2.10-38: In import definition:
273 A_PU.ttcn: warning: Circular import chain is not recommended: `@A_PU' -> `@C_PU' -> `@B_PU' -> `@A_PU'
274 <END_RESULT>
275
276 <END_TC>
277 :exmp.
278
279 .*---------------------------------------------------------------------*
280 :h4. Circular import check
281 .*---------------------------------------------------------------------*
282
283 <TC - Circular import check >
284
285 <COMPILE>
286
287 :xmp tab=0.
288 <MODULE TTCN a a.ttcn>
289 module a {
290 import from b all;
291
292 function f_a()
293 {
294 f_b();
295 }
296 }
297 <END_MODULE>
298
299 <MODULE TTCN b b.ttcn>
300 module b {
301 import from c all;
302
303 function f_b()
304 {
305 f_c();
306 }
307 }
308
309 <END_MODULE>
310
311 <MODULE TTCN c c.ttcn>
312 module c {
313 import from b all;
314
315 function f_c()
316 {
317 f_b();
318
319 }
320 }
321
322 <END_MODULE>
323
324 <RESULT>
325 b.ttcn: In TTCN-3 module `b':
326 b.ttcn:2.5-21: In import definition:
327 b.ttcn: warning: Circular import chain is not recommended: `@b' -> `@c' -> `@b'
328 <END_RESULT>
329
330 <END_TC>
331 :exmp.
This page took 0.039106 seconds and 5 git commands to generate.