.****************************************************************************** .* Copyright (c) 2000-2014 Ericsson Telecom AB .* All rights reserved. This program and the accompanying materials .* are made available under the terms of the Eclipse Public License v1.0 .* which accompanies this distribution, and is available at .* http://www.eclipse.org/legal/epl-v10.html .******************************************************************************/ text. :lang eng. .* :docname.Test Description :docno. :rev.PA1 :date.2011.11.21 .* :prep.ETH/XZR ETHBAAT :subresp.ETHBAAT :appr.ETH/RZ (Gyula Koos) :checked.ETHGRY .* :title.Test description of the TTCN-3 Semantic Analyzer: Import of Imports :contents level=3. .*---------------------------------------------------------------------* :h1.PREREQUISITES AND PREPARATIONS .*---------------------------------------------------------------------* .*---------------------------------------------------------------------* :h2.Scope of the Test Object .*---------------------------------------------------------------------* :xmp tab=1 nokeep. This TD contains unified test cases related to TTCN3 Executor's import of imports function. DON'T YOU DARE TO WRITE AN INSPECTION RECORD ABOUT THIS FILE :exmp. :p.:us.Revision Information:eus. :xmp nokeep. :us.History:eus. REV DATE PREPARED CHANGE === ========== ======== ====== PA1 2011.11.21 ETHBAAT :exmp. .*---------------------------------------------------------------------* :h2.Test Tools .*---------------------------------------------------------------------* :p.:us.Software Tools:eus. :xmp tab=2 nokeep. SAtester :exmp. :np. .*---------------------------------------------------------------------* :h1.REQUIREMENT-BASED TESTS .*---------------------------------------------------------------------* .*---------------------------------------------------------------------* :h2.Testing Import of Imports feature .*---------------------------------------------------------------------* .*---------------------------------------------------------------------* :h3. Default private import lines - virtual but not real circular import .*---------------------------------------------------------------------* :xmp tab=0. module A { import from C {import all}; const integer i_A := 60; } module B { import from A all; import from A {import all}; const integer i_B:=2; type component CT {} testcase tc_A() runs on CT { var integer i:= i_A; } } module C{ import from B all; import from B { import all }; const integer i_C:=3; type component CT {} //because of "import from B { import all };" -but B contatains only private imports! testcase tc_A() runs on CT { var integer i:= i_A; //wrong } testcase tc_B() runs on CT { var integer i:= i_B; } } C\.ttcn: In TTCN-3 module `C': C\.ttcn:7.3-9.3: In testcase definition `tc_A': C\.ttcn:8.17-23: In variable definition `i': C\.ttcn:8.21-23: error: There is no local or imported definition with name `i_A' (Notify: .* sec )?(Notify: Error found in the input modules. Code will not be generated\.) :exmp. .*---------------------------------------------------------------------* :h3. Explicit private import lines - No real circular import chain .*---------------------------------------------------------------------* :xmp tab=0. module A_PR { private import from C_PR {import all}; const integer i_A := 60; } module B_PR { private import from A_PR all; private import from A_PR {import all}; const integer i_B:=2; type component CT {} testcase tc_A() runs on CT { var integer i:= i_A; } } module C_PR{ private import from B_PR all; private import from B_PR { import all }; const integer i_C:=3; type component CT {} //because of "private import from B_PR { import all };" -but B contatains only private imports! testcase tc_A() runs on CT { var integer i:= i_A; //wrong } testcase tc_B() runs on CT { var integer i:= i_B; } } C_PR\.ttcn: In TTCN-3 module `C_PR': C_PR\.ttcn:7.3-9.3: In testcase definition `tc_A': C_PR\.ttcn:8.17-23: In variable definition `i': C_PR\.ttcn:8.21-23: error: There is no local or imported definition with name `i_A' (Notify:.*.sec )?(Notify: Error found in the input modules. Code will not be generated\.) :exmp. .*---------------------------------------------------------------------* :h3. Chain of modules with public import statements - 3 circle of imports .*---------------------------------------------------------------------* :xmp tab=0. module A_PU { public import from C_PU {import all}; //circle! const integer i_A := 60; } module B_PU { public import from A_PU all; public import from A_PU {import all}; //circle const integer i_b:=2; type component CT {} } module C_PU{ public import from B_PU all; public import from B_PU { import all }; //circle const integer i_C:=3; type component CT {} } A_PU.ttcn: In TTCN-3 module `A_PU': A_PU.ttcn:2.10-38: In import definition: A_PU.ttcn: warning: Circular import chain is not recommended: `@A_PU' -> `@C_PU' -> `@B_PU' -> `@A_PU' :exmp. .*---------------------------------------------------------------------* :h3. Chain of modules with public import statements - one circle of imports .*---------------------------------------------------------------------* :xmp tab=0. module A_PU { public import from C_PU {import all}; //circle ! const integer i_A := 60; } module B_PU { public import from A_PU all; //no circle const integer i_B:=2; } module C_PU{ public import from B_PU all; //sees i_B 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) // no circe! const integer i_C:=3; } A_PU.ttcn: In TTCN-3 module `A_PU': A_PU.ttcn:2.10-38: In import definition: A_PU.ttcn: warning: Circular import chain is not recommended: `@A_PU' -> `@C_PU' -> `@B_PU' -> `@A_PU' :exmp. .*---------------------------------------------------------------------* :h4. Circular import check .*---------------------------------------------------------------------* :xmp tab=0. module a { import from b all; function f_a() { f_b(); } } module b { import from c all; function f_b() { f_c(); } } module c { import from b all; function f_c() { f_b(); } } b.ttcn: In TTCN-3 module `b': b.ttcn:2.5-21: In import definition: b.ttcn: warning: Circular import chain is not recommended: `@b' -> `@c' -> `@b' :exmp.