Titan Core Initial Contribution
[deliverable/titan.core.git] / function_test / Semantic_Analyser / import_of_iports / C_BPU_SE.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 //^In TTCN\-3 module \`C_BPU_SE\'\:$//
9 // This module
10 // 1. provides a module with "public import from B_APU_SE all; public import from B_APU_SE {import from all};" to test import statement located in prev. next modules and this module
11 // 2. provides a module which a friend of A
12 module C_BPU_SE {
13
14 public modulepar charstring tsp_C_ch := "This is a modulepar in C"
15
16 public import from B_APU_SE all;
17 public import from B_APU_SE {import all};
18
19 type component MTC {};
20
21
22 //==CONST===
23 const integer c_C_i := 0;
24 public const integer c_C_i_pu := 0;
25 friend const integer c_C_i_fr := 0;
26 private const integer c_C_i_pr := 0;
27
28 //==TEMPLATES===
29 template integer t_C_i := 0;
30 public template integer t_C_i_pu := 0;
31 friend template integer t_C_i_fr := 0;
32 private template integer t_C_i_pr := 0;
33
34 //===TYPES===
35 type integer C_MyInt;
36 public type integer C_MyInt_pu;
37 private type integer C_MyInt_pr;
38 friend type integer C_MyInt_fr;
39
40 //==functions
41 /* public */ function f_C() { log("This is f_C") }
42 public function f_C_pu() { log("This is f_C_pu") }
43 friend function f_C_fr() { log("This is f_C_fr") }
44 private function f_C_pr() { log("This is f_C_pr") }
45
46 //=============Testcases=========================================
47
48 // Public members of A are visible and
49 // "public import from A_SE all;" of B_APU is visible via "public import from B_APU_SE {import from all};" , therefore public objects defined in A are imported
50 testcase tc_A() runs on MTC { //^In testcase definition `tc_A'://
51 var integer i:=c_A_i;
52 i:=c_A_i_pu;
53 i:=valueof(t_A_i);
54 i:=valueof(t_A_i_pu);
55 var A_MyInt myInt;
56 var A_MyInt_pu myInt_pu;
57 f_A();
58 f_A_pu();
59
60 i:=c_A_i_fr;
61 i:=valueof(t_A_i_fr);
62 var A_MyInt myInt_fr;
63 f_A_fr();
64
65 i:=c_A_i_pr;//^In variable assignment:// //^error: There is no local or imported definition with name `c_A_i_pr'//
66 i:=valueof(t_A_i_pr);//^In variable assignment:// //In the operand of operation `valueof\(\)'// //^error: There is no local or imported definition with name `t_A_i_pr'//
67 var A_MyInt_pr a_myInt_pr;//^In variable definition `a_myInt_pr'// //^error: There is no local or imported definition with name `A_MyInt_pr'//
68 f_A_pr();//^In function or altstep instance:// //^error: There is no local or imported definition with name `f_A_pr'//
69 setverdict(pass);
70 }
71
72 //Only public and friend members of B_APU are visible and imported:
73
74 testcase tc_B() runs on MTC { //^In testcase definition `tc_B'://
75 var integer i:=c_B_i;
76 i:=c_B_i_pu;
77 i:=valueof(t_B_i_pu);
78 i:=valueof(t_B_i);
79 var B_MyInt myInt;
80 var B_MyInt_pu myInt_pu;
81 f_B();
82 f_B_pu();
83
84 i:=c_B_i_fr;
85 i:=valueof(t_B_i_fr);
86 var B_MyInt_fr myInt_fr;
87 f_B_fr();
88
89 i:=c_B_i_pr;//^In variable assignment\:$// //^error: There is no local or imported definition with name `c_B_i_pr'//
90 i:=valueof(t_B_i_pr);//^In variable assignment:// //In the operand of operation `valueof\(\)'// //^error: There is no local or imported definition with name `t_B_i_pr'//
91 var B_MyInt_pr b_myInt_pr; //^In variable definition `b_myInt_pr'////^error: There is no local or imported definition with name `B_MyInt_pr'//
92 f_B_pr(); //^In function or altstep instance:// //^error: There is no local or imported definition with name `f_B_pr'//
93 setverdict(pass);
94 }
95
96
97 }
This page took 0.0329 seconds and 5 git commands to generate.