diff --git a/Regression_Test_java/single_config.cfg b/Regression_Test_java/single_config.cfg index e392459fb418c0f26cd878e266523c4b386dc51a..772e568b8f3993e0de9c88ecd0233acb253baa51 100644 --- a/Regression_Test_java/single_config.cfg +++ b/Regression_Test_java/single_config.cfg @@ -260,8 +260,6 @@ TsetOper #if yes, there are comments #only in parallel, see there -TunionOper.control - ####### Template ###### TtemplateAnytype.control TtemplateBitstr.control @@ -278,9 +276,7 @@ TtemplateFloat.control TtemplateInt.control #templateIstemplatekind IsTemplateKind #pass, fixed compilation error - TtemplateOctetstr #TODO: 3 decmatch testcase commented out!!! - #templateRec: TtemplateRec #Project config spec dependent, which version will run: legacy flag for omit in value list is OFF or ON. #TODO: map back to titan.core! @@ -320,6 +316,15 @@ Compat.control #ucharstrOper #pass, see in [ORDERED_INCLUDE] "src/ucharstrOper/config.cfg" +#uidChars +#UIDCharsTest.control # 3 pass, see in [ORDERED_INCLUDE] "src/uidChars/config.cfg" +#unionOper +TunionOper.control #44 pass + +#visibility +Visibility.control #mainly compile test; TODO: write more details, tests! +#XML: TODO: XER encoder/decoder + [LOGGING] # In this section you can specify the name of the log file and the classes of events # you want to log into the file or display on console (standard error). diff --git a/Regression_Test_java/src/visibility/Visibility.ttcn b/Regression_Test_java/src/visibility/Visibility.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f7bc17741d431c31e6e5d98cacddab59db2af9ea --- /dev/null +++ b/Regression_Test_java/src/visibility/Visibility.ttcn @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Balasko, Jeno + * Czerman, Oliver + * Raduly, Csaba + * Szabados, Kristof + * + ******************************************************************************/ +module Visibility { +friend module module1; +friend module nonExi; + +//************* Components *************** +type component MyMtcType { + const charstring c_Scope:=__SCOPE__; + timer T_MyTimer:=0.001; +} + +testcase tc_visibility() runs on MyMtcType{ + log("Testing of public/private/friend"); + setverdict(pass); +} + + +control { + execute(tc_visibility()); +} + +} diff --git a/Regression_Test_java/src/visibility/config.cfg b/Regression_Test_java/src/visibility/config.cfg new file mode 100644 index 0000000000000000000000000000000000000000..9169748b171a80e7c72d1096cf98d714710a3fb3 --- /dev/null +++ b/Regression_Test_java/src/visibility/config.cfg @@ -0,0 +1,19 @@ +############################################################################### +# Copyright (c) 2000-2019 Ericsson Telecom AB +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v2.0 +# which accompanies this distribution, and is available at +# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html +# +# Contributors: +# Balasko, Jeno +# Czerman, Oliver +# +############################################################################### +[MODULE_PARAMETERS] +[LOGGING] +Logfile := "Visibility.log" +FileMask := LOG_ALL +ConsoleMask := TTCN_WARNING | TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS +[EXECUTE] +Visibility.control diff --git a/Regression_Test_java/src/visibility/module1.ttcn b/Regression_Test_java/src/visibility/module1.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..c57847cc3be4577d7f3bc41434836de07425b2f5 --- /dev/null +++ b/Regression_Test_java/src/visibility/module1.ttcn @@ -0,0 +1,91 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Balasko, Jeno + * Czerman, Oliver + * Szabados, Kristof + * + ******************************************************************************/ +module module1 +{ + +public modulepar charstring ts_m1:="public"; +private modulepar charstring ts_m2:="private"; +friend modulepar charstring ts_m3:="friend"; + +friend module Visibility, module2; + +private import from module2 all;//OK +private import from module3 all;//OK +private import from module4 all;//OK +//public import from module2 all;//NOK +//friend import from module2 all;//NOK + +const module2Type akarmi1 := 1; //OK, type is implicitly public +const module2TypePublic akarmi2 := 2; //OK, type is explicitly public +const module2TypeFriend akarmi3 := 3; //OK, module1 is friend of module2 +//const module2TypePrivate akarmi4 := 4; //NOK, module2TypePrivate is private to module2 + +group g_MyGroup{ + const module3Type akarmi5 := 5; //OK, type is implicitly public + const module3TypePublic akarmi6 := 6; //OK, type is explicitly public + //const module3TypeFriend akarmi7 := 7; //NOK, module1 is NOT a friend of module3 + //const module3TypePrivate akarmi8 := 8; //NOK, module2TypePrivate is private to module2 +} + +function MyFunc1() runs on Lib4_CT {} //OK +function MyFunc2() runs on Lib4Friend_CT {} //OK, module1 is friend for module4 +//function MyFunc3() runs on Lib4Private_CT {} //NOK, the *name* Lib4Private_CT is not + //visible for module1, thus fails at checking the runs on clause, whatever is the content! + + +function f_set2_Lib4_1() runs on Lib4_CT { v_Lib4_1 := 0 } //OK +function f_set2_Lib4_2() runs on Lib4_CT { v_Lib4_2 := 0 } //OK +function f_set2_Lib4_3() runs on Lib4_CT { v_Lib4_3 := 0 } //OK +function f_set2_Lib4Friend_1() runs on Lib4Friend_CT { v_Lib4Friend_1 := 0 } //OK +function f_set2_Lib4Friend_2() runs on Lib4Friend_CT { v_Lib4Friend_2 := 0 } //OK +function f_set2_Lib4Friend_3() runs on Lib4Friend_CT { v_Lib4Friend_3 := 0 } //OK + + +type component User_CT extends Lib4_CT {}; +function f_set3_Lib4_1() runs on User_CT { v_Lib4_1 := 0 } //OK +function f_set3_Lib4_2() runs on User_CT { v_Lib4_2 := 0 } //OK +//function f_set3_Lib4_3() runs on User_CT { v_Lib4_3 := 0 } //NOK, v_Lib4_3 is private, can be used +//in functions with "Lib4_CT" in their runs on (but not in children) + +//in short: visibility of the component type definition (name) and allowed use of the component +//type definitions are two different things. Component type visibility is checked when checking +//the runs on clause. Component definition visibility is checked (after a successful runs on +//check), when the definition is used within the body of the function + + +//All setter functions of module4 are public, hence can be called from any function +//with a compatible runs on clause +function f_MyFunc_1() runs on User_CT { f_set_Lib4_1() } //OK +function f_MyFunc_2() runs on User_CT { f_set_Lib4_2() } //OK +function f_MyFunc_3() runs on User_CT { f_set_Lib4_3() } //OK + +type component UserFriend_CT extends Lib4Friend_CT {}; //OK +function f_MyFuncFriend_1() runs on UserFriend_CT { f_set_Lib4Friend_1() } //OK +function f_MyFuncFriend_2() runs on UserFriend_CT { f_set_Lib4Friend_2() } //OK +function f_MyFuncFriend_3() runs on UserFriend_CT { f_set_Lib4Friend_3() } //OK + + +//type component UserPrivate_CT extends Lib4Private_CT {}; //NOK, the name Lib4Private_CT is not + //visible in module1 +//function MyFunc() { +//var Lib4Private_CT v_Lib4Private := Lib4Private_CT.create; //NOK, the name Lib4Private_CT is not + //visible in module1 +//} +//function f_MyFuncPrivate_1() runs on UserPrivate_CT { f_set_Lib4Private_1() } //NOK, UserPrivate_CT has an error +//function f_MyFuncPrivate_2() runs on UserPrivate_CT { f_set_Lib4Private_2() } //NOK, UserPrivate_CT has an error +//function f_MyFuncPrivate_3() runs on UserPrivate_CT { f_set_Lib4Private_3() } //NOK, UserPrivate_CT has an error + +control{} + +} // end of module1 diff --git a/Regression_Test_java/src/visibility/module2.ttcn b/Regression_Test_java/src/visibility/module2.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..9ad7a560fcd66d07f0f633b243ea3374ec6a67e0 --- /dev/null +++ b/Regression_Test_java/src/visibility/module2.ttcn @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Balasko, Jeno + * Czerman, Oliver + * + ******************************************************************************/ +module module2 +{ +friend module module1; +public group g_Group1{ + type integer module2Type; + public type integer module2TypePublic; + friend type integer module2TypeFriend; + private type integer module2TypePrivate; +} + +/*private group g_Group2{ + type integer module2Type2; + public type integer module2TypePublic2; + friend type integer module2TypeFriend2; + private type integer module2TypePrivate2; +} +*/ //NOK + +/*friend group g_Group3{ + type integer module2Type3; + public type integer module2TypePublic3; + friend type integer module2TypeFriend3; + private type integer module2TypePrivate3; +} +*/ //NOK + +} // end of module2 diff --git a/Regression_Test_java/src/visibility/module3.ttcn b/Regression_Test_java/src/visibility/module3.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..4a6b7dd4e5d54669c99b91fc5ddd8919110cc230 --- /dev/null +++ b/Regression_Test_java/src/visibility/module3.ttcn @@ -0,0 +1,25 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Balasko, Jeno + * Czerman, Oliver + * + ******************************************************************************/ +module module3 +{ +type integer module3Type; +public type integer module3TypePublic; +friend type integer module3TypeFriend; +private type integer module3TypePrivate; + +public type port pPublic message { inout charstring; } with {extension "internal"} +private type port pPrivate message { inout charstring; } with {extension "internal"} +friend type port pFriend message { inout charstring; } with {extension "internal"} + + +} // end of module3 diff --git a/Regression_Test_java/src/visibility/module4.ttcn b/Regression_Test_java/src/visibility/module4.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..a3210ef9c1158dad7d8c10774a760ca24f05286d --- /dev/null +++ b/Regression_Test_java/src/visibility/module4.ttcn @@ -0,0 +1,46 @@ +/****************************************************************************** + * Copyright (c) 2000-2019 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Balasko, Jeno + * Czerman, Oliver + * + ******************************************************************************/ +module module4 { + +friend module module1; + +type component Lib4_CT { + var integer v_Lib4_1; + public var integer v_Lib4_2; + private var integer v_Lib4_3; +} +friend type component Lib4Friend_CT { + var integer v_Lib4Friend_1; + public var integer v_Lib4Friend_2; + private var integer v_Lib4Friend_3; +} +private type component Lib4Private_CT { + var integer v_Lib4Private_1; + public var integer v_Lib4Private_2; + private var integer v_Lib4Private_3; +} + +function f_set_Lib4_1() runs on Lib4_CT { v_Lib4_1 := 0 } //OK +function f_set_Lib4_2() runs on Lib4_CT { v_Lib4_2 := 0 } //OK +function f_set_Lib4_3() runs on Lib4_CT { v_Lib4_3 := 0 } //OK +function f_set_Lib4Friend_1() runs on Lib4Friend_CT { v_Lib4Friend_1 := 0 } //OK +function f_set_Lib4Friend_2() runs on Lib4Friend_CT { v_Lib4Friend_2 := 0 } //OK +function f_set_Lib4Friend_3() runs on Lib4Friend_CT { v_Lib4Friend_3 := 0 } //OK + +//These functions cannot be called or started outside module4, though they are public! +//See module1 +function f_set_Lib4Private_1() runs on Lib4Private_CT { v_Lib4Private_1 := 0 } //OK +function f_set_Lib4Private_2() runs on Lib4Private_CT { v_Lib4Private_2 := 0 } //OK +function f_set_Lib4Private_3() runs on Lib4Private_CT { v_Lib4Private_3 := 0 } //OK + +}//end module4