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