diff --git a/conformance_test/negative_tests/05_basic_language_elements.script b/conformance_test/negative_tests/05_basic_language_elements.script new file mode 100644 index 0000000000000000000000000000000000000000..b450c084896d2c5652a35935ac14bf4ae3df4574 --- /dev/null +++ b/conformance_test/negative_tests/05_basic_language_elements.script @@ -0,0 +1,8593 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 05_basic_language_elements folder. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* + +.*---------------------------------------------------------------------* +:h2. 05_toplevel folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSyn_05_TopLevel_001 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that when the IUT loads a module containing some definitions before the module declaration then the module is rejected. > + +<COMPILE> + +<MODULE TTCN NegSyn_05_TopLevel_001 NegSyn_05_TopLevel_001.ttcn > + +const integer wrongTopLevel := 1; + +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:5, Ensure that when the IUT loads a module containing some definitions before the module declaration then the module is rejected. + ** @verdict pass reject + *****************************************************************/ +module NegSyn_05_TopLevel_001 { + +} +<END_MODULE> + +<RESULT COUNT> +error: Cannot recognize file `NegSyn_05_TopLevel_001.ttcn' as an ASN.1 or TTCN-3 module. +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0501_identifiers_and_keywords folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that cannot pass a charstring value to an integer variable. > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_001 NegSem_0501_Identifier_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:5.1, Ensure that cannot pass a charstring value to an integer variable. + ** @verdict pass reject + *****************************************************************/ +module NegSem_0501_Identifier_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_0501_Identifier_001() runs on GeneralComp { + var integer v_i := "wrong_type"; + } + + control{ + execute(TC_NegSem_0501_Identifier_001(), 1.0); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0501_Identifier_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that when the IUT loads a module containing an identifier named with a keyword then the module is rejected. > + +<COMPILE> + +<MODULE TTCN NegSyn_0501_Identifier_001 NegSyn_0501_Identifier_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:5.1, Ensure that when the IUT loads a module containing an identifier named with a keyword then the module is rejected. + ** @verdict pass reject + *****************************************************************/ +module NegSyn_0501_Identifier_001 { + + type component GeneralComp { + } + + testcase TC_NegSyn_0501_Identifier_001() runs on GeneralComp { + var integer component := 1; + } + + control{ + execute(TC_NegSyn_0501_Identifier_001(), 1.0); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `component': syntax error, unexpected ComponentKeyword, expecting Identifier +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0502_scope_rules folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles definitions of local scope > + +<COMPILE> + +<MODULE TTCN NegSem_0502_Scope_001 NegSem_0502_Scope_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @desc Test cases for clause 5.2 Scope rules + ** @purpose 1:5.2, Ensure that the IUT correctly handles definitions of local scope + ** @verdict pass reject + ***************************************************/ +module NegSem_0502_Scope_001 { + +type component GeneralComp { + var integer vc_component := 0; +} + +function f_funcScope() runs on GeneralComp { + var integer v_function := 0; +} + +testcase TC_NegSem_0502_Scope_001() runs on GeneralComp { + f_funcScope(); + if ( match(v_function, 0) ){ + } +} + +control{ + var integer v_control := 0; + execute(TC_NegSem_0502_Scope_001()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_function' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles definitions of local scope > + +<COMPILE> + +<MODULE TTCN NegSem_0502_Scope_002 NegSem_0502_Scope_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @desc Test cases for clause 5.2 Scope rules + ** @purpose 1:5.2, Ensure that the IUT correctly handles definitions of local scope + ** @verdict pass reject + ***************************************************/ +module NegSem_0502_Scope_002 { + +type component GeneralComp { + var integer vc_component := 0; +} + +function f_funcScope() runs on GeneralComp { + var integer v_function := 1; +} + +testcase TC_NegSem_0502_Scope_002() runs on GeneralComp { + if ( match(v_control, 0) ){ + } +} + +control{ + var integer v_control := 0; + execute(TC_NegSem_0502_Scope_002()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_control' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles definitions of local scope > + +<COMPILE> + +<MODULE TTCN NegSem_0502_Scope_003 NegSem_0502_Scope_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @desc Test cases for clause 5.2 Scope rules + ** @purpose 1:5.2, Ensure that the IUT correctly handles definitions of local scope + ** @verdict pass reject + ***************************************************/ +module NegSem_0502_Scope_003 { + +type component GeneralComp { + var integer vc_component := 0; +} + +function f_funcScope() runs on GeneralComp { + var integer v_function := 0; +} + +testcase TC_NegSem_0502_Scope_003() runs on GeneralComp { + if(true) { + var integer v_statement := 0; + } + if ( match(v_statement, 0) ) { + } +} + +control{ + var integer v_control := 0; + execute(TC_NegSem_0502_Scope_003()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_statement' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0503_ordering_of_declarations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0503_Ordering_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that declarations are in the allowed ordering > + +<COMPILE> + +<MODULE TTCN NegSem_0503_Ordering_001 NegSem_0503_Ordering_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @desc Test cases for clause 5.2 Scope rules + ** @purpose 1:5.3, Ensure that declarations are in the allowed ordering + ** @verdict pass reject + ***************************************************/ +module NegSem_0503_Ordering_001 { + + type component GeneralComp { + var integer vc_component := 0; + } + + function f_function() runs on GeneralComp { + var integer v_function := 0; + } + + testcase TC_NegSem_0503_Ordering_001() runs on GeneralComp { + if(true) { + var integer v_statement := 0; + if (v_nested_statement == 0) { // attempt to access a variable defined in the next scope + var integer v_nested_statement := 0; + } + + } + } + + control { + var integer v_control := 0; + execute(TC_NegSem_0503_Ordering_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_nested_statement' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0504_parametrization folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0504_parametrization_incompatibility_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles received testcase parametrization type incompatibility. > + +<COMPILE> + +<MODULE TTCN NegSem_0504_parametrization_incompatibility_001 NegSem_0504_parametrization_incompatibility_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4, Ensure that the IUT correctly handles received testcase parametrization type incompatibility. + ** @verdict pass reject + ***************************************************/ +module NegSem_0504_parametrization_incompatibility_001 { + +type enumerated MyEnumeratedType {e_black, e_white} +type integer address; + +type record MyRecord { + integer field1, + boolean field2, + address field3, + MyEnumeratedType field4, + integer field5 +} + + +type component GeneralComp { + +} + + +testcase TC_NegSem_0504_parametrization_incompatibility_001 ( + MyRecord ExpectedMatch, + integer p_integer := 0, + boolean p_boolean := true, + address p_address := null, + MyEnumeratedType p_enumerated := e_black, + template integer p_integerTemplate := ? + ) runs on GeneralComp { + + // MyRecord cannot be built from the default p_integerTemplate parameter + var MyRecord ReceivedRecord := {p_integer, p_boolean, p_address, p_enumerated, p_integerTemplate}; + + if ( ReceivedRecord == ExpectedMatch ) { + setverdict(pass); + } + else { + setverdict(fail); + } + +} + + +control{ + + var MyRecord DefaultValues := { + field1 := 0, + field2 := true, + field3 := null, + field4 := e_black, + field5 := 1 //any number can be used here to correspond with ? matching + } + + execute(TC_NegSem_0504_parametrization_incompatibility_001(DefaultValues)); +} + +} +<END_MODULE> + +<RESULT COUNT 2> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0504_forbidden_parametrization_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects forbidden module parametrization types. > + +<COMPILE> + +<MODULE TTCN NegSyn_0504_forbidden_parametrization_002 NegSyn_0504_forbidden_parametrization_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4, Ensure that the IUT rejects forbidden module parametrization types. + ** @verdict pass reject + ***************************************************/ +module NegSyn_0504_forbidden_parametrization_002 { + +modulepar { timer TIMER_MODULE_PARAMETER } + +type component GeneralComp { +} + + +testcase TC_NegSyn_0504_forbidden_parametrization_002() runs on GeneralComp { +} + +control{ + execute(TC_NegSyn_0504_forbidden_parametrization_002()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timer': syntax error, unexpected TimerKeyword +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated for incompatible actual value of in parameter > + +<COMPILE> + +<MODULE TTCN NegSem_050401_top_level_001 NegSem_050401_top_level_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1, verify that error is generated for incompatible actual value of in parameter + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If parameters are passed by value (i.e. in case of in and out parameters), type compatibility +// rules specified in 6.3 apply. + +module NegSem_050401_top_level_001 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 + } + + type record R2 { + integer option1, + integer option2 optional + } + + function f(R2 p_rec) { + if (match(p_rec, {1, 2})) { + setverdict(pass); + } else { + setverdict(fail, "p_rec value not matching ", p_rec, {1, 2}); + } + } + + testcase TC_NegSem_050401_top_level_001() runs on GeneralComp { + var R1 v_rec := {field1 := 1, field2 := 2}; + f(v_rec); + } + + control{ + execute(TC_NegSem_050401_top_level_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_050401_top_level_001.R2' was expected instead of `@NegSem_050401_top_level_001.R1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated for incompatible actual value of out parameter > + +<COMPILE> + +<MODULE TTCN NegSem_050401_top_level_002 NegSem_050401_top_level_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1, verify that error is generated for incompatible actual value of out parameter + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If parameters are passed by value (i.e. in case of in and out parameters), type compatibility +// rules specified in 6.3 apply. + +module NegSem_050401_top_level_002 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 + } + + type record R2 { + integer option1, + integer option2 optional + } + + function f(out R2 p_rec) { + p_rec.option1 := 1; + p_rec.option2 := 2; + } + + testcase TC_NegSem_050401_top_level_002() runs on GeneralComp { + var R1 v_rec; + f(v_rec); + if ( match(v_rec, {1, 2})) { setverdict(pass); } + else { setverdict(fail, "p_rec value not matching ", v_rec, {1, 2}); } + } + + control{ + execute(TC_NegSem_050401_top_level_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: Reference to a variable or value parameter of type `@NegSem_050401_top_level_002.R2' was expected instead of `@NegSem_050401_top_level_002.R1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated if actual inout parameter doesn't adhere to strong typing rules > + +<COMPILE> + +<MODULE TTCN NegSem_050401_top_level_003 NegSem_050401_top_level_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1, verify that error is generated if actual inout parameter doesn't adhere to strong typing rules + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When parameters are passed by reference, strong typing is required. Both the actual and formal +// parameter shall be of the same type. + +module NegSem_050401_top_level_003 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 + } + + type record R2 { + integer option1, + integer option2 + } + + function f(inout R2 p_rec) { + if (match(p_rec, {1, 2})) { setverdict(pass); } + else { setverdict(fail, "p_rec value not matching ", p_rec, {1, 2}); } + } + + testcase TC_NegSem_050401_top_level_003() runs on GeneralComp { + var R1 v_rec := { field1 := 1, field2 := 2 }; + f(v_rec); // R1 and R2 are compatible types, but not the same. Strong typing requires exactly the same types. + } + + control{ + execute(TC_NegSem_050401_top_level_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: Reference to a variable or value parameter of type `@NegSem_050401_top_level_003.R2' was expected instead of `@NegSem_050401_top_level_003.R1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that in value formal parameters of template cannot used dash as default value > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_001 NegSem_05040101_parameters_of_kind_value_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that in value formal parameters of template cannot used dash as default value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Formal parameters of modified templates may inherit the default values from the corresponding +// parameters of their parent templates; this shall explicitly be denoted by using a dash (don't +// change) symbol at the place of the modified template parameters' default value. + +module NegSem_05040101_parameters_of_kind_value_001 { + + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + template R m_t(integer p_int1 := 3, in integer p_int2 := -) := { + field1 := p_int1, + field2 := p_int2 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that modified template cannot used dash as default value when original value parameter had no default value > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_002 NegSem_05040101_parameters_of_kind_value_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that modified template cannot used dash as default value when original value parameter had no default value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Formal parameters of modified templates may inherit the default values from the corresponding +// parameters of their parent templates; this shall explicitly be denoted by using a dash (don't +// change) symbol at the place of the modified template parameters' default value. + +module NegSem_05040101_parameters_of_kind_value_002 { + + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + template R m_t(integer p_int1, in integer p_int2 := 4) := { + field1 := p_int1, + field2 := p_int2 + } + + template R m_tmod(integer p_int1 := -, in integer p_int2 := 6) modifies m_t := { + field1 := p_int1, + field2 := p_int2 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template definitions cannot contain out value formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_003 NegSem_05040101_parameters_of_kind_value_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that template definitions cannot contain out value formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction b) +// Formal value parameters of templates ... shall always be in parameters. + +module NegSem_05040101_parameters_of_kind_value_003 { + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + function f(out integer p_int) return integer { + p_int := 2; + return p_int; + } + + template R m_t(out integer p_int) := { + field1 := 0, + field2 := f(p_int) + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_003() runs on GeneralComp { + var integer v_int; + log(m_t(v_int)); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template cannot have `out' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template definitions cannot contain inout value formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_004 NegSem_05040101_parameters_of_kind_value_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that template definitions cannot contain inout value formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction b) +// Formal value parameters of templates ... shall always be in parameters. + +module NegSem_05040101_parameters_of_kind_value_004 { + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + function f(inout integer p_int) return integer { + p_int := p_int * 2; + return p_int; + } + + template R m_t(inout integer p_int) := { + field1 := 0, + field2 := f(p_int) + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_004() runs on GeneralComp { + var integer v_int := 1; + log(m_t(v_int)); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template cannot have `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that out value formal parameters cannot have default values > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_005 NegSem_05040101_parameters_of_kind_value_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that out value formal parameters cannot have default values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction d) +// Default values can be provided for in parameters only. + +module NegSem_05040101_parameters_of_kind_value_005 { + type component GeneralComp { + } + + function f(out integer p_int := 5) { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_005() runs on GeneralComp { + var integer v_int; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `out' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that inout value formal parameters cannot have default values > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_006 NegSem_05040101_parameters_of_kind_value_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that inout value formal parameters cannot have default values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction d) +// Default values can be provided for in parameters only. + +module NegSem_05040101_parameters_of_kind_value_006 { + type component GeneralComp { + } + + function f(inout integer p_int := 5) { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_006() runs on GeneralComp { + var integer v_int := 0; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible value in default value assignment of value formal parameters causes error > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_007 NegSem_05040101_parameters_of_kind_value_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that incompatible value in default value assignment of value formal parameters causes error + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The expression of the formal parameters' default value has to be compatible with the type of the parameter. + +module NegSem_05040101_parameters_of_kind_value_007 { + type component GeneralComp { + } + + function f(in integer p_int := 5.0) { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_007() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default value of value formal parameters cannot reference component variables > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_008 NegSem_05040101_parameters_of_kind_value_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that default value of value formal parameters cannot reference component variables + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The expression shall not refer to elements of the component type of the optional runs on clause. + +module NegSem_05040101_parameters_of_kind_value_008 { + type component GeneralComp { + var integer vc_int := 0; + } + + function f(in integer p_int := vc_int) runs on GeneralComp { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_008() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a static value was expected instead of variable `@NegSem_05040101_parameters_of_kind_value_008.GeneralComp.vc_int' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default value of value formal parameters cannot reference other parameters > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_009 NegSem_05040101_parameters_of_kind_value_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that default value of value formal parameters cannot reference other parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The expression shall not refer to other parameters of the same parameter list. + +module NegSem_05040101_parameters_of_kind_value_009 { + type component GeneralComp { + } + + function f(in integer p_int, in integer p_int2 := p_int) runs on GeneralComp { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_009() runs on GeneralComp { + f(2); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `p_int' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default value of value formal parameters cannot invoke functions with runs on clause > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_010 NegSem_05040101_parameters_of_kind_value_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that default value of value formal parameters cannot invoke functions with runs on clause + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The expression shall not contain the invocation of functions with a runs on clause. + +module NegSem_05040101_parameters_of_kind_value_010 { + type component GeneralComp { + var integer vc_int; + } + + function fx() runs on GeneralComp return integer { + return vc_int + 1; + } + + function f(in integer p_int := fx()) runs on GeneralComp { + log(p_int); + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_010() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a static value was expected instead of the return value of function `@NegSem_05040101_parameters_of_kind_value_010.fx' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated if formal value parameter of function contains dash > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_011 NegSem_05040101_parameters_of_kind_value_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that error is generated if formal value parameter of function contains dash + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction h) +// The dash (don't change) symbol shall be used with formal parameters of modified templates only + +module NegSem_05040101_parameters_of_kind_value_011 { + + type component GeneralComp { + } + + function f (integer p_int := -) { + log(p_int); + } + + testcase TC_NegSem_05040102_parameters_of_kind_value_011() runs on GeneralComp { + f(1); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_value_011()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated if formal value parameter of altstep contains dash > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_012 NegSem_05040101_parameters_of_kind_value_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that error is generated if formal value parameter of altstep contains dash + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction h) +// The dash (don't change) symbol shall be used with formal parameters of modified templates only + +module NegSem_05040101_parameters_of_kind_value_012 { + + type component GeneralComp { + } + + altstep a(integer p_int := -) { + []any timer.timeout {} + [else] {} + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_012() runs on GeneralComp { + a(1); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_012()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated if formal value parameter of test case contains dash > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_013 NegSem_05040101_parameters_of_kind_value_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that error is generated if formal value parameter of test case contains dash + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction h) +// The dash (don't change) symbol shall be used with formal parameters of modified templates only + +module NegSem_05040101_parameters_of_kind_value_013 { + + type component GeneralComp { + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_013(integer p_int := -) runs on GeneralComp { + log(p_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_013(1)); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that out formal value parameters cannot have lazy modifier > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_014 NegSem_05040101_parameters_of_kind_value_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that out formal value parameters cannot have lazy modifier + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction j) +// Only in parameters can be declared lazy or fuzzy. + +module NegSem_05040101_parameters_of_kind_value_014 { + + type component GeneralComp { + } + + function f(out @lazy integer p_int) { + p_int := 6; + } + testcase TC_NegSem_05040101_parameters_of_kind_value_014() runs on GeneralComp { + var integer v_int; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_014()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that inout formal value parameters cannot have lazy modifier > + +<COMPILE> + +<MODULE TTCN NegSem_05040101_parameters_of_kind_value_016 NegSem_05040101_parameters_of_kind_value_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that inout formal value parameters cannot have lazy modifier + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction j) +// Only in parameters can be declared lazy or fuzzy. + +module NegSem_05040101_parameters_of_kind_value_016 { + + type component GeneralComp { + } + + function f(inout @lazy integer p_int) { + p_int := 6; + } + testcase TC_NegSem_05040101_parameters_of_kind_value_016() runs on GeneralComp { + var integer v_int := 0; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_016()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that const definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_001 NegSyn_05040101_parameters_of_kind_value_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that const definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_001 { + + const integer c_int(integer p_int) := p_int + 2; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(', expecting := or '\[' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that var definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_002 NegSyn_05040101_parameters_of_kind_value_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that var definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_002 { + + function f() { + var integer c_int(integer p_int) := p_int + 2; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variable definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_003 NegSyn_05040101_parameters_of_kind_value_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that template variable definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_003 { + + function f() { + var template integer c_int(integer p_int) := p_int + 2; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that timer definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_004 NegSyn_05040101_parameters_of_kind_value_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that timer definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_004 { + + function f() { + timer t_timer(float p_float) := p_float * 2; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that control definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_005 NegSyn_05040101_parameters_of_kind_value_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that control definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_005 { + + control(integer p_int) { + log(p_int); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that record of definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_006 NegSyn_05040101_parameters_of_kind_value_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that record of definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_006 { + + type record of integer RoI (integer p_int); +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `integer': syntax error, unexpected IntegerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that set of definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_007 NegSyn_05040101_parameters_of_kind_value_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that set of definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_007 { + + type set of integer SoI (integer p_int); +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `integer': syntax error, unexpected IntegerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that enumerated definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_008 NegSyn_05040101_parameters_of_kind_value_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that enumerated definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_008 { + + type enumerated EColour(integer p_int) { red, blue, green } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(', expecting '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that port definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_009 NegSyn_05040101_parameters_of_kind_value_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that port definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_009 { + + type port P(integer p_int) message { + inout integer; + map param(integer p_par := p_int); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `map': syntax error, unexpected MapKeyword, expecting InOutParKeyword or InParKeyword or OutParKeyword or '\}' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that component definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_010 NegSyn_05040101_parameters_of_kind_value_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that component definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_010 { + + type component C (integer p_int) { + var integer v_int := p_int; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(', expecting ExtendsKeyword or '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that subtype definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_011 NegSyn_05040101_parameters_of_kind_value_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that subtype definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_011 { + + type integer MyInt(integer p_int); +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `integer': syntax error, unexpected IntegerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that group definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_012 NegSyn_05040101_parameters_of_kind_value_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that group definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_012 { + + group Group1 (integer p_int) { + const integer c_int := 2 * p_int; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(', expecting '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that import definition cannot be parameterized > + +<COMPILE> + +<MODULE TTCN NegSyn_05040101_parameters_of_kind_value_013 NegSyn_05040101_parameters_of_kind_value_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.1, verify that import definition cannot be parameterized + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction a) +// Language elements which cannot be parameterized are: const, var, timer, control, record of, +// set of, enumerated, port, component and subtype definitions, group and import. + +module NegSyn_05040101_parameters_of_kind_value_013 { + + import from Sem_05040101_parameters_of_kind_value_001 (integer INTEGER_MODULE_PARAMETER) all; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(', expecting AllKeyword or '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that in template formal parameters of template cannot used dash as default value > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_001 NegSem_05040102_parameters_of_kind_template_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that in template formal parameters of template cannot used dash as default value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Formal template parameters of modified templates may inherit their default templates from the +// corresponding parameters of their parent templates; this shall explicitly be denoted by using +// a dash (don't change) symbol at the place of the modified template parameter's default template. + +module NegSem_05040102_parameters_of_kind_template_001 { + + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + template R mw_t(template integer p_int1 := ?, in template integer p_int2 := -) := { + field1 := p_int1, + field2 := p_int2 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Only modified templates are allowed to use the not used symbol \(`-'\) as the default parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that modified template cannot used dash as default value when original template parameter had no default value > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_002 NegSem_05040102_parameters_of_kind_template_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that modified template cannot used dash as default value when original template parameter had no default value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Formal template parameters of modified templates may inherit their default templates from the +// corresponding parameters of their parent templates; this shall explicitly be denoted by using +// a dash (don't change) symbol at the place of the modified template parameter's default template. + +module NegSem_05040102_parameters_of_kind_template_002 { + + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + template R m_t(template integer p_int1, in template integer p_int2 := 4) := { + field1 := p_int1, + field2 := p_int2 + } + + template R m_tmod(template integer p_int1 := -, in template integer p_int2 := ?) modifies m_t := { + field1 := p_int1, + field2 := p_int2 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template definitions cannot contain out template formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_003 NegSem_05040102_parameters_of_kind_template_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that template definitions cannot contain out template formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction b) +// Formal template parameters of templates ... shall always be in parameters. + +module NegSem_05040101_parameters_of_kind_template_003 { + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + function f(out template integer p_int) return template integer { + p_int := ?; + return p_int; + } + + template R m_t(out template integer p_int) := { + field1 := 0, + field2 := f(p_int) + } + + testcase TC_NegSem_05040101_parameters_of_kind_template_003() runs on GeneralComp { + var template integer v_int; + log(m_t(v_int)); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_template_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template cannot have `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template definitions cannot contain inout template formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_004 NegSem_05040102_parameters_of_kind_template_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that template definitions cannot contain inout template formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction b) +// Formal value parameters of templates ... shall always be in parameters. + +module NegSem_05040102_parameters_of_kind_template_004 { + type component GeneralComp { + } + + type record R + { + integer field1, + integer field2 + } + + function f(inout template integer p_int) return template integer { + p_int := ?; + return p_int; + } + + template R m_t(inout template integer p_int) := { + field1 := 0, + field2 := f(p_int) + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_004() runs on GeneralComp { + var template integer v_int := 1; + log(m_t(v_int)); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template cannot have `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that out template formal parameters cannot have default values > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_005 NegSem_05040102_parameters_of_kind_template_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that out template formal parameters cannot have default values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction c) +// Default templates can be provided for in parameters only. + +module NegSem_05040102_parameters_of_kind_template_005 { + type component GeneralComp { + } + + function f(out template integer p_int := ?) { + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_005() runs on GeneralComp { + var template integer v_int; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that inout template formal parameters cannot have default values > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_006 NegSem_05040102_parameters_of_kind_template_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that inout template formal parameters cannot have default values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction c) +// Default templates can be provided for in parameters only. + +module NegSem_05040102_parameters_of_kind_template_006 { + type component GeneralComp { + } + + function f(inout template integer p_int := ?) { + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_006() runs on GeneralComp { + var template integer v_int := 0; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible template instance in default template assignment of template formal parameters causes error > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_007 NegSem_05040102_parameters_of_kind_template_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that incompatible template instance in default template assignment of template formal parameters causes error + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction d) +// The default template instance has to be compatible with the type of the parameter. + +module NegSem_05040102_parameters_of_kind_template_007 { + type component GeneralComp { + } + + function f(in template integer p_int := (-20.0..5.0)) { //-infinity causes segfault + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_007() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_007()); + } +} +<END_MODULE> + +<RESULT COUNT 2> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default template instance of template formal parameters cannot reference component elements > + +<COMPILE> + +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_008 NegSem_05040102_parameters_of_kind_template_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that default template instance of template formal parameters cannot reference component elements + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The template instance shall not refer to elements of the component type in a runs on clause. + +module NegSem_05040102_parameters_of_kind_template_008 { + type component GeneralComp { + var template integer vc_int := ?; + } + + function f(in template integer p_int := vc_int) runs on GeneralComp { + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_008() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default template instance of template formal parameters cannot reference component elements > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_009 NegSem_05040102_parameters_of_kind_template_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that default template instance of template formal parameters cannot reference other parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The template instance shall not refer to other parameters in the same parameter list. + +module NegSem_05040102_parameters_of_kind_template_009 { + type component GeneralComp { + } + + function f(in template integer p_int, in template integer p_int2 := p_int) runs on GeneralComp { + } + + testcase TC_NegSem_05040102_parameters_of_kind_template_009() runs on GeneralComp { + f(?); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `p_int' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that default template instance of template formal parameters cannot reference component elements > + +<COMPILE> + +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_010 NegSem_05040102_parameters_of_kind_template_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that default template instance of template formal parameters cannot invoke functions with runs on clause + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction e) +// The template instance shall not contain the invocation of functions with a runs on clause. + +module NegSem_05040102_parameters_of_kind_value_010 { + type component GeneralComp { + var integer vc_int; + } + + function fx() runs on GeneralComp return integer { + return vc_int + 1; + } + + function f(in template integer p_int := fx()) runs on GeneralComp { + log(p_int); + } + + testcase TC_NegSem_05040101_parameters_of_kind_value_010() runs on GeneralComp { + f(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040101_parameters_of_kind_value_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Unbound left operand of integer addition. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that out formal template parameters cannot have lazy modifier > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_014 NegSem_05040102_parameters_of_kind_template_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that out formal template parameters cannot have lazy modifier + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction h) +// Only in template parameters can be declared lazy or fuzzy. + +module NegSem_05040102_parameters_of_kind_template_014 { + + type component GeneralComp { + } + + function f(out template @lazy integer p_int) { + p_int := ?; + } + testcase TC_NegSem_05040102_parameters_of_kind_template_014() runs on GeneralComp { + var template integer v_int; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_014()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that inout formal template parameters cannot have lazy modifier > + +<COMPILE> + +<MODULE TTCN NegSem_05040102_parameters_of_kind_template_016 NegSem_05040102_parameters_of_kind_template_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.1.2, verify that inout formal template parameters cannot have lazy modifier + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Restriction h) +// Only in template parameters can be declared lazy or fuzzy. + +module NegSem_05040102_parameters_of_kind_template_016 { + + type component GeneralComp { + } + + function f(inout template @lazy integer p_int) { + p_int := ?; + } + testcase TC_NegSem_05040102_parameters_of_kind_template_016() runs on GeneralComp { + var template integer v_int := 0; + f(v_int); + log(v_int); + setverdict(pass); + } + + control{ + execute(TC_NegSem_05040102_parameters_of_kind_template_016()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as in formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_001 NegSem_050402_actual_parameters_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as in formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_001 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + function f_test(in integer p_val) { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_001() runs on GeneralComp { + f_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_001.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as in formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_002 NegSem_050402_actual_parameters_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as in formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_002 { + + type component GeneralComp { + } + + function f_test(in integer p_val) { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_002() runs on GeneralComp { + var template integer vm_msg := 2; + f_test(vm_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as in formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_003 NegSem_050402_actual_parameters_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as in formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_003 { + + type component GeneralComp { + } + + function f_test(in integer p_val) { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template integer p_val) { + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_003() runs on GeneralComp { + f_caller(3); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as in formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_004 NegSem_050402_actual_parameters_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as in formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_004 { + + type component GeneralComp { + } + + function f_test(in integer p_val) { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(out template integer p_val) { + p_val := 4; // out parameter shall have a value before we can pass it to a function + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_004() runs on GeneralComp { + var template integer v_val; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as in formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_005 NegSem_050402_actual_parameters_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as in formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_005 { + + type component GeneralComp { + } + + function f_test(in integer p_val) { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(inout template integer p_val) { + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_005() runs on GeneralComp { + var template integer v_val := 5; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as in formal value parameters of templates > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_006 NegSem_050402_actual_parameters_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as in formal value parameters of templates + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_006 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + template integer m_test(in integer p_val) := 5 + p_val; + + testcase TC_NegSem_050402_actual_parameters_006() runs on GeneralComp { + if (match(6, m_test(m_msg))) { // tested parameter passing + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_050402_actual_parameters_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_006.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as in formal value parameters of templates > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_007 NegSem_050402_actual_parameters_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as in formal value parameters of templates + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_007 { + + type component GeneralComp { + } + + template integer m_test(in integer p_val) := 5 + p_val; + + testcase TC_NegSem_050402_actual_parameters_007() runs on GeneralComp { + var template integer vm_msg := 2; + if (match(7, m_test(vm_msg))) { // tested parameter passing + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_050402_actual_parameters_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as in formal value parameters of templates > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_008 NegSem_050402_actual_parameters_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as in formal value parameters of templates + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_008 { + + type component GeneralComp { + } + + template integer m_test(in integer p_val) := 5 + p_val; + + function f_caller(in template integer p_val) { + if (match(8, m_test(p_val))) { // tested parameter passing + setverdict(pass); + } else { + setverdict(fail); + } + } + + + testcase TC_NegSem_050402_actual_parameters_008() runs on GeneralComp { + f_caller(3); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as in formal value parameters of templates > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_009 NegSem_050402_actual_parameters_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as in formal value parameters of templates + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_009 { + + type component GeneralComp { + } + + template integer m_test(in integer p_val) := 5 + p_val; + + function f_caller(out template integer p_val) { + p_val := 4; // out parameter shall have a value before we can pass it to a function + if (match(9, m_test(p_val))) { // tested parameter passing + setverdict(pass); + } else { + setverdict(fail); + } + } + + + testcase TC_NegSem_050402_actual_parameters_009() runs on GeneralComp { + var template integer v_val; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as in formal value parameters of templates > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_010 NegSem_050402_actual_parameters_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as in formal value parameters of templates + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_010 { + + type component GeneralComp { + } + + template integer m_test(in integer p_val) := 5 + p_val; + + function f_caller(inout template integer p_val) { + if (match(10, m_test(p_val))) { // tested parameter passing + setverdict(pass); + } else { + setverdict(fail); + } + } + + + testcase TC_NegSem_050402_actual_parameters_010() runs on GeneralComp { + var template integer v_val := 5; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as in formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_011 NegSem_050402_actual_parameters_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as in formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_011 { + + type component GeneralComp { + timer t := 0.0; + } + + template integer m_msg := 1; + + altstep a_test(integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_011() runs on GeneralComp { + t.start; + a_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_011()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_011.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as in formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_012 NegSem_050402_actual_parameters_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as in formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_012 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_012() runs on GeneralComp { + var template integer vm_msg := 2; + t.start; + a_test(vm_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_012()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as in formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_014 NegSem_050402_actual_parameters_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as in formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_014 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(out template integer p_val) runs on GeneralComp { + p_val := 4; // out parameter shall have a value before we can pass it to a function + a_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_014() runs on GeneralComp { + var template integer v_val; + t.start; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_014()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as in formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_015 NegSem_050402_actual_parameters_015.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as in formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_015 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(inout template integer p_val) runs on GeneralComp { + a_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_015() runs on GeneralComp { + var template integer v_val := 5; + t.start; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_015()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as in formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_016 NegSem_050402_actual_parameters_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as in formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_016 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + testcase TC_NegSem_050402_actual_parameters_016(in integer p_val) runs on GeneralComp { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_016(m_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_016.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as in formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_017 NegSem_050402_actual_parameters_017.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as in formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_017 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_017(in integer p_val) runs on GeneralComp { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + var template integer vm_msg := 2; + execute(TC_NegSem_050402_actual_parameters_017(vm_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as in formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_018 NegSem_050402_actual_parameters_018.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as in formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_018 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_018(in integer p_val) runs on GeneralComp { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template integer p_val) { + execute(TC_NegSem_050402_actual_parameters_018(p_val)); // tested parameter passing + } + + control { + f_caller(3); // this parameter passing is not a subject of the test + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as in formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_019 NegSem_050402_actual_parameters_019.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as in formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_019 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_019(in integer p_val) runs on GeneralComp { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(out template integer p_val) { + p_val := 4; // out parameter shall have a value before we can pass it to a function + execute(TC_NegSem_050402_actual_parameters_019(p_val)); // tested parameter passing + } + + control { + var template integer vm_val; + f_caller(vm_val); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as in formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_020 NegSem_050402_actual_parameters_020.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as in formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed by value to in formal value parameters shall be +// variables, literal values, module parameters, constants, variables, value returning +// (external) functions, formal value parameters (of in, inout or out parameterization) +// of the current scope or expressions composed of the above. + +module NegSem_050402_actual_parameters_020 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_020(in integer p_val) runs on GeneralComp { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(inout template integer p_val) { + execute(TC_NegSem_050402_actual_parameters_020(p_val)); // tested parameter passing + } + + control { + var template integer vm_val := 5; + f_caller(vm_val); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_021 NegSem_050402_actual_parameters_021.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_021 { + + type component GeneralComp { + } + + function f_test(inout integer p_val) { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_021() runs on GeneralComp { + f_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_021()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_022 NegSem_050402_actual_parameters_022.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_022 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + function f_test(inout integer p_val) { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_022() runs on GeneralComp { + f_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_022()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_023 NegSem_050402_actual_parameters_023.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_023 { + + type component GeneralComp { + } + + const integer c_val := 3; + + function f_test(inout integer p_val) { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_023() runs on GeneralComp { + f_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_023()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of constant +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_024 NegSem_050402_actual_parameters_024.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_024 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + function f_test(inout integer p_val) { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_024() runs on GeneralComp { + f_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_024()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of function +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_025 NegSem_050402_actual_parameters_025.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_025 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + function f_test(inout integer p_val) { + if (p_val == 9) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_025() runs on GeneralComp { + var integer v_val := 5; + f_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_025()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_026 NegSem_050402_actual_parameters_026.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_026 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + function f_test(inout integer p_val) { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_026() runs on GeneralComp { + f_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_026()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_027 NegSem_050402_actual_parameters_027.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_027 { + + type component GeneralComp { + } + + function f_test(inout integer p_val) { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_027() runs on GeneralComp { + var template integer vm_msg := 2; + f_test(vm_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_027()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_028 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_028 NegSem_050402_actual_parameters_028.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_028 { + + type component GeneralComp { + } + + function f_test(inout integer p_val) { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template integer p_val) { + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_028() runs on GeneralComp { + f_caller(3); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_028()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_029 NegSem_050402_actual_parameters_029.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_029 { + + type component GeneralComp { + } + + function f_test(inout integer p_val) { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(out template integer p_val) { + p_val := 4; // out parameter shall have a value before we can pass it to a function + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_029() runs on GeneralComp { + var template integer v_val; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_029()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_030 NegSem_050402_actual_parameters_030.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_030 { + + type component GeneralComp { + } + + function f_test(in integer p_val) { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(inout template integer p_val) { + f_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_030() runs on GeneralComp { + var template integer v_val := 5; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_030()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variable element reference cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_031 NegSem_050402_actual_parameters_031.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variable element reference cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_031 { + + type component GeneralComp { + } + + type record R { + integer field1 + } + + function f_test(inout integer p_val) { + if (p_val == 10) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_031() runs on GeneralComp { + var template R v_val := { field1 := 10 }; + f_test(v_val.field1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_031()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_032 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_032 NegSem_050402_actual_parameters_032.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_032 { + + type component GeneralComp { + } + + type record R { + integer field1 + } + + function f_test(inout integer p_val) { + if (p_val == 11) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template R p_param) { + f_test(p_param.field1); // tested parameter passing + } + + testcase TC_NegSem_050402_actual_parameters_032() runs on GeneralComp { + f_caller({field1 := 11 }); + } + + control { + execute(TC_NegSem_050402_actual_parameters_032()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_033 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_033 NegSem_050402_actual_parameters_033.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_033 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_033() runs on GeneralComp { + t.start; + a_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_033()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_034 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_034 NegSem_050402_actual_parameters_034.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_034 { + + type component GeneralComp { + timer t := 0.0; + } + + modulepar integer PX_VAL := 2; + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_034() runs on GeneralComp { + t.start; + a_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_034()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_035 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_035 NegSem_050402_actual_parameters_035.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_035 { + + type component GeneralComp { + timer t := 0.0; + } + + const integer c_val := 3; + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_035() runs on GeneralComp { + t.start; + a_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_035()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of constant `@NegSem_050402_actual_parameters_035.c_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_036 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_036 NegSem_050402_actual_parameters_036.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_036 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 5; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_036() runs on GeneralComp { + t.start; + a_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_036()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of function `@NegSem_050402_actual_parameters_036.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_037 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_037 NegSem_050402_actual_parameters_037.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_037 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 4; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 9) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_037() runs on GeneralComp { + var integer v_val := 5; + t.start; + a_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_037()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_038 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_038 NegSem_050402_actual_parameters_038.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_038 { + + type component GeneralComp { + timer t := 0.0; + } + + template integer m_msg := 1; + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_038() runs on GeneralComp { + t.start; + a_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_038()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_039 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_039 NegSem_050402_actual_parameters_039.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_039 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_039() runs on GeneralComp { + var template integer vm_msg := 2; + t.start; + a_test(vm_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_039()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_040 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_040 NegSem_050402_actual_parameters_040.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types.. + +module NegSem_050402_actual_parameters_040 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(in template integer p_val) runs on GeneralComp { + a_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_040() runs on GeneralComp { + t.start; + f_caller(3); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_040()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_041 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template out parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_041 NegSem_050402_actual_parameters_041.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_041 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(out template integer p_val) runs on GeneralComp { + p_val := 4; // out parameter shall have a value before we can pass it to a function + a_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_041() runs on GeneralComp { + var template integer v_val; + t.start; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_041()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_042 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_042 NegSem_050402_actual_parameters_042.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_042 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(inout template integer p_val) runs on GeneralComp { + a_test(p_val); // tested parameter passing + } + + + testcase TC_NegSem_050402_actual_parameters_042() runs on GeneralComp { + var template integer v_val := 5; + t.start; + f_caller(v_val); // this parameter passing is not a subject of the test + } + + control { + execute(TC_NegSem_050402_actual_parameters_042()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_043 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variable element reference cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_043 NegSem_050402_actual_parameters_043.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variable element reference cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_043 { + + type component GeneralComp { + timer t := 0.0; + } + + type record R { + integer field1 + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 10) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_043() runs on GeneralComp { + var template R v_val := { field1 := 10 }; + t.start; + a_test(v_val.field1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_043()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_044 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_044 NegSem_050402_actual_parameters_044.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_044 { + + type component GeneralComp { + timer t := 0.0; + } + + type record R { + integer field1 + } + + altstep a_test(inout integer p_val) runs on GeneralComp { + []t.timeout { + if (p_val == 11) { setverdict(pass); } + else { setverdict(fail); } + } + } + + function f_caller(in template R p_param) runs on GeneralComp { + a_test(p_param.field1); // tested parameter passing + } + + testcase TC_NegSem_050402_actual_parameters_044() runs on GeneralComp { + t.start; + f_caller({field1 := 11 }); + } + + control { + execute(TC_NegSem_050402_actual_parameters_044()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_045 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_045 NegSem_050402_actual_parameters_045.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_045 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_045(inout integer p_val) runs on GeneralComp { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_045(1)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_046 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_046 NegSem_050402_actual_parameters_046.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_046 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + testcase TC_NegSem_050402_actual_parameters_046(inout integer p_val) runs on GeneralComp { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_046(PX_VAL)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_047 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_047 NegSem_050402_actual_parameters_047.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_047 { + + type component GeneralComp { + } + + const integer c_val := 3; + + testcase TC_NegSem_050402_actual_parameters_047(inout integer p_val) runs on GeneralComp { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_047(c_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of constant +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_048 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_048 NegSem_050402_actual_parameters_048.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_048 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + testcase TC_NegSem_050402_actual_parameters_048(inout integer p_val) runs on GeneralComp { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_048(f_ret())); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of function `@NegSem_050402_actual_parameters_048.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_049 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_049 NegSem_050402_actual_parameters_049.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_049 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + testcase TC_NegSem_050402_actual_parameters_049(inout integer p_val) runs on GeneralComp { + if (p_val == 9) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + var integer v_val := 5; + execute(TC_NegSem_050402_actual_parameters_049(10 + f_ret() - v_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_050 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_050 NegSem_050402_actual_parameters_050.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_050 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + testcase TC_NegSem_050402_actual_parameters_050(inout integer p_val) runs on GeneralComp { + if (p_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_050(m_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template `@NegSem_050402_actual_parameters_050.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_051 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variables cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_051 NegSem_050402_actual_parameters_051.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variables cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. +module NegSem_050402_actual_parameters_051 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_051(inout integer p_val) runs on GeneralComp { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + var template integer vm_msg := 2; + execute(TC_NegSem_050402_actual_parameters_051(vm_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_052 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_052 NegSem_050402_actual_parameters_052.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template in parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_052 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_052(inout integer p_val) runs on GeneralComp { + if (p_val == 3) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template integer p_val) { + execute(TC_NegSem_050402_actual_parameters_052(p_val)); // tested parameter passing + } + + control { + f_caller(3); // this parameter passing is not a subject of the test + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_053 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template in parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_053 NegSem_050402_actual_parameters_053.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template out parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_053 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_053(inout integer p_val) runs on GeneralComp { + if (p_val == 4) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(out template integer p_val) { + p_val := 4; // out parameter shall have a value before we can pass it to a function + execute(TC_NegSem_050402_actual_parameters_053(p_val)); // tested parameter passing + } + + control { + var template integer vm_val; + f_caller(vm_val); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_054 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template inout parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_054 NegSem_050402_actual_parameters_054.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template inout parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_054 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_054(inout integer p_val) runs on GeneralComp { + if (p_val == 5) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(inout template integer p_val) { + execute(TC_NegSem_050402_actual_parameters_054(p_val)); // tested parameter passing + } + + control { + var template integer vm_val := 5; + f_caller(vm_val); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `inout' template parameter `p_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_055 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template variable element reference cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_055 NegSem_050402_actual_parameters_055.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template variable element reference cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_055 { + + type component GeneralComp { + } + + type record R { + integer field1 + } + + testcase TC_NegSem_050402_actual_parameters_055(inout integer p_val) runs on GeneralComp { + if (p_val == 10) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + var template R v_val := { field1 := 10 }; + execute(TC_NegSem_050402_actual_parameters_055(v_val.field1)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_056 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_056 NegSem_050402_actual_parameters_056.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that reference to elements of formal value parameters cannot be used as inout formal value parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. + +module NegSem_050402_actual_parameters_056 { + + type component GeneralComp { + } + + type record R { + integer field1 + } + + testcase TC_NegSem_050402_actual_parameters_056(inout integer p_val) runs on GeneralComp { + if (p_val == 11) { setverdict(pass); } + else { setverdict(fail); } + } + + function f_caller(in template R p_param) { + execute(TC_NegSem_050402_actual_parameters_056(p_param.field1)); // tested parameter passing + } + + control { + f_caller({field1 := 11 }); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_057 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_057 NegSem_050402_actual_parameters_057.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_057 { + + type component GeneralComp { + } + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_057() runs on GeneralComp { + f_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_057()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_058 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_058 NegSem_050402_actual_parameters_058.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_058 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_058() runs on GeneralComp { + f_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_058()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of module parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_059 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_059 NegSem_050402_actual_parameters_059.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_059 { + + type component GeneralComp { + } + + const integer c_val := 3; + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_059() runs on GeneralComp { + f_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_059()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_060 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_060 NegSem_050402_actual_parameters_060.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_060 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_060() runs on GeneralComp { + f_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_060()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of function +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_061 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_061 NegSem_050402_actual_parameters_061.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_061 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_061() runs on GeneralComp { + var integer v_val := 5; + f_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_061()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_062 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as out formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_062 NegSem_050402_actual_parameters_062.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as out formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_062 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + function f_test(out template integer p_val) { + p_val := ?; + setverdict(pass); + } + + testcase TC_NegSem_050402_actual_parameters_062() runs on GeneralComp { + f_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_062()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of template `@NegSem_050402_actual_parameters_062.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_063 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_063 NegSem_050402_actual_parameters_063.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_063 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_063() runs on GeneralComp { + t.start; + a_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_063()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_064 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_064 NegSem_050402_actual_parameters_064.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_064 { + + type component GeneralComp { + timer t := 0.0; + } + + modulepar integer PX_VAL := 2; + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_064() runs on GeneralComp { + t.start; + a_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_064()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of module parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_065 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_065 NegSem_050402_actual_parameters_065.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_065 { + + type component GeneralComp { + timer t := 0.0; + } + + const integer c_val := 3; + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_065() runs on GeneralComp { + t.start; + a_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_065()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_066 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_066 NegSem_050402_actual_parameters_066.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_066 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 5; + } + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_066() runs on GeneralComp { + t.start; + a_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_066()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of function +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_067 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_067 NegSem_050402_actual_parameters_067.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_067 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 4; + } + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_067() runs on GeneralComp { + var integer v_val := 5; + t.start; + a_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_067()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_068 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as out formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_068 NegSem_050402_actual_parameters_068.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as out formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_068 { + + type component GeneralComp { + timer t := 0.0; + } + + template integer m_msg := 1; + + altstep a_test(out template integer p_val) runs on GeneralComp { + []t.timeout { + p_val := ?; + setverdict(pass); + } + } + + testcase TC_NegSem_050402_actual_parameters_068() runs on GeneralComp { + t.start; + a_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_068()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_069 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_069 NegSem_050402_actual_parameters_069.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_069 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_069(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_069(1)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_070 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_070 NegSem_050402_actual_parameters_070.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_070 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + testcase TC_NegSem_050402_actual_parameters_070(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_070(PX_VAL)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of module parameter `@NegSem_050402_actual_parameters_070.PX_VAL' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_071 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_071 NegSem_050402_actual_parameters_071.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_071 { + + type component GeneralComp { + } + + const integer c_val := 3; + + testcase TC_NegSem_050402_actual_parameters_071(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_071(c_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_072 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_072 NegSem_050402_actual_parameters_072.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_072 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + testcase TC_NegSem_050402_actual_parameters_072(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_072(f_ret())); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of function `@NegSem_050402_actual_parameters_072.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_073 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_073 NegSem_050402_actual_parameters_073.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_073 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + testcase TC_NegSem_050402_actual_parameters_073(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + var integer v_val := 5; + execute(TC_NegSem_050402_actual_parameters_073(10 + f_ret() - v_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_074 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as out formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_074 NegSem_050402_actual_parameters_074.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as out formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to out formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_074 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + testcase TC_NegSem_050402_actual_parameters_074(out template integer p_val) runs on GeneralComp { + p_val := ?; + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_074(m_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of template `@NegSem_050402_actual_parameters_074.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_075 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_075 NegSem_050402_actual_parameters_075.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_075 { + + type component GeneralComp { + } + + function f_test(inout template integer p_val) { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_075() runs on GeneralComp { + f_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_075()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_076 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_076 NegSem_050402_actual_parameters_076.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_076 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + function f_test(inout template integer p_val) { + if (match(2, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_076() runs on GeneralComp { + f_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_076()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of module parameter `@NegSem_050402_actual_parameters_076.PX_VAL' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_077 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_077 NegSem_050402_actual_parameters_077.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_077 { + + type component GeneralComp { + } + + const integer c_val := 3; + + function f_test(inout template integer p_val) { + if (match(3, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_077() runs on GeneralComp { + f_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_077()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of constant `@NegSem_050402_actual_parameters_077.c_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_078 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_078 NegSem_050402_actual_parameters_078.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_078 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + function f_test(inout template integer p_val) { + if (match(5, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_078() runs on GeneralComp { + f_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_078()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of function `@NegSem_050402_actual_parameters_078.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_079 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_079 NegSem_050402_actual_parameters_079.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_079 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + function f_test(inout template integer p_val) { + if (match(9, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_079() runs on GeneralComp { + var integer v_val := 5; + f_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_079()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_080 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal template parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_080 NegSem_050402_actual_parameters_080.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal template parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_080 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + function f_test(inout template integer p_val) { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_080() runs on GeneralComp { + f_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_080()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of template `@NegSem_050402_actual_parameters_080.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_081 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_081 NegSem_050402_actual_parameters_081.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. +module NegSem_050402_actual_parameters_081 { + + type component GeneralComp { + timer t := 0.0; + } + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_081() runs on GeneralComp { + t.start; + a_test(1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_081()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_082 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_082 NegSem_050402_actual_parameters_082.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. +module NegSem_050402_actual_parameters_082 { + + type component GeneralComp { + timer t := 0.0; + } + + modulepar integer PX_VAL := 2; + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(2, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_082() runs on GeneralComp { + t.start; + a_test(PX_VAL); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_082()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of module parameter `@NegSem_050402_actual_parameters_082.PX_VAL' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_083 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_083 NegSem_050402_actual_parameters_083.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_083 { + + type component GeneralComp { + timer t := 0.0; + } + + const integer c_val := 3; + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(3, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_083() runs on GeneralComp { + t.start; + a_test(c_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_083()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of constant `@NegSem_050402_actual_parameters_083.c_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_084 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_084 NegSem_050402_actual_parameters_084.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_084 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 5; + } + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(5, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_084() runs on GeneralComp { + t.start; + a_test(f_ret()); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_084()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of function `@NegSem_050402_actual_parameters_084.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_085 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_085 NegSem_050402_actual_parameters_085.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_085 { + + type component GeneralComp { + timer t := 0.0; + } + + function f_ret() return integer { + return 4; + } + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(9, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_085() runs on GeneralComp { + var integer v_val := 5; + t.start; + a_test(10 + f_ret() - v_val); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_085()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_086 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal template parameters of altsteps > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_086 NegSem_050402_actual_parameters_086.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal template parameters of altsteps + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value parameters, formal template parameters or references +// to elements of variables, template variables, formal value parameters or formal template +// parameters of structured types. + +module NegSem_050402_actual_parameters_086 { + + type component GeneralComp { + timer t := 0.0; + } + + template integer m_msg := 1; + + altstep a_test(inout template integer p_val) runs on GeneralComp { + []t.timeout { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + } + + testcase TC_NegSem_050402_actual_parameters_086() runs on GeneralComp { + t.start; + a_test(m_msg); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_086()); + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of template `@NegSem_050402_actual_parameters_086.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_087 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that literals cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_087 NegSem_050402_actual_parameters_087.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that literals cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_087 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_087(inout template integer p_val) runs on GeneralComp { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_087(1)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_088 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that module parameters cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_088 NegSem_050402_actual_parameters_088.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that module parameters cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_088 { + + type component GeneralComp { + } + + modulepar integer PX_VAL := 2; + + testcase TC_NegSem_050402_actual_parameters_088(inout template integer p_val) runs on GeneralComp { + if (match(2, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_088(PX_VAL)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of module parameter `@NegSem_050402_actual_parameters_088.PX_VAL' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_089 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that constants cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_089 NegSem_050402_actual_parameters_089.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that constants cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_089 { + + type component GeneralComp { + } + + const integer c_val := 3; + + testcase TC_NegSem_050402_actual_parameters_089(inout template integer p_val) runs on GeneralComp { + if (match(3, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_089(c_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of constant `@NegSem_050402_actual_parameters_089.c_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_090 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that function calls cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_090 NegSem_050402_actual_parameters_090.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that function calls cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_090 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 5; + } + + testcase TC_NegSem_050402_actual_parameters_090(inout template integer p_val) runs on GeneralComp { + if (match(5, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_090(f_ret())); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of function `@NegSem_050402_actual_parameters_090.f_ret' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_091 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that expressions cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_091 NegSem_050402_actual_parameters_091.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that expressions cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_091 { + + type component GeneralComp { + } + + function f_ret() return integer { + return 4; + } + + testcase TC_NegSem_050402_actual_parameters_091(inout template integer p_val) runs on GeneralComp { + if (match(9, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + var integer v_val := 5; + execute(TC_NegSem_050402_actual_parameters_091(10 + f_ret() - v_val)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_092 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that template parameters cannot be used as inout formal template parameters of test cases > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_092 NegSem_050402_actual_parameters_092.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that template parameters cannot be used as inout formal template parameters of test cases + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal template parameters shall be variables, +// template variables, formal value or template parameters (of in, inout or out +// parameterization) of the current scope or references to elements of (template) variables +// or formal (template) parameters of structured types. + +module NegSem_050402_actual_parameters_092 { + + type component GeneralComp { + } + + template integer m_msg := 1; + + testcase TC_NegSem_050402_actual_parameters_092(inout template integer p_val) runs on GeneralComp { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_092(m_msg)); // tested parameter passing + } +} +<END_MODULE> + +<RESULT COUNT 1> + error: Reference to a template variable or template parameter was expected for an `inout' template parameter instead of template `@NegSem_050402_actual_parameters_092.m_msg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_093 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that referencing errors are detected in actual parameters passed to in formal value parameters > + +<COMPILE> + +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_050402_actual_parameters_093 NegSem_050402_actual_parameters_093.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that referencing errors are detected in actual parameters passed to in formal value parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When actual parameters that are passed to in formal value or template parameters +// contain a value or template reference, rules for using references on the right hand +// side of assignments apply. + +module NegSem_050402_actual_parameters_093 { + + type component GeneralComp { + } + + type record R { + integer field1, + record { + integer subfield1, + integer subfield2 + } field2 optional + } + + function f_test(in integer p_val) { + if (p_val == 2) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_093() runs on GeneralComp { + var R v_rec := { + field1 := 1, + field2 := omit + } + f_test(v_rec.field2.subfield1); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_093()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using the value of an optional field containing omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_094 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that referencing errors are detected in actual parameters passed to in formal template parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_094 NegSem_050402_actual_parameters_094.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that referencing errors are detected in actual parameters passed to in formal template parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When actual parameters that are passed to in formal value or template parameters +// contain a value or template reference, rules for using references on the right hand +// side of assignments apply. + +module NegSem_050402_actual_parameters_094 { + + type component GeneralComp { + } + + type record R { + integer field1, + record { + integer subfield1, + integer subfield2 + } field2 optional + } + + template R mw_rec := { + field1 := 1, + field2 := * + } + + function f_test(in template integer p_val) { + if (match(255, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_094() runs on GeneralComp { + f_test(mw_rec.field2.subfield1); // tested parameter passing (using referencing rules specified at 15.6.2) + } + + control { + execute(TC_NegSem_050402_actual_parameters_094()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to field `subfield1' of any or omit `@NegSem_050402_actual_parameters_094.mw_rec.field2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_095 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that referencing errors are detected in actual parameters passed to in formal template parameters > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_050402_actual_parameters_095 NegSem_050402_actual_parameters_095.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that referencing errors are detected in actual parameters passed to out formal template parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When actual parameters that are passed to inout and out formal value or template +// parameters contain a value or template reference, rules for using references on +// the left hand side of assignments apply. + +module NegSem_050402_actual_parameters_095 { + + type component GeneralComp { + } + + type record R { + integer field1, + record { + integer subfield1, + integer subfield2 + } field2 optional + } + + function f_test(out template integer p_val) { + p_val := 10; + } + + testcase TC_NegSem_050402_actual_parameters_095() runs on GeneralComp { + var template R v_rec := { + field1 := 1, + field2 := ({ subfield1 := 0, subfield2 := 1}, { subfield1 := 2, subfield2 := 3 }) + }; + f_test(v_rec.field2.subfield1); // tested parameter passing (using referencing rules specified at 15.6.2) + if (valueof(v_rec.field2.subfield1) == 10 and match(0, v_rec.field2.subfield2)) { setverdict(pass); } + else { setverdict(fail); } + + } + + control { + execute(TC_NegSem_050402_actual_parameters_095()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Matching with an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_096 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that referencing rules are correctly applied to actual parameters of inout formal template parameters > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_050402_actual_parameters_096 NegSem_050402_actual_parameters_096.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that referencing rules are correctly applied to actual parameters of inout formal template parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When actual parameters that are passed to inout and out formal value or template +// parameters contain a value or template reference, rules for using references on +// the left hand side of assignments apply. + +module NegSem_050402_actual_parameters_096 { + + type component GeneralComp { + } + + type record R { + integer field1, + record { + integer subfield1, + integer subfield2 + } field2 optional + } + + function f_test(inout template integer p_val) { + p_val := 10; + } + + testcase TC_NegSem_050402_actual_parameters_096() runs on GeneralComp { + var template R v_rec := { + field1 := 1, + field2 := ({ subfield1 := 0, subfield2 := 1}, { subfield1 := 2, subfield2 := 3 }) + }; + // expected error since v_rec.field2.subfield1 not defined since v_rec.field2 is not *, ? or omit (see expansion rules) + f_test(v_rec.field2.subfield1); // tested parameter passing (using referencing rules specified at 15.6.2) + log(v_rec); + if (valueof(v_rec.field2.subfield1) == 10 and match(0, v_rec.field2.subfield2)) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_096()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Matching with an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_097 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that string item references cannot be used as inout formal value parameters of functions > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_097 NegSem_050402_actual_parameters_097.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that string item references cannot be used as inout formal value parameters of functions + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to inout formal value parameters shall be variables +// or formal value parameters (of in, inout or out parameterization) or references to +// elements of variables or formal value parameters of structured types. +// (see also the NOTE from 5.4.2) + +module NegSem_050402_actual_parameters_097 { + + type component GeneralComp { + } + + function f_test(inout charstring p_val) { + if (p_val == "t") { setverdict(pass); } + else { setverdict(fail); } + p_val := "r"; + } + + testcase TC_NegSem_050402_actual_parameters_097() runs on GeneralComp { + var charstring v_val := "test"; + f_test(v_val[0]); // tested parameter passing + } + + control { + execute(TC_NegSem_050402_actual_parameters_097()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a string element of type `charstring' cannot be used in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_098 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that ordinary values cannot be passed to timer parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_098 NegSem_050402_actual_parameters_098.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that ordinary values cannot be passed to timer parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to formal timer parameters shall be component +// timers, local timers or formal timer parameters of the current scope. + +module NegSem_050402_actual_parameters_098 { + + type component GeneralComp { + } + + function f_test(timer t_par) { + t_par.start; + if (t_par.running) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_098() runs on GeneralComp { + f_test(5.0); // tested parameter passing: it should not be possible to pass a float value to a timer parameter + } + + control { + execute(TC_NegSem_050402_actual_parameters_098()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a timer or timer parameter was expected for a timer parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_099 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that values cannot be passed to port parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_099 NegSem_050402_actual_parameters_099.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that values cannot be passed to port parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters that are passed to formal port parameters shall be component +// ports or formal port parameters of the current scope. + +module NegSem_050402_actual_parameters_099 { + + type port IntPort message { + inout integer; + } + + type component GeneralComp { + port IntPort p; + } + + function f_test(IntPort p_port) { + p_port.stop; + } + + testcase TC_NegSem_050402_actual_parameters_099() runs on GeneralComp { + var integer v_val := 5; + f_test(v_val); // tested parameter passing + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_099()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a port or port parameter was expected for a port parameter instead of variable `v_val' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_100 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that list notation containing actual parameters in wrong order is not accepted > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_100 NegSem_050402_actual_parameters_100.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that list notation containing actual parameters in wrong order is not accepted + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When using list notation, the order of elements in the actual parameter list shall +// be the same as their order in the corresponding formal parameter list. + +module NegSem_050402_actual_parameters_100 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2) { + if ( match(p_val1, 1) and match(p_val2, "test")) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_100() runs on GeneralComp { + f_test("test", 1); + } + + control { + execute(TC_NegSem_050402_actual_parameters_100()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> +<RESULT COUNT 1> +error: character string value was expected +<END_RESULT> +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_101 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that list notation containing less actual parameters than required is not accepted > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_101 NegSem_050402_actual_parameters_101.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that list notation containing less actual parameters than required is not accepted + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each formal parameter without a default there shall be an actual parameter. + +module NegSem_050402_actual_parameters_101 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2) { + if (p_val1 == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_101() runs on GeneralComp { + f_test(1); + } + + control { + execute(TC_NegSem_050402_actual_parameters_101()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Too few parameters: 2 was expected instead of 1 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_102 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that parameter without default value cannot be skipped > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_102 NegSem_050402_actual_parameters_102.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that parameter without default value cannot be skipped + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each formal parameter without a default there shall be an actual parameter. + +module NegSem_050402_actual_parameters_102 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2) { + if (p_val1 == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_102() runs on GeneralComp { + f_test(1, -); + } + + control { + execute(TC_NegSem_050402_actual_parameters_102()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Not used symbol \(`-'\) cannot be used for parameter that does not have default value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_103 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that mixing list and assignment notation is not allowed in parameterized calls (value as actual parameter) > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_103 NegSem_050402_actual_parameters_103.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that mixing list and assignment notation is not allowed in parameterized calls (value as actual parameter) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Either list notation or assignment notation shall be used in a single parameter +// list. They shall not be mixed. + +module NegSem_050402_actual_parameters_103 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2) { + if ( match(p_val1, 1) and match(p_val2, "test")) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_103() runs on GeneralComp { + f_test(p_val1 := 1, "test"); + } + + control { + execute(TC_NegSem_050402_actual_parameters_103()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `"': syntax error, unexpected Cstring +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_104 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that mixing list and assignment notation is not allowed in parameterized calls (skipped actual parameter) > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_104 NegSem_050402_actual_parameters_104.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that mixing list and assignment notation is not allowed in parameterized calls (skipped actual parameter) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Either list notation or assignment notation shall be used in a single parameter +// list. They shall not be mixed. + +module NegSem_050402_actual_parameters_104 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2 := "test") { + if ( match(p_val1, 1) and match(p_val2, "test")) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_104() runs on GeneralComp { + f_test(p_val1 := 1, -); + } + + control { + execute(TC_NegSem_050402_actual_parameters_104()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `-': syntax error, unexpected '-' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_105 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that parameters cannot be assigned more than once in assignment notation > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_105 NegSem_050402_actual_parameters_105.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that parameters cannot be assigned more than once in assignment notation + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When using assignment notation, each formal parameter shall be assigned an actual +// parameter at most once. + +module NegSem_050402_actual_parameters_105 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2) { + if (match(p_val1 == 1 and p_val2 == "test") { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_105() runs on GeneralComp { + f_test(p_val1 := 1, p_val2 := "test", p_val1 := 1); + } + + control { + execute(TC_NegSem_050402_actual_parameters_105()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\)': syntax error, unexpected '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_106 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that assignment notation that doesn't contain all parameters is not accepted > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_106 NegSem_050402_actual_parameters_106.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that assignment notation that doesn't contain all parameters is not accepted + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each formal parameter without default value, there shall be an actual parameter. + +module NegSem_050402_actual_parameters_106 { + + type component GeneralComp { + } + + function f_test (integer p_val1, charstring p_val2, integer p_val3) { + if (match(p_val1, 1) and match(p_val2, "test") and match(p_val3, 3)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_106() runs on GeneralComp { + f_test(p_val2 := "test", p_val3 := 3); + } + + control { + execute(TC_NegSem_050402_actual_parameters_106()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Parameter not specified +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_107 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible values cannot be passed to in formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_107 NegSem_050402_actual_parameters_107.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that incompatible values cannot be passed to in formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The type of each actual parameter shall be compatible with the type of each +// corresponding formal parameter. + +module NegSem_050402_actual_parameters_107 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 + } + + type record R2 { + integer elem1, + integer elem2 optional + } + + function f_test (R1 p_val) { + if (p_val == { field1 := 1, field2 := 2 }) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_107() runs on GeneralComp { + var R2 v_rec := { 1, 2 }; + f_test(v_rec); + } + + control { + execute(TC_NegSem_050402_actual_parameters_107()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_050402_actual_parameters_107.R1' was expected instead of `@NegSem_050402_actual_parameters_107.R2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_108 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible values cannot be passed from out formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_108 NegSem_050402_actual_parameters_108.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that incompatible values cannot be passed from out formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The type of each actual parameter shall be compatible with the type of each +// corresponding formal parameter. + +module NegSem_050402_actual_parameters_108 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 optional + } + + type record R2 { + integer elem1, + integer elem2 + } + + function f_test (out R1 p_val) { + p_val.field1 := 1; + p_val.field2 := 2; + } + + testcase TC_NegSem_050402_actual_parameters_108() runs on GeneralComp { + var R2 v_rec; + f_test(v_rec); + if (v_rec == { elem1 := 1, elem2 := 2 }) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_108()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: Reference to a variable or value parameter of type `@NegSem_050402_actual_parameters_108.R1' was expected instead of `@NegSem_050402_actual_parameters_108.R2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_109 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible values cannot be passed to inout formal parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_109 NegSem_050402_actual_parameters_109.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that incompatible values cannot be passed to inout formal parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Strong typing is required for parameters passed by reference. + +module NegSem_050402_actual_parameters_109 { + + type component GeneralComp { + } + + type record R1 { + integer field1, + integer field2 optional + } + + type record R2 { + integer elem1, + integer elem2 + } + + function f_test (inout R1 p_val) { + if (p_val == { field1 := 1, field2 := 2 }) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_109() runs on GeneralComp { + var R2 v_rec := { 1, 2 }; + f_test(v_rec); + } + + control { + execute(TC_NegSem_050402_actual_parameters_109()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: Reference to a variable or value parameter of type `@NegSem_050402_actual_parameters_109.R1' was expected instead of `@NegSem_050402_actual_parameters_109.R2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_111 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that incompatible templates cannot be passed to template parameters with omit restriction > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_111 NegSem_050402_actual_parameters_111.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that incompatible templates cannot be passed to template parameters with omit restriction + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters passed to restricted formal template parameters shall obey +// the restrictions given in clause 15.8. + +module NegSem_050402_actual_parameters_111 { + + type component GeneralComp { + } + + function f_test (omit integer p_val) { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_111() runs on GeneralComp { + f_test((0..10)); + } + + control { + execute(TC_NegSem_050402_actual_parameters_111()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template formal parameter does not allow usage of value range match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_112 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that compatible templates can be passed to template parameters with value restriction > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_112 NegSem_050402_actual_parameters_112.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that compatible templates can be passed to template parameters with value restriction + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters passed to restricted formal template parameters shall obey +// the restrictions given in clause 15.8. + +module NegSem_050402_actual_parameters_112 { + + type component GeneralComp { + } + + function f_test (template(value) integer p_val) { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_112() runs on GeneralComp { + f_test((1, 2, 3)); + } + + control { + execute(TC_NegSem_050402_actual_parameters_112()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template formal parameter does not allow usage of value list match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_113 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that compatible templates can be passed to template parameters with present restriction > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_113 NegSem_050402_actual_parameters_113.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that compatible templates can be passed to template parameters with present restriction + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Actual parameters passed to restricted formal template parameters shall obey +// the restrictions given in clause 15.8. + +module NegSem_050402_actual_parameters_113 { + + type component GeneralComp { + } + + function f_test (template(present) integer p_val) { + if (match(1, p_val)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_113() runs on GeneralComp { + f_test(*); + } + + control { + execute(TC_NegSem_050402_actual_parameters_113()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template formal parameter does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_114 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that compatible templates can be passed to template parameters with present restriction > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_114 NegSem_050402_actual_parameters_114.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that parametrized entities used as actual parameter cannot be passed without parameter list + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// All parameterized entities specified as an actual parameter shall have their +// own parameters resolved in the top-level actual parameter list. + +module NegSem_050402_actual_parameters_114 { + + type component GeneralComp { + } + + type record R { + integer field1, + integer field2 optional + } + + template R mw_rec(template integer p_field2) := { + field1 := 1, + field2 := p_field2 + } + + function f_test (template R p_match) { + if (match({1, omit}, p_match)) { setverdict(pass); } + else { setverdict(fail); } + } + + testcase TC_NegSem_050402_actual_parameters_114() runs on GeneralComp { + f_test(mw_rec); + } + + control { + execute(TC_NegSem_050402_actual_parameters_114()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to parameterized definition `mw_rec' without actual parameter list +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_115 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated when no actual parameter list is used for functions with no parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_115 NegSem_050402_actual_parameters_115.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that error is generated when no actual parameter list is used for functions with no parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the formal parameter list of TTCN-3 objects function, testcase, signature, +// altstep or external function is empty, then the empty parentheses shall be +// included both in the declaration and in the invocation of that object. In all +// other cases the empty parentheses shall be omitted. + +module NegSem_050402_actual_parameters_115 { + + type component GeneralComp { + } + + function f_test () return integer { + setverdict(pass); + return 1; + } + + testcase TC_NegSem_050402_actual_parameters_115() runs on GeneralComp { + log(f_test); + } + + control { + execute(TC_NegSem_050402_actual_parameters_115()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to parameterized definition `f_test' without actual parameter list +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_116 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated when no actual parameter list is used for test cases with no parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_116 NegSem_050402_actual_parameters_116.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that error is generated when no actual parameter list is used for test cases with no parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the formal parameter list of TTCN-3 objects function, testcase, signature, +// altstep or external function is empty, then the empty parentheses shall be +// included both in the declaration and in the invocation of that object. In all +// other cases the empty parentheses shall be omitted. + +module NegSem_050402_actual_parameters_116 { + + type component GeneralComp { + } + + testcase TC_NegSem_050402_actual_parameters_116() runs on GeneralComp { + setverdict(pass); + } + + control { + execute(TC_NegSem_050402_actual_parameters_116); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\)': syntax error, unexpected '\)', expecting '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_117 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated when no actual parameter list is used for altsteps with no parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_117 NegSem_050402_actual_parameters_117.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that error is generated when no actual parameter list is used for altsteps with no parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the formal parameter list of TTCN-3 objects function, testcase, signature, +// altstep or external function is empty, then the empty parentheses shall be +// included both in the declaration and in the invocation of that object. In all +// other cases the empty parentheses shall be omitted. + +module NegSem_050402_actual_parameters_117 { + + type component GeneralComp { + } + + altstep a_test () { + [] any timer.timeout { setverdict(pass); } + } + + testcase TC_NegSem_050402_actual_parameters_117() runs on GeneralComp { + timer t_instant := 0.0; + t_instant.start; + alt { + [] a_test { + setverdict(pass); + } + } + } + + control { + execute(TC_NegSem_050402_actual_parameters_117()); + } +} +<END_MODULE> + + +<RESULT COUNT 1> +error: at or before token `\{': syntax error, unexpected '\{' +<END_RESULT> +<RESULT COUNT 1> +error: at or before token `control': syntax error, unexpected ControlKeyword, expecting \$end +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_118 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated when empty actual parameter list is used for templates with no parameters > + +<COMPILE> + +<MODULE TTCN NegSem_050402_actual_parameters_118 NegSem_050402_actual_parameters_118.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.4.2, verify that error is generated when empty actual parameter list is used for templates with no parameters + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the formal parameter list of TTCN-3 objects function, testcase, signature, +// altstep or external function is empty, then the empty parentheses shall be +// included both in the declaration and in the invocation of that object. In all +// other cases the empty parentheses shall be omitted. + +module NegSem_050402_actual_parameters_118 { + + type component GeneralComp { + } + + template integer mw_allInt := ?; + + testcase TC_NegSem_050402_actual_parameters_118() runs on GeneralComp { + if (match(1, mw_allInt())) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_050402_actual_parameters_118()); + } +} +<END_MODULE> + + +<RESULT COUNT 1> +error: The referenced template `@NegSem_050402_actual_parameters_118.mw_allInt' cannot have actual parameters +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0505_cyclic_definitions folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0505_cyclic_definitions_001 test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that an error is detected when two constants reference each other > + +<COMPILE> + +<MODULE TTCN NegSem_0505_cyclic_definitions_001 NegSem_0505_cyclic_definitions_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.5, Verify that an error is detected when two constants reference each other + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Direct and indirect cyclic definitions are not allowed with the exception of the +// following cases: +// a) for recursive type definitions (see clause 6.2); +// b) function and altstep definitions (i.e. recursive function or altstep calls); +// c) cyclic import definitions, if the imported definitions only form allowed cyclic +// definitions. +// The test is a copy of example 1 from the chapter 5.5 +module NegSem_0505_cyclic_definitions_001 { + + type record ARecordType { integer a, integer b }; + const ARecordType c_test1 := { 1 , c_test2.b}; // c_test1 refers to c_test2 + const ARecordType c_test2 := { 1 , c_test1.b}; // c_test2 refers to c_test1 + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Circular reference in constant definition `c_test1' +<END_RESULT> +<RESULT COUNT 1> +error: Circular reference in constant definition `c_test2' +<END_RESULT> +<RESULT COUNT 1> +error: While searching referenced value: Circular reference: `@NegSem_0505_cyclic_definitions_001.c_test2.b' -> `@NegSem_0505_cyclic_definitions_001.c_test1.b' -> `@NegSem_0505_cyclic_definitions_001.c_test2.b' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0505_cyclic_definitions_002 test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that an error is detected when a forbidded cyclic reference occurs in cyclic import > + +<COMPILE> + +<MODULE TTCN NegSem_0505_cyclic_definitions_002 NegSem_0505_cyclic_definitions_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:5.5, Verify that an error is detected when a forbidded cyclic reference occurs in cyclic import + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Direct and indirect cyclic definitions are not allowed with the exception of the +// following cases: +// a) for recursive type definitions (see clause 6.2); +// b) function and altstep definitions (i.e. recursive function or altstep calls); +// c) cyclic import definitions, if the imported definitions only form allowed cyclic +// definitions. +// The test is a modification of example 1 from the chapter 5.5 that defines both constants +// in different modules. + +module NegSem_0505_cyclic_definitions_002 { + import from NegSem_0505_cyclic_definitions_002_import { const c_test1 } + type record ARecordType { integer a, integer b }; + const ARecordType c_test2 := { 1 , c_test1.b}; // c_test2 refers to c_test1 +} +<END_MODULE> + +<MODULE TTCN NegSem_0505_cyclic_definitions_002_import NegSem_0505_cyclic_definitions_002_import.ttcn > +module NegSem_0505_cyclic_definitions_002_import { + import from NegSem_0505_cyclic_definitions_002 all; + const ARecordType c_test1 := { 1 , c_test2.b}; // c_test1 refers to c_test2 +} +<END_MODULE> + +<RESULT COUNT 1> +error: Circular reference in constant definition `c_test1' +<END_RESULT> +<RESULT COUNT 1> +error: Circular reference in constant definition `c_test2' +<END_RESULT> +<RESULT COUNT 1> +error: While searching referenced value: Circular reference: `@NegSem_0505_cyclic_definitions_002.c_test2.b' -> `@NegSem_0505_cyclic_definitions_002_import.c_test1.b' -> `@NegSem_0505_cyclic_definitions_002.c_test2.b' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/06_types_and_values.script b/conformance_test/negative_tests/06_types_and_values.script new file mode 100644 index 0000000000000000000000000000000000000000..470ecac2eba1a16e085168653e9dcafc66e95adb --- /dev/null +++ b/conformance_test/negative_tests/06_types_and_values.script @@ -0,0 +1,8161 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 06_types_and_values folder. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 0601_basic_types_and_values folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign float to integer values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_001 NegSem_0501_Identifier_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign float to integer values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_001 { + const integer c_i1 := 0.0; // not an integer value +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign boolean to integer values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_002 NegSem_0501_Identifier_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign boolean to integer values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_002 { + const integer c_i1 := true; // not an integer value +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign integer to float values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_003 NegSem_0501_Identifier_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign integer to float values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_003 { + const float c_f1 := 0; // not a float value +} +<END_MODULE> + +<RESULT COUNT 1> +error: float value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign boolean to float values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_004 NegSem_0501_Identifier_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign boolean to float values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_004 { + const float c_f1 := true; // not a float value +} +<END_MODULE> + +<RESULT COUNT 1> +error: float value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign verdicttype to float values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_005 NegSem_0501_Identifier_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign verdicttype to float values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_005 { + const float c_f1 := pass; // not a float value +} +<END_MODULE> + +<RESULT COUNT 1> +error: float value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign integer to verdicttype values > + +<COMPILE> + +<MODULE TTCN NegSem_0501_Identifier_006 NegSem_0501_Identifier_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.0, Assign integer to verdicttype values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060100_SimpleBasicTypes_006 { + const verdicttype c_v1 := 1; // not a verdict +} +<END_MODULE> + +<RESULT COUNT 1> +error: verdict value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid bitstring value > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_001 NegSyn_060101_TopLevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign invalid bitstring value + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_001 { + const bitstring c_b1 := '2'B; // not an bitstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: Bitstring value contains invalid character +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign string to bitstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_002 NegSyn_060101_TopLevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign string to bitstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_002 { + const bitstring c_b1 := "1"; // not an bitstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: bitstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign octetstring to bitstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_003 NegSyn_060101_TopLevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign octetstring to bitstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_003 { + const bitstring c_b1 := '01'O; // not an bitstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: bitstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid hexstring value > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_004 NegSyn_060101_TopLevel_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign invalid hexstring value + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_004 { + const hexstring c_b1 := '01H'O; // not an hexstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: Invalid character `H' \(0x48\) in binary string +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign string to hexstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_005 NegSyn_060101_TopLevel_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign string to hexstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_005 { + const hexstring c_b1 := "010"; // not an hexstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: hexstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign octetstring to hexstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_006 NegSyn_060101_TopLevel_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign octetstring to hexstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_006 { + const hexstring c_b1 := '01'O; // not an hexstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: hexstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid octetstring value > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_007 NegSyn_060101_TopLevel_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign invalid octetstring value + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_007 { + const octetstring c_b1 := '1FA'O; // not an octetstring value, odd number of nibbles +} +<END_MODULE> + +<RESULT COUNT 1> +error: Octetstring value contains odd number of hexadecimal digits +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign string to octetstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_008 NegSyn_060101_TopLevel_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign string to octetstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_008 { + const octetstring c_b1 := "F15A"; // not an octetstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: octetstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign hexstring to octetstring values > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_009 NegSyn_060101_TopLevel_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign hexstring to octetstring values + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_009 { + const octetstring c_b1 := 'FA'H; // not an octetstring value +} +<END_MODULE> + +<RESULT COUNT 1> +error: octetstring value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid hexstring value > + +<COMPILE> + +<MODULE TTCN NegSyn_060101_TopLevel_010 NegSyn_060101_TopLevel_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.1, Assign invalid hexstring value + ** @verdict pass reject + ***************************************************/ +module NegSyn_060101_TopLevel_010 { + const octetstring c_b1 := '1FAH'O; // not an octetstring value, H not valid +} +<END_MODULE> + +<RESULT COUNT 1> +error: Invalid character `H' \(0x48\) in binary string +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted bitstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_001 NegSem_06010201_ListOfValues_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted bitstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_001 { + type bitstring MyListOfBitStrings ('01'B, '10'B, '11'B); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_001() runs on GeneralComp { + var MyListOfBitStrings v_b := '00'B; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '00'B is not a valid value for type `bitstring' which has subtype length\(2\) except \('00'B\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted hexstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_002 NegSem_06010201_ListOfValues_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted hexstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_002 { + type hexstring MyListOfHexStrings ('01'H, '10'H); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_002() runs on GeneralComp { + var MyListOfHexStrings v_h := '00'H; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '00'H is not a valid value for type `hexstring' which has subtype \('01'H,'10'H\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted octetstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_003 NegSem_06010201_ListOfValues_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted octetstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_003 { + type octetstring MyListOfOctetStrings ('01'O, '10'O); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_003() runs on GeneralComp { + var MyListOfOctetStrings v_h := '00'O; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '00'O is not a valid value for type `octetstring' which has subtype \('01'O,'10'O\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_004 NegSem_06010201_ListOfValues_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_004 { + type charstring MyCharstr ("a", "abc"); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_004() runs on GeneralComp { + var MyCharstr v_b := "d"; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "d" is not a valid value for type `charstring' which has subtype \("a","abc"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted integer. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_005 NegSem_06010201_ListOfValues_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted integer. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_005 { + type integer MyInt (1, 5); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_005() runs on GeneralComp { + var MyInt v_i := 2; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 2 is not a valid value for type `integer' which has subtype \(1,5\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign values to restricted float. > + +<COMPILE> + +<MODULE TTCN NegSem_06010201_ListOfValues_006 NegSem_06010201_ListOfValues_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.1, Assign values to restricted float. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010201_ListOfValues_006 { + type float MyFloat (1.0, 5.0); + + type component GeneralComp {} + + testcase TC_NegSem_06010201_ListOfValues_006() runs on GeneralComp { + var MyFloat v_f := 2.0; // value is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010201_ListOfValues_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 2.0e0 is not a valid value for type `float' which has subtype \(1.0e0,5.0e0\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted bitstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_001 NegSem_06010202_ListOfTypes_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted bitstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_001 { + type bitstring BitStrings1 ('0'B, '1'B ); + type bitstring BitStrings2 ('00'B, '01'B, '10'B, '10'B); + type bitstring BitStrings_1_2 (BitStrings1, BitStrings2); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_001() runs on GeneralComp { + var BitStrings_1_2 v_b := '11'B; // 11 is not defined by the type + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '11'B is not a valid value for type `bitstring' which has subtype length\(1..2\) except \('11'B\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted hexstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_002 NegSem_06010202_ListOfTypes_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted hexstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_002 { + type hexstring HexStrings1 ('FE80'H, '01'H ); + type hexstring HexStrings2 ('00'H, '7F'H, 'B8'H, 'A0'H); + type hexstring HexStrings_1_2 (HexStrings1, HexStrings2); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_002() runs on GeneralComp { + var HexStrings_1_2 v_b; + v_b := 'FE70'H; //FE70 value is not defined by any hexstrings + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'FE70'H is not a valid value for type `hexstring' which has subtype \('00'H,'01'H,'7F'H,'A0'H,'B8'H,'FE80'H\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted octetstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_003 NegSem_06010202_ListOfTypes_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted octetstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_003 { + type octetstring Firstoctetstrings('0036'O,'0050'O); //30 and 40 in decimal + type octetstring Secondtoctetstrings ('0074'O,'0120'O); //50 and 60 in decimal + type octetstring octetStrings_1_2 (Firstoctetstrings, Secondtoctetstrings); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_003() runs on GeneralComp { + var octetStrings_1_2 v_b; + v_b := '0014'O; // '0014'O value is not defined + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '0014'O is not a valid value for type `octetstring' which has subtype \('0036'O,'0050'O,'0074'O,'0120'O\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_004 NegSem_06010202_ListOfTypes_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_004 { + type charstring Firstcharstrings("abc", "def"); + type charstring Secondcharstrings("ghi", "jkl"); + type charstring charStrings_1_2 (Firstcharstrings,Secondcharstrings); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_004() runs on GeneralComp { + var charStrings_1_2 v_b; + v_b := "xyz"; // invalid charsting + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "xyz" is not a valid value for type `charstring' which has subtype \("abc","def","ghi","jkl"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted universal charstrings. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_005 NegSem_06010202_ListOfTypes_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted universal charstrings. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_005 { + type universal charstring unicharString1 ("0" .. "9","A".."Z"); // charstring between "0" and "9" and "A".."Z" + type universal charstring unicharString2 ("a".."z"); // charstring between "a" to "z" + type universal charstring unicharStrings_1_2 (unicharString1, unicharString2); + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_005() runs on GeneralComp { + var unicharStrings_1_2 v_b; + v_b:="?"; // invalid + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "\?" is not a valid value for type `universal charstring' which has subtype \(from\("0".."9","A".."Z"\) union from\("a".."z"\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted integers. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_006 NegSem_06010202_ListOfTypes_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted integers. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_006 { + type integer Integer1 (0..9 ); + type integer Integer2 (20..30); + type integer Integer_1_2 (Integer1, Integer2); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_006() runs on GeneralComp { + var Integer_1_2 v_b; + v_b := 15; //invalid + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 15 is not a valid value for type `integer' which has subtype \(0..9,20..30\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted floats. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_007 NegSem_06010202_ListOfTypes_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted floats. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_007 { + type float Float1 (1.0E0..9E0); //float values between 1 and 9 + type float Float2 (2.0E1..3.0E1); //float values between 20 and 30 + type float Float_1_2 (Float1, Float2); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_007() runs on GeneralComp { + var Float_1_2 v_b; + v_b := 15.5E0; //invalid + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 1.55e1 is not a valid value for type `float' which has subtype \(1.0e0..9.0e0,2.0e1..3.0e1\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted boolean value. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_008 NegSem_06010202_ListOfTypes_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted boolean value. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_008 { + type boolean MyBoolean1 (false); //only "false" is accepted + type boolean MyBoolean2 (false); + type boolean MyBoolean_1_2 (MyBoolean1, MyBoolean2); + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_008() runs on GeneralComp { + var MyBoolean_1_2 v_b; + v_b := true; // invalid + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010202_ListOfTypes_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: true is not a valid value for type `boolean' which has subtype \(false\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to list of types restricted verdicttype. > + +<COMPILE> + +<MODULE TTCN NegSem_06010202_ListOfTypes_009 NegSem_06010202_ListOfTypes_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.2, Assign invalid values to list of types restricted verdicttype. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010202_ListOfTypes_009 { + type verdicttype Myverdict1 (pass, error); //only "pass" and "error" values are listed + type verdicttype Myverdict2 (inconc, none); //only "inconc" and "none" values are listed + type verdicttype Myverdict_1_2 (Myverdict1, Myverdict2); + + + type component GeneralComp {} + + testcase TC_NegSem_06010202_ListOfTypes_009() runs on GeneralComp { + var Myverdict_1_2 v_b; + v_b := fail; //invalid + setverdict(pass); + } + control{ + execute(TC_NegSem_06010202_ListOfTypes_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: fail is not a valid value for type `verdicttype' which has subtype \(none,pass,inconc,error\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted integer. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_001 NegSem_06010203_Ranges_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_001 { + type integer MyIntegerRange (0 .. 255); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_001() runs on GeneralComp { + var MyIntegerRange v_i := -1; // -1 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: -1 is not a valid value for type `integer' which has subtype \(0..255\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted integer. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_002 NegSem_06010203_Ranges_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_002 { + type integer MyIntegerRange (-infinity .. 0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_002() runs on GeneralComp { + var MyIntegerRange v_i := 1; // 1 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 1 is not a valid value for type `integer' which has subtype \(-infinity..0\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assure that not_a_number is not allowed in float range subtyping. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_003 NegSem_06010203_Ranges_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assure that not_a_number is not allowed in float range subtyping. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_003 { + // causes an error as not_a_number is not allowed in range subtyping + type float MyFloatRange (-infinity .. not_a_number); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_003() runs on GeneralComp { + var MyFloatRange v_i; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: upper boundary cannot be not_a_number in float subtype range +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted integer with exclusive bounds. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_004 NegSem_06010203_Ranges_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer with exclusive bounds. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_004 { + type integer MyIntegerRange (!-3 .. 0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_004() runs on GeneralComp { + var MyIntegerRange v_i := -3; // -3 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: -3 is not a valid value for type `integer' which has subtype \(-2..0\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted integer with exclusive bounds. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_005 NegSem_06010203_Ranges_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to restricted integer with exclusive bounds. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_005 { + type integer MyIntegerRange (-infinity .. !0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_005() runs on GeneralComp { + var MyIntegerRange v_i := 0; // 0 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 0 is not a valid value for type `integer' which has subtype \(-infinity..-1\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign range to boolean not permitted. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_006 NegSem_06010203_Ranges_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign range to boolean not permitted. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_006 { + // only restrictions for integer, float, charstring and universal charstring are allowed in ranges + type boolean MyBooleanRange (false .. true); // should be rejected + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_006() runs on GeneralComp { + var MyBooleanRange v_b1; + v_b1 := true; + v_b1 := false; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Range subtyping is not allowed for type `boolean' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_007 NegSem_06010203_Ranges_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_007 { + type charstring MyCharstringRange (!"a"..!"f"); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_007() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "a"; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "a" is not a valid value for type `charstring' which has subtype from\("b".."e"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_008 NegSem_06010203_Ranges_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_008 { + type charstring MyCharstringRange ("a"..!"f"); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_008() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "f"; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "f" is not a valid value for type `charstring' which has subtype from\("a".."e"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_009 NegSem_06010203_Ranges_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_009 { + type charstring MyCharstringRange ("a".."f"); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_009() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "g"; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "g" is not a valid value for type `charstring' which has subtype from\("a".."f"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted float. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_010 NegSem_06010203_Ranges_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to restricted float. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_010 { + type float MyFloatRange (-infinity .. 0.0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_010() runs on GeneralComp { + var MyFloatRange v_f := 1.0; // 1.0 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 1.0e0 is not a valid value for type `float' which has subtype \(-INF..0.0e0\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to restricted float. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_011 NegSem_06010203_Ranges_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to range restricted float. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_011 { + type float MyFloatRange (-5.0 .. 0.0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_011() runs on GeneralComp { + var MyFloatRange v_f := 10.0; // 10.0 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_011()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 1.0e1 is not a valid value for type `float' which has subtype \(-5.0e0..0.0e0\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to range excluded restricted float. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_012 NegSem_06010203_Ranges_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid values to range excluded restricted float. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_012 { + type float MyFloatRange (-1.0 .. !10.0); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_012() runs on GeneralComp { + var MyFloatRange v_f := 10.0; // 10.0 is outside range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_012()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 1.0e1 is not a valid value for type `float' which has subtype \(-1.0e0..!1.0e1\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained universal charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_013 NegSem_06010203_Ranges_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained universal charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_013 { + type universal charstring MyUCharString (char(0, 0, 1, 111) .. !char(0, 0, 1, 113)); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_013() runs on GeneralComp { + var MyUCharString v_uc1; + v_uc1 := char(0, 0, 1, 100); // out of range + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_013()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: char\(0, 0, 1, 100\) is not a valid value for type `universal charstring' which has subtype from\(char\(0, 0, 1, 111\)..char\(0, 0, 1, 112\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained universal charstring with mixed bounds. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_014 NegSem_06010203_Ranges_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained universal charstring with mixed bounds. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_014 { + type universal charstring MyUCharString (char(0, 0, 1, 111) .. !char(0, 0, 1, 113)); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_014() runs on GeneralComp { + var MyUCharString v_uc1; + v_uc1 := char(0, 0, 1, 113); // 113 is excluded + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_014()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: char\(0, 0, 1, 113\) is not a valid value for type `universal charstring' which has subtype from\(char\(0, 0, 1, 111\)..char\(0, 0, 1, 112\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid value to range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_015 NegSem_06010203_Ranges_015.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Assign invalid value to range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_015 { + type charstring MyCharstringRange ("a".."f"); + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_015() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "abcgef"; // g not allowed + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_015()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abcgef" is not a valid value for type `charstring' which has subtype from\("a".."f"\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Invalid value infinity for range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_016 NegSem_06010203_Ranges_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Invalid value infinity for range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_016 { + type charstring MyCharstringRange ("a"..infinity); // infinity not allowed for charstring + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_016() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "abcgef"; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_016()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: upper boundary of a charstring subtype range cannot be infinity +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Invalid value -infinity for range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010203_Ranges_017 NegSem_06010203_Ranges_017.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.3, Invalid value -infinity for range constrained charstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010203_Ranges_017 { + type charstring MyCharstringRange (-infinity.."d"); // -infinity not allowed for charstring + + type component GeneralComp {} + + testcase TC_NegSem_06010203_Ranges_017() runs on GeneralComp { + var MyCharstringRange v_c1; + v_c1 := "abcgef"; + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010203_Ranges_017()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: lower boundary of a charstring subtype range cannot be -infinity +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Invalid value -infinity for range constrained charstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_001 NegSem_06010204_StringLengthRestrict_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted bitstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_001 { + type bitstring BitStrings length(1 .. 2); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_001() runs on GeneralComp { + var BitStrings v_b := '111'B; // value length 3 != type length is 1 or 2 + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '111'B is not a valid value for type `bitstring' which has subtype length\(1..2\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted bitstring. > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_002 NegSem_06010204_StringLengthRestrict_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted bitstring. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_002 { + type bitstring BitStrings length(2); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_002() runs on GeneralComp { + var BitStrings v_b := '111'B; // value length 3 != type length is 2 + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '111'B is not a valid value for type `bitstring' which has subtype length\(2\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted hexstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_003 NegSem_06010204_StringLengthRestrict_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted hexstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_003 { + type hexstring HexStrings1 length(3); //3 hexadecimal digits + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_003() runs on GeneralComp { + var HexStrings1 v_b1; + v_b1 := 'FE00'H; //invalid length 4 + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'FE00'H is not a valid value for type `hexstring' which has subtype length\(3\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted hexstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_004 NegSem_06010204_StringLengthRestrict_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted hexstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_004 { + type hexstring HexStrings1 length(2 .. infinity); //hexadecimal digits between 2 and 5 + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_004() runs on GeneralComp { + var HexStrings1 v_b1; + v_b1 := 'A'H; //invalid length 1 + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'A'H is not a valid value for type `hexstring' which has subtype length\(2..infinity\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted octetstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_005 NegSem_06010204_StringLengthRestrict_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted octetstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_005 { + type octetstring ocStrings1 length(4); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_005() runs on GeneralComp { + var ocStrings1 v_b1; + v_b1 := 'FE8001'O; //3 octets invalid length + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'FE8001'O is not a valid value for type `octetstring' which has subtype length\(4\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted octetstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_006 NegSem_06010204_StringLengthRestrict_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted octetstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_006 { + type octetstring ocStrings1 length(2..infinity); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_006() runs on GeneralComp { + var ocStrings1 v_b1; + v_b1 := 'FE'O; //1 octet invalid length + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'FE'O is not a valid value for type `octetstring' which has subtype length\(2..infinity\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted charstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_007 NegSem_06010204_StringLengthRestrict_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted charstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_007{ + type charstring myStrings1 length(2..infinity); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_007() runs on GeneralComp { + var myStrings1 v_b1; + v_b1 := "a"; //1 charc. length + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "a" is not a valid value for type `charstring' which has subtype length\(2..infinity\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to length restricted charstring > + +<COMPILE> + +<MODULE TTCN NegSem_06010204_StringLengthRestrict_008 NegSem_06010204_StringLengthRestrict_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, Assign invalid values to length restricted charstring + ** @verdict pass reject + ***************************************************/ +module NegSem_06010204_StringLengthRestrict_008{ + type charstring myStrings1 length(2); + + type component GeneralComp {} + + testcase TC_NegSem_06010204_StringLengthRestrict_008() runs on GeneralComp { + var myStrings1 v_b1; + v_b1 := "abc"; //2 characters length req. + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010204_StringLengthRestrict_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abc" is not a valid value for type `charstring' which has subtype length\(2\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010204_StringLengthRestrict_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - upper boundary should be greater than lower boundary in string length restictions > + +<COMPILE> + +<MODULE TTCN NegSyn_06010204_StringLengthRestrict_001 NegSyn_06010204_StringLengthRestrict_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, upper boundary should be greater than lower boundary in string length restictions + ** @verdict pass reject + ***************************************************/ +module NegSyn_06010204_StringLengthRestrict_001 { + type hexstring HexStrings1 length(3 .. 1); // upper bound is smaller than lower bound + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The upper boundary of the length restriction \(1\) cannot be smaller than the lower boundary \(3\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010204_StringLengthRestrict_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - boundary integers should be non negative integers > + +<COMPILE> + +<MODULE TTCN NegSyn_06010204_StringLengthRestrict_002 NegSyn_06010204_StringLengthRestrict_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.4, boundary integers should be non negative integers + ** @verdict pass reject + ***************************************************/ +module NegSyn_06010204_StringLengthRestrict_002 { + type hexstring HexStrings1 length(0 .. -5); // negative boundary for length + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The upper boundary of the length restriction must be a non-negative integer value instead of -5 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010205_StringPattern_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to pattern restricted character strings. > + +<COMPILE> + +<MODULE TTCN NegSem_06010205_StringPattern_001 NegSem_06010205_StringPattern_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.5, Assign invalid values to pattern restricted character strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_06010205_StringPattern_001 { + type charstring MyString (pattern "?bc*xyz"); + + type component GeneralComp {} + + testcase TC_NegSem_06010205_StringPattern_001() runs on GeneralComp { + var MyString v_c := "abcyz"; // value missing x + setverdict(pass); + } + + control{ + execute(TC_NegSem_06010205_StringPattern_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abcyz" is not a valid value for type `charstring' which has subtype pattern\(\?bc\*xyz\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010205_StringPattern_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign quadruple values to pattern restricted character strings. > + +<COMPILE> + +<MODULE TTCN NegSyn_06010205_StringPattern_002 NegSyn_06010205_StringPattern_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.5, Assign quadruple values to pattern restricted character strings. + ** @verdict pass reject, noexecution + ***************************************************/ + +module NegSyn_06010205_StringPattern_002 { + type charstring MyString (pattern "\q{0,0,1,116}abc"); //error: not a legal character for the TTCN 3 charstring type + + + type component GeneralComp {} + + testcase TC_NegSyn_06010205_StringPattern_002() runs on GeneralComp { + var MyString v_c := "Å´abc"; //error: not a legal character of the TTCN 3 charstring type + } + + control{ + execute(TC_NegSyn_06010205_StringPattern_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: char\(0, 0, 0, 197\) & char\(0, 0, 0, 180\) \& "abc" is not a valid value for type `charstring' which has subtype pattern\(\\q\{0,0,1,116\}abc\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020601_MixingSubtype_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted floats. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020601_MixingSubtype_001 NegSem_0601020601_MixingSubtype_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.1, Assign invalid values to mixed restricted floats. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020601_MixingSubtype_001 { + type float lessThanPiAndNaN (-infinity .. 3142E-3, not_a_number); + + type component GeneralComp {} + + testcase TC_NegSem_0601020601_MixingSubtype_001() runs on GeneralComp { + var lessThanPiAndNaN v_f := 4.0; // value out of range + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020601_MixingSubtype_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 4.0e0 is not a valid value for type `float' which has subtype \(-INF..3.142e0,NaN\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020601_MixingSubtype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted integers. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020601_MixingSubtype_002 NegSem_0601020601_MixingSubtype_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.1, Assign invalid values to mixed restricted integers. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020601_MixingSubtype_002 { + type integer MyInt (1, 5, 10, 100 .. infinity); + + type component GeneralComp {} + + testcase TC_NegSem_0601020601_MixingSubtype_002() runs on GeneralComp { + var MyInt v_i := 6; // value out of range + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020601_MixingSubtype_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 6 is not a valid value for type `integer' which has subtype \(1,5,10,100..infinity\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted character strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_001 NegSem_0601020602_StringMixing_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_001 { + type charstring MyString (pattern "?bc*xyz") length (5 .. 8); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_001() runs on GeneralComp { + var MyString v_c := "abcyz"; // value missing x + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abcyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted character strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_002 NegSem_0601020602_StringMixing_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_002 { + type charstring MyString (pattern "?bc*xyz") length (5 .. 8); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_002() runs on GeneralComp { + var MyString v_c := "abc123xyz"; // value length 9 exceeds 8 + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abc123xyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted character strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_003 NegSem_0601020602_StringMixing_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted character strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_003 { + type charstring MyString ("a".."z") length (3 .. 8); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_003() runs on GeneralComp { + var MyString v_c := "abc1xyz"; // char 1 not allowed + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: "abc1xyz" is not a valid value for type `charstring' which has subtype \(from\("a".."z"\) intersection length\(3..8\)\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted bit strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_004 NegSem_0601020602_StringMixing_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted bit strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_004 { + type bitstring MyString ('111'B, '101010'B, '111111'B) length (4 .. 8); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_004() runs on GeneralComp { + var MyString v_c := '111'B; // value lenght 3 not allowed + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '111'B is not a valid value for type `bitstring' which has subtype \('101010'B,'111111'B\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign invalid values to mixed restricted hex strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_005 NegSem_0601020602_StringMixing_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted hex strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_005 { + type hexstring MyString ('1F1'H, '103A10'H, '111111'H) length (4 .. 8); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_005() runs on GeneralComp { + var MyString v_c := '1F1'H; // value length 3 not allowed + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: '1F1'H is not a valid value for type `hexstring' which has subtype \('103A10'H,'111111'H\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC -Assign invalid values to mixed restricted octet strings. > + +<COMPILE> + +<MODULE TTCN NegSem_0601020602_StringMixing_006 NegSem_0601020602_StringMixing_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.1.2.6.2, Assign invalid values to mixed restricted octet strings. + ** @verdict pass reject + ***************************************************/ +module NegSem_0601020602_StringMixing_006 { + type octetstring MyString ('FF1111'O, '101010A3'O, 'FFFFFFFFFF'O) length (4); + + type component GeneralComp {} + + testcase TC_NegSem_0601020602_StringMixing_006() runs on GeneralComp { + var MyString v_c := 'FF1111'O; // value length 3 not allowed + setverdict(pass); + } + + control{ + execute(TC_NegSem_0601020602_StringMixing_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'FF1111'O is not a valid value for type `octetstring' which has subtype \('101010A3'O\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 0602_structured_types_and_values folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that value list notation can not be used for a union type. > + +<COMPILE> + +<MODULE TTCN NegSem_0602_TopLevel_001 NegSem_0602_TopLevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Ensure that value list notation can not be used for a union type. + ** @verdict pass reject + ***************************************************/ +module NegSem_0602_TopLevel_001 { + + type component GeneralComp { + } + + type union MyUnion { + integer field1, + charstring field2, + float field3 + } + + testcase TC_NegSem_0602_TopLevel_001() runs on GeneralComp { + + var MyUnion v_myUnion := {5}; //value list notation can not be used for a union type + + } + + control { + execute(TC_NegSem_0602_TopLevel_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: union value was expected for type `@NegSem_0602_TopLevel_001.MyUnion' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that indexed notation can not be used for a record type. > + +<COMPILE> + +<MODULE TTCN NegSem_0602_TopLevel_002 NegSem_0602_TopLevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Ensure that indexed notation can not be used for a record type. + ** @verdict pass reject + ***************************************************/ +module NegSem_0602_TopLevel_002 { + + type component GeneralComp { + } + + type record MyRecord { + integer field1, + charstring field2, + float field3 + } + + testcase TC_NegSem_0602_TopLevel_002() runs on GeneralComp { + + var MyRecord v_myRecord := { + field1 := 5, + field2 := "hi", + field3 := 3.14 + }; + + var integer Integer1 :=3; + v_myRecord[0] := Integer1;//not possible to use index notation on a record type + + } + + control { + execute(TC_NegSem_0602_TopLevel_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type `@NegSem_0602_TopLevel_002.MyRecord' cannot be indexed +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that indexed notation can not be used for a set type. > + +<COMPILE> + +<MODULE TTCN NegSem_0602_TopLevel_003 NegSem_0602_TopLevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Ensure that indexed notation can not be used for a set type. + ** @verdict pass reject + ***************************************************/ +module NegSem_0602_TopLevel_003 { + + type component GeneralComp { + } + + type set MySet { + integer field1, + charstring field2, + float field3 + } + + testcase TC_NegSem_0602_TopLevel_003() runs on GeneralComp { + + var MySet v_mySet := { + field1 := 5, + field2 := "hi", + field3 := 3.14 + }; + + var integer Integer1 :=3; + v_mySet[0] := Integer1;//not possible to use index notation on a set type + + } + + control { + execute(TC_NegSem_0602_TopLevel_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type `@NegSem_0602_TopLevel_003.MySet' cannot be indexed +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that indexed notation can not be used for a union type. > + +<COMPILE> + +<MODULE TTCN NegSem_0602_TopLevel_004 NegSem_0602_TopLevel_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Ensure that indexed notation can not be used for a union type. + ** @verdict pass reject + ***************************************************/ +module NegSem_0602_TopLevel_004 { + + type component GeneralComp { + } + + type union MyUnion { + integer field1, + charstring field2, + float field3 + } + + testcase TC_NegSem_0602_TopLevel_004() runs on GeneralComp { + + var MyUnion v_myUnion := { + field1 := 5 + }; + + var integer Integer1 :=3; + v_myUnion[0] := Integer1;//not possible to use index notation on a union type + + } + + control { + execute(TC_NegSem_0602_TopLevel_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type `@NegSem_0602_TopLevel_004.MyUnion' cannot be indexed +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Invalid recursive union type definition causing an error > + +<COMPILE> + +<MODULE TTCN NegSyn_0602_TopLevel_001 NegSyn_0602_TopLevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Invalid recursive union type definition causing an error + ** @verdict pass reject + ***************************************************/ +module NegSyn_0602_TopLevel_001 { + // In case of union types, to avoid infinite recursion, at least one of the alternatives shall not reference its own type. + type union MyUnion { + MyUnion choice1, + MyUnion choice2 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice1' -> `@NegSyn_0602_TopLevel_001.MyUnion' +<END_RESULT> +<RESULT COUNT 1> +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice2' -> `@NegSyn_0602_TopLevel_001.MyUnion' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Invalid recursive record type definition causing an error > + +<COMPILE> + +<MODULE TTCN NegSyn_0602_TopLevel_002 NegSyn_0602_TopLevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Invalid recursive record type definition causing an error + ** @verdict pass reject + ***************************************************/ +module NegSyn_0602_TopLevel_002 { + // In case of record and set types, to avoid infinite recursion, fields referencing to its own type, shall be optional. + type record MyRecord { + integer field1, + MyRecord field2, + integer field3 + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_002.MyRecord' -> `@NegSyn_0602_TopLevel_002.MyRecord.field2' -> `@NegSyn_0602_TopLevel_002.MyRecord' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Combined value list and assignment notation not allowed in the same (immediate) context. > + +<COMPILE> + +<MODULE TTCN NegSyn_0602_TopLevel_003 NegSyn_0602_TopLevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2, Combined value list and assignment notation not allowed in the same (immediate) context. + ** @verdict pass reject + ***************************************************/ +module NegSyn_0602_TopLevel_003 { + type record MyRecord { + integer field1, + charstring field2 optional, + float field3 + } + const MyRecord c_rec := { + field1 := 5, + "hi", // combined value list and assignment notation not allowed in the same (immediate) context. + field3 := 3.14 + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `"': syntax error, unexpected Cstring +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060201_RecordTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSyn_060201_RecordTypeValues_001 NegSyn_060201_RecordTypeValues_001.ttcn > +/*************************************************** + ** @author STF 409, re-numbering done by STF470 + ** @version 0.0.1 + ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. + ** @verdict pass reject + ***************************************************/ +module NegSyn_060201_RecordTypeValues_001 { + type record MyRecord { + integer field1, + MyRecord field2 optional, + integer field3 + } + const MyRecord c_rec := { + field1 := 5, + field2 := omit, + field3 := omit // not optional + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060201_RecordTypeValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSyn_060201_RecordTypeValues_002 NegSyn_060201_RecordTypeValues_002.ttcn > +/*************************************************** + ** @author STF 409, re-numbering done by STF470 + ** @version 0.0.1 + ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. + ** @verdict pass reject + ***************************************************/ +module NegSyn_060201_RecordTypeValues_002 { + type record MyRecord { + integer field1, + MyRecord field2 optional, + integer field3 + } + const MyRecord c_rec := { + field1 := 5, + field2 := -, + field3 := omit // not optional + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSem_06020101_ReferencingRecordFields_001 NegSem_06020101_ReferencingRecordFields_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.1.1, The dot notation used in record type definitions is correctly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_06020101_ReferencingRecordFields_001 { + + type component GeneralComp { + } + + type record R { + integer field1 (1 .. 10), + charstring field2 optional + } + + type R ConstrainedRecord ({1, omit}, {2, "xyz"}, {3, "zyx"}) ; + + type ConstrainedRecord.field1 MyInteger; + + testcase TC_NegSem_06020101_ReferencingRecordFields_001() runs on GeneralComp { + + var MyInteger v_int := 11; + // assignment from outside of the carried over (1 .. 10) range constraint + + } + + control { + execute(TC_NegSem_06020101_ReferencingRecordFields_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSem_06020101_ReferencingRecordFields_002 NegSem_06020101_ReferencingRecordFields_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.1.1, verify that record fields cannot reference themselves + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Fields of record type definitions shall not reference themselves. + +module NegSem_06020101_ReferencingRecordFields_002 { + + type component GeneralComp { + } + + type record R { + integer field1, + R.field2 field2 optional, // this circular reference is NOT ALLOWED + boolean field3 + } + + testcase TC_NegSem_06020101_ReferencingRecordFields_002() runs on GeneralComp { + var R v_rec := { field1 := 1, field2 := omit, field3 := true }; + if (v_rec.field1 == 1) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_06020101_ReferencingRecordFields_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking referenced type: Circular reference: `@NegSem_06020101_ReferencingRecordFields_002.R.field2' -> `@NegSem_06020101_ReferencingRecordFields_002.R.field2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_06020101_ReferencingRecordFields_003 NegSem_06020101_ReferencingRecordFields_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.1.1, verify that referencing uninitialized record on the right hand of an assignment is not allowed + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Referencing a subfield of an uninitialized or omitted record field or value on the right +// hand side of an assignment shall cause an error. + +module NegSem_06020101_ReferencingRecordFields_003 { + + type component GeneralComp { + } + + type record R { + record { + integer subfield1 + } field1, + charstring field2 optional + } + + testcase TC_NegSem_06020101_ReferencingRecordFields_003() runs on GeneralComp { + var R v_rec; + v_rec.field2 := "abc"; + if (v_rec.field1.subfield1 == 5) { + setverdict(fail); + } else { + setverdict(pass); + } + } + + control { + execute(TC_NegSem_06020101_ReferencingRecordFields_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Unbound left operand of integer comparison. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_06020101_ReferencingRecordFields_004 NegSem_06020101_ReferencingRecordFields_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.1.1, verify that referencing omitted record on the right hand of an assignment is not allowed + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Referencing a subfield of an uninitialized or omitted record field or value on the right +// hand side of an assignment shall cause an error. + +module NegSem_06020101_ReferencingRecordFields_004 { + + type component GeneralComp { + } + + type record R { + record { + integer subfield1 + } field1 optional, + charstring field2 optional + } + + testcase TC_NegSem_06020101_ReferencingRecordFields_004() runs on GeneralComp { + var R v_rec; + v_rec.field1 := omit; + v_rec.field2 := "abc"; + if (v_rec.field1.subfield1 == 5) { + setverdict(fail); + } else { + setverdict(pass); + } + } + + control { + execute(TC_NegSem_06020101_ReferencingRecordFields_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using the value of an optional field containing omit. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060202_SetTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSem_060202_SetTypeValues_001 NegSem_060202_SetTypeValues_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.2, The dot notation used in set type definitions is correctly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_060202_SetTypeValues_001 { + + type component GeneralComp { + } + + type set S { + integer field1 (1 .. 10), + charstring field2 optional + } + + //type S ConstrainedSet ({1, omit}, {2, "xyz"}, {3, "zyx"}) ; // value list doesn't work + type S ConstrainedSet ({field1 := 1, field2 := omit}, {field1 := 2, field2 := "xyz"}, {field1 := 3, field2 := "zyx"}) ; + + type ConstrainedSet.field1 MyInteger; + + testcase TC_NegSem_060202_SetTypeValues_001() runs on GeneralComp { + + var MyInteger v_int := 11; + // assignment from outside of the carried over (1 .. 10) range constraint + + } + + control { + execute(TC_NegSem_060202_SetTypeValues_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060202_SetTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSyn_060202_SetTypeValues_001 NegSyn_060202_SetTypeValues_001.ttcn > +/*************************************************** + ** @author STF470 + ** @version 0.0.1 + ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. + ** @verdict pass reject + ***************************************************/ +module NegSyn_060202_SetTypeValues_001 { + type set MySet { + integer field1, + MySet field2 optional, + integer field3 + } + const MySet c_set := { + field1 := 5, + field2 := omit, + field3 := omit // not optional + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060202_SetTypeValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The omit keyword shall not be used for mandatory fields. > + +<COMPILE> + +<MODULE TTCN NegSyn_060202_SetTypeValues_002 NegSyn_060202_SetTypeValues_002.ttcn > +/*************************************************** + ** @author STF470 + ** @version 0.0.1 + ** @purpose 1:6.2, The omit keyword shall not be used for mandatory fields. + ** @verdict pass reject + ***************************************************/ +module NegSyn_060202_SetTypeValues_002 { + type record MySet { + integer field1, + MySet field2 optional, + integer field3 + } + const MySet c_set := { + field1 := 5, + field2 := -, + field3 :=omit // not optional + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that the inner type referencing is correctly handled > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_001 NegSem_060203_records_and_sets_of_single_types_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, ensure that the inner type referencing is correctly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_060203_records_and_sets_of_single_types_001 { + + type component GeneralComp { + } + + type record length (5) of record of integer ConstrainedStructure (1 .. 10); + type ConstrainedStructure[-] RecordOfInt; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_001() runs on GeneralComp { + + var RecordOfInt v_rec := { 8, 11, 2, 3, 4, 5, 6, 7 }; // a value is outside the restricted range + + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that the inner type referencing is correctly handled > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_002 NegSem_060203_records_and_sets_of_single_types_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, ensure that the inner type referencing is correctly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_060203_records_and_sets_of_single_types_002 { + + type component GeneralComp { + } + + type record of record length (5) of integer ConstrainedStructure (1 .. 10); + type ConstrainedStructure[-] RecordOfInt; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_002() runs on GeneralComp { + + var RecordOfInt v_rec := { 8, 1, 2, 3, 4, 5, 6, 7 }; + // a record is longer than the restricted length + + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: \{ 8, 1, 2, 3, 4, 5, 6, 7 \} is not a valid value for type `@NegSem_060203_records_and_sets_of_single_types_002.ConstrainedStructure.SEQUENCE_OF' which has subtype length\(5\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - negative index applied to a record of value on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_003 NegSem_060203_records_and_sets_of_single_types_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, negative index applied to a record of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_003 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_003() runs on GeneralComp { + + var RoI v_rec := { 0, 1, 2 }; + var integer i := v_rec[-1]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_003.RoI' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - negative index applied to a set of value on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_004 NegSem_060203_records_and_sets_of_single_types_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, negative index applied to a set of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_004 { + + type component GeneralComp { + } + + type set of integer SoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_004() runs on GeneralComp { + + var SoI v_set := { 0, 1, 2 }; + var integer i := v_set[-1]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_004.SoI' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC -negative index applied to a record of value on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_005 NegSem_060203_records_and_sets_of_single_types_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, negative index applied to a record of value on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_005 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_005() runs on GeneralComp { + + var RoI v_rec := { 0, 1, 2 }; + v_rec[-1] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_005.RoI' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC -negative index applied to a set of value on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_006 NegSem_060203_records_and_sets_of_single_types_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, negative index applied to a set of value on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_006 { + + type component GeneralComp { + } + + type set of integer SoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_006() runs on GeneralComp { + + var SoI v_set := { 0, 1, 2 }; + v_set[-1] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_006.SoI' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC -wrong index type applied to a record of value on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_007 NegSem_060203_records_and_sets_of_single_types_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, wrong index type applied to a record of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_007 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_007() runs on GeneralComp { + + var RoI v_rec := { 0, 1, 2 }; + var integer i := v_rec["0"]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_007()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to a set of value on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_008 NegSem_060203_records_and_sets_of_single_types_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, wrong index type applied to a set of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_008 { + + type component GeneralComp { + } + + type set of integer SoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_008() runs on GeneralComp { + + var SoI v_set := { 0, 1, 2 }; + var integer i := v_set["0"]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to a record of value on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_009 NegSem_060203_records_and_sets_of_single_types_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, wrong index type applied to a record of value on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_009 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_009() runs on GeneralComp { + + var RoI v_rec := { 0, 1, 2 }; + v_rec["0"] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_009()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to a set of value on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_010 NegSem_060203_records_and_sets_of_single_types_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, wrong index type applied to a set of value on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Implicit rule, formal requirement requested in CR 6646 (resolution expected +// in TTCN-3:2014) +module NegSem_060203_records_and_sets_of_single_types_010 { + + type component GeneralComp { + } + + type set of integer SoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_010() runs on GeneralComp { + + var SoI v_set := { 0, 1, 2 }; + v_set["0"] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_010()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to a record of value on the right hand side of an assignment > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_013 NegSem_060203_records_and_sets_of_single_types_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, wrong index type applied to a record of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the value of the element indicated by the index at the right-hand of an +// assignment is undefined (uninitialized), this shall cause a semantic or +// run-time error.) +module NegSem_060203_records_and_sets_of_single_types_013 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_013() runs on GeneralComp { + + var RoI v_rec := { 0, 1, 2 }; + var integer i := v_rec[3]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_013()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Index overflow in a value of type @PreGenRecordOf.PREGEN_RECORD_OF_INTEGER: The index is 3, but the value has only 3 elements. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to a record of value on the right hand side of an assignment > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_014 NegSem_060203_records_and_sets_of_single_types_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, wrong index type applied to a record of value on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If the value of the element indicated by the index at the right-hand of an +// assignment is undefined (uninitialized), this shall cause a semantic or +// run-time error.) +module NegSem_060203_records_and_sets_of_single_types_014 { + + type component GeneralComp { + } + + type set of integer SoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_014() runs on GeneralComp { + + var SoI v_set := { 0, 1, 2 }; + var integer i := v_set[3]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_014()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Index overflow in a value of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER: The index is 3, but the value has only 3 elements. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify than an error is generated when sending a partially initialized record of value > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_015 NegSem_060203_records_and_sets_of_single_types_015.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, verify than an error is generated when sending a partially initialized record of value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Undefined elements are permitted only in transient states (while the value +// remains invisible). Sending a record of value with undefined elements shall +// cause a test case error. + +module NegSem_060203_records_and_sets_of_single_types_015 { + + type record of integer RoI; + + type port P message { + inout RoI + } with {extension "internal"} + + type component GeneralComp { + port P p + } + + testcase TC_NegSem_060203_records_and_sets_of_single_types_015() runs on GeneralComp { + var template RoI mw_sendingTemplate := {0, -, 2}; + connect(self:p,self:p); + p.send(mw_sendingTemplate); // error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_060203_records_and_sets_of_single_types_015()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Text encoder: Encoding an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060203_records_and_sets_of_single_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that value list cannot contain an empty assignment > + +<COMPILE> + +<MODULE TTCN NegSyn_060203_records_and_sets_of_single_types_001 NegSyn_060203_records_and_sets_of_single_types_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3.2, ensure that value list cannot contain an empty assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// No empty assignment is allowed (e.g. two commas, the second immediately +// following the first or only with white space between them). +module NegSyn_060203_records_and_sets_of_single_types_001 { + + type component GeneralComp { + } + + type record of integer RoI; + + testcase TC_NegSyn_060203_records_and_sets_of_single_types_001() runs on GeneralComp { + + var RecordOfInt v_rec := { 0, , 2 }; // syntax error expected + + } + + control { + execute(TC_NegSyn_060203_records_and_sets_of_single_types_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `,': syntax error, unexpected ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - not unique identifiers in enumerated type declaration > + +<COMPILE> + +<MODULE TTCN NegSem_060204_enumerated_type_and_values_001 NegSem_060204_enumerated_type_and_values_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, not unique identifiers in enumerated type declaration + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The identifiers of enumerated values shall be unique within the enumerated type +// (but do not have to be globally unique) and are consequently visible in the +// context of the given type only. + +module NegSem_060204_enumerated_type_and_values_001 { + + type enumerated MyFirstEnumType { + Monday, Tuesday, Wednesday, Thursday, Friday, Monday + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: Duplicate enumeration identifier `Monday' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - two equal user-assigned enumerated values > + +<COMPILE> + +<MODULE TTCN NegSem_060204_enumerated_type_and_values_002 NegSem_060204_enumerated_type_and_values_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, two equal user-assigned enumerated values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Each user-assigned integer number shall be distinct within a single enumerated +// type. + +module NegSem_060204_enumerated_type_and_values_002 { + + type enumerated MyFirstEnumType { + Monday, Tuesday(2), Wednesday(2), Thursday, Friday + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: Duplicate numeric value 2 for enumeration `Wednesday' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using enumerated value number directly (left hand side of assignments) > + +<COMPILE> + +<MODULE TTCN NegSem_060204_enumerated_type_and_values_003 NegSem_060204_enumerated_type_and_values_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, using enumerated value number directly (left hand side of assignments) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each enumerated value without an assigned integer value, the system +// successively associates an integer number in the textual order of the +// enumerated values, starting at the left-hand side, beginning with zero, by +// step 1 and skipping any number occupied by any of the enumerated values with +// a manually assigned value. These values are only used by the system to allow +// the use of relational operators. The user shall not directly use associated +// integer values but can access them and convert integer values into enumerated +// values by using the predefined functions enum2int and int2enum (see clauses +// 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4). + +module NegSem_060204_enumerated_type_and_values_003 { + + type component GeneralComp { + } + + type enumerated EDays { + Monday, Tuesday, Wednesday, Thursday, Friday + }; + + testcase TC_NegSem_060204_enumerated_type_and_values_003() runs on GeneralComp { + var EDays v_day0 := 0; // ordinal value shall not be accepted + setverdict(pass); + } + + control { + execute(TC_NegSem_060204_enumerated_type_and_values_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: enumerated value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using enumerated value number directly (right hand side of assignments) > + +<COMPILE> + +<MODULE TTCN NegSem_060204_enumerated_type_and_values_004 NegSem_060204_enumerated_type_and_values_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, using enumerated value number directly (right hand side of assignments) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each enumerated value without an assigned integer value, the system +// successively associates an integer number in the textual order of the +// enumerated values, starting at the left-hand side, beginning with zero, by +// step 1 and skipping any number occupied by any of the enumerated values with +// a manually assigned value. These values are only used by the system to allow +// the use of relational operators. The user shall not directly use associated +// integer values but can access them and convert integer values into enumerated +// values by using the predefined functions enum2int and int2enum (see clauses +// 16.1.2, C.1.29 C.1.30 and C.1.4 C.1.4). + +module NegSem_060204_enumerated_type_and_values_004 { + + type component GeneralComp { + } + + type enumerated EDays { + Monday, Tuesday, Wednesday, Thursday, Friday + }; + + testcase TC_NegSem_060204_enumerated_type_and_values_004() runs on GeneralComp { + var EDays v_day0 := Monday; + var integer v_int := v_day0; + setverdict(pass); + } + + control { + execute(TC_NegSem_060204_enumerated_type_and_values_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer' was expected instead of `@NegSem_060204_enumerated_type_and_values_004.EDays' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using enumerated value without implicit or explicit type reference > + +<COMPILE> + +<MODULE TTCN NegSem_060204_enumerated_type_and_values_005 NegSem_060204_enumerated_type_and_values_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, using enumerated value without implicit or explicit type reference + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For any instantiation or value reference of an enumerated type, the given +// type shall be implicitly or explicitly referenced. + +module NegSem_060204_enumerated_type_and_values_005 { + + type component GeneralComp { + } + + type enumerated EDays { + Monday, Tuesday, Wednesday, Thursday, Friday + }; + + testcase TC_NegSem_060204_enumerated_type_and_values_005() runs on GeneralComp { + if (Tuesday != Wednesday) { // no implicit or explicit reference to enumeration + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060204_enumerated_type_and_values_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Cannot determine the type of the operands in operation `!=' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060204_enumerated_type_and_values_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - constant as user-assigned enumerated values > + +<COMPILE> + +<MODULE TTCN NegSyn_060204_enumerated_type_and_values_001 NegSyn_060204_enumerated_type_and_values_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, constant as user-assigned enumerated values + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Each enumerated value may optionally have a user-assigned integer value, which +// is defined after the name of the enumerated value in parenthesis. + +module NegSyn_060204_enumerated_type_and_values_001 { + + const integer c_int := 5; + type enumerated MyFirstEnumType { + Monday, Tuesday(c_int), Wednesday, Thursday, Friday + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `c_int': syntax error, unexpected Identifier, expecting Number or '-' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060204_enumerated_type_and_values_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - expression as user-assigned enumerated value > + +<COMPILE> + +<MODULE TTCN NegSyn_060204_enumerated_type_and_values_002 NegSyn_060204_enumerated_type_and_values_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.4, expression as user-assigned enumerated value + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Each enumerated value may optionally have a user-assigned integer value, which +// is defined after the name of the enumerated value in parenthesis. + +module NegSyn_060204_enumerated_type_and_values_002 { + + type enumerated MyFirstEnumType { + Monday, Tuesday(2+3), Thursday, Friday + }; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\+': syntax error, unexpected '\+', expecting '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - assignment notation for union values with two items > + +<COMPILE> + +<MODULE TTCN NegSem_060205_top_level_001 NegSem_060205_top_level_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, assignment notation for union values with two items + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The assignment notation shall be used for union-s, and the notation shall assign +// a value to one field only. This field becomes the chosen field. + +module NegSem_060205_top_level_001 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_060205_top_level_001() runs on GeneralComp { + var U v_choice := { option1 := 1, option2 := "abc" }; + if (ischosen(v_choice.option1) or ischosen(v_choice.option2)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_060205_top_level_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Only one field was expected in union value instead of 2 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - assignment notation for union values with unknown alternative > + +<COMPILE> + +<MODULE TTCN NegSem_060205_top_level_002 NegSem_060205_top_level_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, assignment notation for union values with unknown alternative + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The assignment notation shall be used for union-s, and the notation shall assign +// a value to one field only. This field becomes the chosen field. + +module NegSem_060205_top_level_002 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_060205_top_level_002() runs on GeneralComp { + var U v_choice := { option1 := 10 }; + v_choice := { option3 := true }; + if (ischosen(v_choice.option1)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_060205_top_level_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to non-existent field `option3' in union value for type `@NegSem_060205_top_level_002.U' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - "not used" symbol in union value notations > + +<COMPILE> + +<MODULE TTCN NegSem_060205_top_level_003 NegSem_060205_top_level_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, "not used" symbol in union value notations + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Neither the not used symbol "-" nor omit is allowed in union value notations. + +module NegSem_060205_top_level_003 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_060205_top_level_003() runs on GeneralComp { + var U v_choice := { option1 := - }; + if (ischosen(v_choice.option1)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_060205_top_level_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - omit symbol in union value notations > + +<COMPILE> + +<MODULE TTCN NegSem_060205_top_level_004 NegSem_060205_top_level_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, omit symbol in union value notations + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Neither the not used symbol "-" nor omit is allowed in union value notations. + +module NegSem_060205_top_level_004 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_060205_top_level_004() runs on GeneralComp { + var U v_choice := { option1 := omit }; + if (ischosen(v_choice.option1) or ischosen(v_choice.option2)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_060205_top_level_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - value list notation used for union value definition > + +<COMPILE> + +<MODULE TTCN NegSem_060205_top_level_005 NegSem_060205_top_level_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, value list notation used for union value definition + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The value list notation shall not be used for setting values of union types. + +module NegSem_060205_top_level_005 { + type component GeneralComp { + } + + type union U { + integer option1 + } + + testcase TC_NegSem_060205_top_level_005() runs on GeneralComp { + var U v_choice := { 1 }; + if (ischosen(v_choice.option1)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_060205_top_level_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: union value was expected for type `@NegSem_060205_top_level_005.U' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - union type declaration with two equal identifiers > + +<COMPILE> + +<MODULE TTCN NegSyn_060205_top_level_001 NegSyn_060205_top_level_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5, union type declaration with two equal identifiers + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// TTCN-3 supports the union type. The union type is a collection of alternatives, +// each one identified by an identifier. Only one of the specified alternatives +// will ever be present in an actual union value. Union types are useful to model +// data which can take one of a finite number of known types. + +module NegSyn_060205_top_level_001 { + type union U { + integer option1, + charstring option2, + boolean option1 // error expected + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Duplicate union field name `option1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - unknown union alternative in value dot notation > + +<COMPILE> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_001 NegSem_06020501_referencing_fields_of_union_type_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, unknown union alternative in value dot notation + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Alternatives of a union type shall be referenced by the dot notation +// TypeIdOrExpression.AlternativeId, where TypeIdOrExpression resolves to the name +// of a union type or an expression of a union type such as variable, formal +// parameter, module parameter, constant, template, or function invocation. +// AlternativeId shall resolve to the name of an alternative in the union type. + +module NegSem_06020501_referencing_fields_of_union_type_001 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_001() runs on GeneralComp { + var U v_union; + v_union.option3 := 1; + if (ischosen(v_union.option1) or ischosen(v_union.option2)) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_001.U' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - unknown union alternative in extended type reference > + +<COMPILE> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_002 NegSem_06020501_referencing_fields_of_union_type_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, unknown union alternative in extended type reference + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Alternatives of a union type shall be referenced by the dot notation +// TypeIdOrExpression.AlternativeId, where TypeIdOrExpression resolves to the name +// of a union type or an expression of a union type such as variable, formal +// parameter, module parameter, constant, template, or function invocation. +// AlternativeId shall resolve to the name of an alternative in the union type. + +module NegSem_06020501_referencing_fields_of_union_type_002 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + type U.option3 UnionItem; + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_002() runs on GeneralComp { + var UnionItem v_val := 1; + if (v_val == 1) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_002.U' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - union alternative referencing itself > + +<COMPILE> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_003 NegSem_06020501_referencing_fields_of_union_type_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, union alternative referencing itself + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Alternatives of union type definitions shall not reference themselves. + +module NegSem_06020501_referencing_fields_of_union_type_003 { + type component GeneralComp { + } + + type union U { + integer option1, + U.option2 option2 + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_003() runs on GeneralComp { + var U v_union := { option1 := 1 }; + if (v_union == { option1 := 1}) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking referenced type: Circular reference: `@NegSem_06020501_referencing_fields_of_union_type_003.U.option2' -> `@NegSem_06020501_referencing_fields_of_union_type_003.U.option2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - union alternative referencing indirectly itself > + +<COMPILE> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_004 NegSem_06020501_referencing_fields_of_union_type_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, union alternative referencing indirectly itself + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Alternatives of union type definitions shall not reference themselves. + +module NegSem_06020501_referencing_fields_of_union_type_004 { + type component GeneralComp { + } + + type union U { + integer option1, + U.option3 option2, + U.option2 option3 + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_004() runs on GeneralComp { + var U v_union := { option1 := 1 }; + if (v_union == { option1 := 1}) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking referenced type: Circular reference: `@NegSem_06020501_referencing_fields_of_union_type_004.U.option2' -> `@NegSem_06020501_referencing_fields_of_union_type_004.U.option3' -> `@NegSem_06020501_referencing_fields_of_union_type_004.U.option2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - union alternative costraint passed through extended type reference > + +<COMPILE> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_005 NegSem_06020501_referencing_fields_of_union_type_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, union alternative costraint passed through extended type reference + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// If an alternative in a union type or a subtype of a union type is referenced by +// the dot notation, the resulting type is the set of values allowed for that +// alternative imposed by the constraints of the alternative declaration itself +// (i.e. any constraints applied to the union type itself are ignored). + +module NegSem_06020501_referencing_fields_of_union_type_005 { + type component GeneralComp { + } + + type union U { + integer option1 (1..10), + charstring option2 + } + + type U.option1 UnionItem; + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_005() runs on GeneralComp { + var UnionItem v_val := 100; + if (v_val == 100) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: 100 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - referencing not chosen alternative on right hand side of assignment > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_006 NegSem_06020501_referencing_fields_of_union_type_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, referencing not chosen alternative on right hand side of assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When an alternative of a union type is referenced on the right hand side of +// an assignment an error shall occur if the referenced alternative is not the +// currently chosen alternative or if the referenced union field or value is omitted +// or uninitialized. + +module NegSem_06020501_referencing_fields_of_union_type_006 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_006() runs on GeneralComp { + var U v_union := { option1 := 1 }; + if (v_union.option2 != "test") { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using non-selected field option2 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_006.U. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - referencing not chosen alternative on right hand side of assignment > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_007 NegSem_06020501_referencing_fields_of_union_type_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, referencing alternative of uninitialized union on right hand side of assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When an alternative of a union type is referenced on the right hand side of +// an assignment an error shall occur if the referenced alternative is not the +// currently chosen alternative or if the referenced union field or value is omitted +// or uninitialized. + +module NegSem_06020501_referencing_fields_of_union_type_007 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + type record R { + integer field1, + U field2 + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_007() runs on GeneralComp { + var R v_rec; + v_rec.field1 := 5; + if (v_rec.field2.option1 != 100) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using non-selected field option1 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_007.U. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - referencing alternative of omitted union on right hand side of assignment > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_06020501_referencing_fields_of_union_type_008 NegSem_06020501_referencing_fields_of_union_type_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.1, referencing alternative of omitted union on right hand side of assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// When an alternative of a union type is referenced on the right hand side of +// an assignment an error shall occur if the referenced alternative is not the +// currently chosen alternative or if the referenced union field or value is omitted +// or uninitialized. + +module NegSem_06020501_referencing_fields_of_union_type_008 { + type component GeneralComp { + } + + type union U { + integer option1, + charstring option2 + } + + type record R { + integer field1, + U field2 optional + } + + testcase TC_NegSem_06020501_referencing_fields_of_union_type_008() runs on GeneralComp { + var R v_rec; + v_rec.field1 := 5; + v_rec.field2 := omit; + if (v_rec.field2.option1 != 100) { setverdict(pass); } + else { setverdict(fail); } + } + + control{ + execute(TC_NegSem_06020501_referencing_fields_of_union_type_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using the value of an optional field containing omit. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06020502_option_and_union_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - referencing alternative of omitted union on right hand side of assignment > + +<COMPILE> + +<MODULE TTCN NegSyn_06020502_option_and_union_001 NegSyn_06020502_option_and_union_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.5.2, referencing alternative on left hand side of assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Optional fields are not allowed for the union type, which means that the optional +// keyword shall not be used with union types. + +module NegSyn_06020502_option_and_union_001 { + type union U { + integer option1, + charstring option2 optional + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `optional': syntax error, unexpected OptionalKeyword, expecting '\}' or ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that after redeclaration of an anytype value the old type and value are lost > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060206_anytype_001 NegSem_060206_anytype_001.ttcn > +/**************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.0.6, ensure that after redeclaration of an anytype value the old type and value are lost + ** @verdict pass reject + ***************************************************/ +module NegSem_060206_anytype_001 { + + type component GeneralComp { + var anytype Var1, Var2; + } + + testcase TC_NegSem_060206_anytype_001() runs on GeneralComp { + + Var1.integer := 10; + Var2.float := 3.0E0; + + Var1.float := 5.5E0; + Var2.charstring := "abc"; // the new type of Var2 is charstring instead of float + + if ( match(Var1.integer, 10) and match(Var2.float, 3.0E0)) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control { + execute(TC_NegSem_060206_anytype_001()); + } + +} +with { + extension "anytype integer, float, charstring" +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using non-selected field integer in a value of union type @NegSem_060206_anytype_001.anytype +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that anytype can not be address type if not explicitly declareted in the module > + +<COMPILE> + +<MODULE TTCN NegSem_060206_anytype_002 NegSem_060206_anytype_002.ttcn > +/**************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.0.6, Ensure that anytype can not be address type if not explicitly declareted in the module + ** @verdict pass reject + ***************************************************/ +module NegSem_060206_anytype_002 { + + type component GeneralComp { + + var anytype x; + } + + testcase TC_NegSem_060206_anytype_002() runs on GeneralComp { + + x.address:=10; // error: address type is not declarated in the module explicitly + + + if (x.address==10) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control { + execute(TC_NegSem_060206_anytype_002()); + } + +} +with { + extension "anytype address" +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type `address' is not defined in this module +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that anytype cannot be port type > + +<COMPILE> + +<MODULE TTCN NegSem_060206_anytype_002 NegSem_060206_anytype_002.ttcn > +/**************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.0.6, ensure that anytype cannot be port type + ** @verdict pass reject + ***************************************************/ + +module NegSyn_060206_anytype_002 { + + type port MyPort message{ + //address integer; + inout integer; + } with {extension "internal"} + + type component GeneralComp { + var anytype x; + port MyPort PCO1; + } + + testcase TC_NegSyn_060206_anytype_002() runs on GeneralComp { + + x.MyPort:= PCO1; // port type is not allowed with anytype + + } + + control { + execute(TC_NegSyn_060206_anytype_002()); + } + +} +with { + extension "anytype MyPort" +} +<END_MODULE> + +<RESULT COUNT 1> +error: Port type `@NegSyn_060206_anytype_002.MyPort' cannot be embedded into another type +<END_RESULT> +<RESULT COUNT 1> +error: Reference to a value was expected instead of port `@NegSyn_060206_anytype_002.GeneralComp.PCO1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that the value limitation is correctly handled within array > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_001 NegSem_060207_arrays_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that the value limitation is correctly handled within array + ** @verdict pass reject + ***************************************************/ +module NegSem_060207_arrays_001 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_001() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 11, 2, 3, 4}; + // syntax error expected, value shall be between 1..10 + + } + + control { + execute(TC_NegSem_060207_arrays_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that the inner type referencing is correctly handled > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_002 NegSem_060207_arrays_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that the inner type referencing is correctly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_060207_arrays_002 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_002() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4, 5, 6}; + // array is longer than the restricted length + + } + + control { + execute(TC_NegSem_060207_arrays_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Too many elements in the array value: 5 was expected instead of 7 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - negative index applied to an array on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_003 NegSem_060207_arrays_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, negative index applied to an array on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. + +module NegSem_060207_arrays_003 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_003() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + var integer i := v_array1[-1]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index underflow: the index value must be at least `0' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - negative index applied to an array on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_004 NegSem_060207_arrays_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, negative index applied to an array on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. + +module NegSem_060207_arrays_004 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_004() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + v_array1[-1] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index underflow: the index value must be at least `0' instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to an array on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_005 NegSem_060207_arrays_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, wrong index type applied to an array on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. +// [from 3.1] index notation: notation to access individual elements of record of, +// set of, array and string values or templates, where the element to be accessed +// is identified explicitly by an index value enclosed in square brackets ("[" and +// "]") which specifies the position of that element within the referenced value +// or template and the index value is either an integer value, array of integers +// or record of integers. + +module NegSem_060207_arrays_005 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_005() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + var integer i := v_array1["0"]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to an array on the left hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_006 NegSem_060207_arrays_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, wrong index type applied to an array on the left hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. +// [from 3.1] index notation: notation to access individual elements of record of, +// set of, array and string values or templates, where the element to be accessed +// is identified explicitly by an index value enclosed in square brackets ("[" and +// "]") which specifies the position of that element within the referenced value +// or template and the index value is either an integer value, array of integers +// or record of integers. + +module NegSem_060207_arrays_006 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_006() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + v_array1["0"] := 10; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - array index greater than the upper bound (left-hand side) > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_007 NegSem_060207_arrays_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, array index greater than the upper bound (left-hand side) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The index shall not exceed the limitations given by either the length or the +// upper bound of the index. + +module NegSem_060207_arrays_007 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_007() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + v_array1[5] := 3; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_007()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index overflow: the index value must be at most `4' instead of `5' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - wrong index type applied to an array on the right hand side of an assignment > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_008 NegSem_060207_arrays_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, wrong index type applied to an array on the right hand side of an assignment + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The index shall not exceed the limitations given by either the length or the +// upper bound of the index. + +module NegSem_060207_arrays_008 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_008() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 9, 2, 3, 4}; + var integer i := v_array1[5]; // error expected + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index overflow: the index value must be at most `4' instead of `5' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify than an error is generated when sending a partially initialized array > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060207_arrays_009 NegSem_060207_arrays_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, verify than an error is generated when sending a partially initialized array + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Sending an array value with undefined elements shall cause an error. + +module NegSem_060207_arrays_009 { + + type integer MyArrayType1[5] (1 .. 10); + + type port P message { + inout MyArrayType1 + } with {extension "internal"} + + type component GeneralComp { + port P p + } + + testcase TC_NegSem_060207_arrays_009() runs on GeneralComp { + var template MyArrayType1 m_array1 := { 8, 9, -, 3, 4}; + p.send(m_array1); // error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_060207_arrays_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that the value limitation is correctly handled within array > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_010 NegSem_060207_arrays_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that the value limitation is correctly handled within array + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The values of array elements shall be compatible with the corresponding +// variable or type declaration. + +module NegSem_060207_arrays_010 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSem_060207_arrays_010() runs on GeneralComp { + + var MyArrayType1 v_array1 := { + [0] := 8, + [1] := 0,// error expected, value shall be between 1..10 + [2] := 2, + [3] := 3, + [4] := 4 + }; + + } + + control { + execute(TC_NegSem_060207_arrays_010()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 0 is not a valid value for type `integer' which has subtype \(1..10\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - runtime resolved constant in array type declaration > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_011 NegSem_060207_arrays_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, runtime resolved constant in array type declaration + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_011 { + + type component GeneralComp { + } + + function f() return integer { + if (rnd() < 0.5) { return 5; } + else { return 10; } + } + + const integer c_dimension := f(); + type integer Arr[c_dimension]; + + testcase TC_NegSem_060207_arrays_011() runs on GeneralComp { + var Arr v_arr; + v_arr[0] := 1; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_011()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_011.f' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - runtime resolved constant in array variable declaration > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_012 NegSem_060207_arrays_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, runtime resolved constant in array variable declaration + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_012 { + + type component GeneralComp { + } + + function f() return integer { + if (rnd() < 0.5) { return 5; } + else { return 10; } + } + + const integer c_dimension := f(); + + testcase TC_NegSem_060207_arrays_012() runs on GeneralComp { + var integer v_arr[c_dimension]; + v_arr[0] := 1; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_012()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_012.f' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - variable in array variable declaration > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_013 NegSem_060207_arrays_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, variable in array variable declaration + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_013 { + + type component GeneralComp { + } + + function f() return integer { + if (rnd() < 0.5) { return 5; } + else { return 10; } + } + + testcase TC_NegSem_060207_arrays_013() runs on GeneralComp { + var integer v_dimension := f(); + var integer v_arr[v_dimension]; + v_arr[0] := 1; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_013()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a constant value was expected instead of variable `v_dimension' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - modulepar in array variable declaration > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_014 NegSem_060207_arrays_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, modulepar in array variable declaration + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_014 { + + type component GeneralComp { + } + + function f() return integer { + if (rnd() < 0.5) { return 5; } + else { return 10; } + } + + modulepar integer PX_DIMENSION := 5; + + testcase TC_NegSem_060207_arrays_014() runs on GeneralComp { + var integer v_arr[PX_DIMENSION]; + v_arr[0] := 1; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_014()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to an \(evaluatable\) constant value was expected instead of module parameter `@NegSem_060207_arrays_014.PX_DIMENSION' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - zero dimension array > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_015 NegSem_060207_arrays_015.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, zero dimension array + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_015 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_015() runs on GeneralComp { + var integer v_arr[0] := {}; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_015()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A positive integer value was expected as array size instead of `0' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - array with negative dimension > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_016 NegSem_060207_arrays_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, array with negative dimension + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_016 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_016() runs on GeneralComp { + var integer v_arr[3][-1]; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_016()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A positive integer value was expected as array size instead of `-1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - float instead of integer in array dimension > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_019 NegSem_060207_arrays_019.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, float instead of integer in array dimension + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions shall be specified using constant expressions, which shall +// evaluate to a positive integer values. Constants used in the constant +// expressions shall meet with the restrictions in clause 10. + +module NegSem_060207_arrays_019 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_019() runs on GeneralComp { + var integer v_arr[2.0]; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_019()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using lower than allowed custom array index on the right hand side of assignments > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_022 NegSem_060207_arrays_022.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, using lower than allowed custom array index on the right hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. + +module NegSem_060207_arrays_022 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_022() runs on GeneralComp { + var integer v_arr[2..5] := { 2, 3, 4, 5 }; + var boolean v_bool := v_arr[0] == 0; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_022()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index underflow: the index value must be at least `2' instead of `0' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using lower than allowed custom array index on the left hand side of assignments > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_023 NegSem_060207_arrays_023.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, using lower than allowed custom array index on the left hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Indexed value notation can be used on both the right-hand side and left-hand +// side of assignments. The index of the first element shall be zero or the lower +// bound if an index range has been given. + +module NegSem_060207_arrays_023 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_023() runs on GeneralComp { + var integer v_arr[2..5] := { 2, 3, 4, 5 }; + v_arr[0] := 0; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_023()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index underflow: the index value must be at least `2' instead of `0' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using greater than allowed custom array index on the right hand side of assignments > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_024 NegSem_060207_arrays_024.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, using greater than allowed custom array index on the right hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The index shall not exceed the limitations given by either the length or the +// upper bound of the index. + +module NegSem_060207_arrays_024 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_024() runs on GeneralComp { + var integer v_arr[2..5] := { 2, 3, 4, 5 }; + var boolean v_bool := v_arr[6] == 6; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_024()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index overflow: the index value must be at most `5' instead of `6' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using greater than allowed custom array index on the left hand side of assignments > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_025 NegSem_060207_arrays_025.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, using greater than allowed custom array index on the left hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The index shall not exceed the limitations given by either the length or the +// upper bound of the index. + +module NegSem_060207_arrays_025 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_025() runs on GeneralComp { + var integer v_arr[2..5] := { 2, 3, 4, 5 }; + v_arr[6] := 6; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_025()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Array index overflow: the index value must be at most `5' instead of `6' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using greater than allowed custom array index on the left hand side of assignments > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060207_arrays_026 NegSem_060207_arrays_026.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, referencing uninitialized array element on the right hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// : If the value of the element indicated by the index at the right hand of +// an assignment is undefined or if the index notation is applied to an uninitialized +// or omitted array value on the right hand side of an assignment, error shall be +// caused. + +module NegSem_060207_arrays_026 { + + type component GeneralComp { + } + + type record R { + integer field1[3], + boolean field2 + } + + testcase TC_NegSem_060207_arrays_026() runs on GeneralComp { + var integer v_arr[3], v_int; + v_arr[2] := 1; + v_int := v_arr[0]; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_026()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Assignment of an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using greater than allowed custom array index on the left hand side of assignments > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060207_arrays_027 NegSem_060207_arrays_027.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, referencing element of uninitialized arrays on the right hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// : If the value of the element indicated by the index at the right hand of +// an assignment is undefined or if the index notation is applied to an uninitialized +// or omitted array value on the right hand side of an assignment, error shall be +// caused. + +module NegSem_060207_arrays_027 { + + type component GeneralComp { + } + + type record R { + integer field1[3], + boolean field2 + } + + testcase TC_NegSem_060207_arrays_027() runs on GeneralComp { + var R v_rec := { -, true } + var integer v_int := v_rec.field1[0]; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_027()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_028 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - using greater than allowed custom array index on the left hand side of assignments > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_060207_arrays_028 NegSem_060207_arrays_028.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, referencing element of omitted arrays on the right hand side of assignments + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// : If the value of the element indicated by the index at the right hand of +// an assignment is undefined or if the index notation is applied to an uninitialized +// or omitted array value on the right hand side of an assignment, error shall be +// caused. + +module NegSem_060207_arrays_028 { + + type component GeneralComp { + } + + type record R { + integer field1[3] optional, + boolean field2 + } + + testcase TC_NegSem_060207_arrays_028() runs on GeneralComp { + var R v_rec := { omit, true } + var integer v_int := v_rec.field1[0]; + setverdict(pass); + } + + control { + execute(TC_NegSem_060207_arrays_028()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using the value of an optional field containing omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that array cannot contain an empty assignment > + +<COMPILE> + +<MODULE TTCN NegSyn_060207_arrays_001 NegSyn_060207_arrays_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that array cannot contain an empty assignment + ** @verdict pass reject + ***************************************************/ + +module NegSyn_060207_arrays_001 { + + type component GeneralComp { + } + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSyn_060207_arrays_001() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, , 2, 3, 4}; // syntax error expected + + } + + control { + execute(TC_NegSyn_060207_arrays_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `,': syntax error, unexpected ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that array field cannot contain an empty index > + +<COMPILE> + +<MODULE TTCN NegSyn_060207_arrays_002 NegSyn_060207_arrays_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that array field cannot contain an empty index + ** @verdict pass reject + ***************************************************/ +module NegSyn_060207_arrays_002 { + + type component GeneralComp { + } + + + type integer MyArrayType1[5] (1 .. 10); + + testcase TC_NegSyn_060207_arrays_002() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 10, 2, 3, 4}; + v_array1[] := 10; // error expected - missing index + } + + control { + execute(TC_NegSyn_060207_arrays_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that array field cannot contain an empty index > + +<COMPILE> + +<MODULE TTCN NegSyn_060207_arrays_003 NegSyn_060207_arrays_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, ensure that array field cannot contain an empty index + ** @verdict pass reject + ***************************************************/ +module NegSyn_060207_arrays_003 { + + type component GeneralComp { + } + + + type integer MyArrayType1[5] (1 .. 10); + + + testcase TC_NegSyn_060207_arrays_003() runs on GeneralComp { + + var MyArrayType1 v_array1 := { 8, 10, 2, 3, 4}; + var integer i :=v_array1[];// error expected - missing index + } + + control { + execute(TC_NegSyn_060207_arrays_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - infinity in array variable dimension > + +<COMPILE> + +<MODULE TTCN NegSyn_060207_arrays_004 NegSyn_060207_arrays_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, infinity in array variable dimension + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Array dimensions may also be specified using ranges (with inclusive +// boundaries only). In such cases, the lower and upper values of the range +// define the lower and upper index values. Such an array is corresponding to +// a record of with a fixed length restriction computed as the difference +// between upper and lower index bound plus 1 and indexing starting from the +// lower bound of the array definition. + +module NegSyn_060207_arrays_004 { + + control { + var integer v_arr[1..infinity]; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060209_CommunicationPortTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that an error is generated when a message port type definition contains no message typess > + +<COMPILE> + +<MODULE TTCN NegSem_060209_CommunicationPortTypes_004 NegSem_060209_CommunicationPortTypes_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.9, Verify that an error is generated when a message port type definition contains no message types + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Each port type definition shall have one or more lists indicating the allowed collection of +// (message) types ... with the allowed communication direction. + +module NegSem_060209_CommunicationPortTypes_004 { + + type record MyType1 { + integer f1, + charstring f2 + } + + type record MyType2 { + integer g1, + charstring g2 + } + + type record MyType3 { + boolean h1, + MyType3 h2 optional + } + + type port MyMessagePortTypeOne message { + // address MyType1; + // map param (in integer p1, inout MyType2 p2); + // unmap param (in MyType3 p1, out integer p2); + } with {extension "internal"} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060209_CommunicationPortTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that an error is generated when a procedure port type definition contains no signatures > + +<COMPILE> + +<MODULE TTCN NegSem_060209_CommunicationPortTypes_005 NegSem_060209_CommunicationPortTypes_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.9, Verify that an error is generated when a procedure port type definition contains no signatures + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Each port type definition shall have one or more lists indicating the allowed collection of +// ... procedure signatures with the allowed communication direction. + +module NegSem_060209_CommunicationPortTypes_005 { + + type record MyType1 { + integer f1, + charstring f2 + } + + type record MyType2 { + integer g1, + charstring g2 + } + + type record MyType3 { + boolean h1, + MyType3 h2 optional + } + + type port MyMessagePortTypeOne procedure { + // address MyType1; + // map param (in integer p1, inout MyType2 p2); + // unmap param (in MyType3 p1, out integer p2); + } with {extension "internal"} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that cyclic extension is not allowed > + +<COMPILE> + +<MODULE TTCN NegSyn_060210_ReuseofComponentTypes_001 NegSyn_060210_ReuseofComponentTypes_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.10, Ensure that cyclic extension is not allowed + ** @verdict pass reject, noexecution + *****************************************************************/ + +/* The following requirements are tested: + * Restriction c.: It is allowed to extend component types that are defined by means of extension, + * as long as no cyclic chain of definition is created. + */ + +module NegSyn_060210_ReuseofComponentTypes_001 { + + type port loopbackPort message { + inout integer; + inout float; + } with {extension "internal"} + + type component MyCompA extends GeneralComp { + port loopbackPort pt_myPortA; + } + + + type component MyCompB extends MyCompA { + var integer MyInt; + } + + + type component GeneralComp extends MyCompB { //error: cyclic extension + port loopbackPort pt_myPortB; + } + + testcase TC_NegSyn_060210_ReuseofComponentTypes_001() runs on GeneralComp { + + pt_myPortB.send(2); + } + + control{ + execute(TC_NegSyn_060210_ReuseofComponentTypes_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking component type extensions: Circular reference: `@NegSyn_060210_ReuseofComponentTypes_001.MyCompA' -> `@NegSyn_060210_ReuseofComponentTypes_001.GeneralComp' -> `@NegSyn_060210_ReuseofComponentTypes_001.MyCompB' -> `@NegSyn_060210_ReuseofComponentTypes_001.MyCompA' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that cyclic extension is not allowed > + +<COMPILE> + +<MODULE TTCN NegSyn_060210_ReuseofComponentTypes_002 NegSyn_060210_ReuseofComponentTypes_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.10, Ensure that extending a component that occurs name clash is not allowed + ** @verdict pass reject, noexecution + *****************************************************************/ + +/* The following requirements are tested: + * Restriction b.: When defining component types by extending more than one parent type, + * there shall be no name clash between the definitions of the different parent types + */ + +module NegSyn_060210_ReuseofComponentTypes_002 { + + type port loopbackPort message { + inout integer; + inout float; + } with {extension "internal"} + + type component MyCompA { + port loopbackPort pt_myPortA; + } + + + type component MyCompB { + var integer MyInt; + } + + type component GeneralComp extends MyCompA, MyCompB { + port loopbackPort pt_myPortB; + var integer MyInt; //error: name clash + } + + testcase TC_NegSyn_060210_ReuseofComponentTypes_002() runs on GeneralComp { + + pt_myPortA.send(2); + pt_myPortB.send(2.0); + } + + control{ + execute(TC_NegSyn_060210_ReuseofComponentTypes_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_002.MyCompB +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that cyclic extension is not allowed > + +<COMPILE> + +<MODULE TTCN NegSyn_060210_ReuseofComponentTypes_003 NegSyn_060210_ReuseofComponentTypes_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.10, Ensure that extending a component that occurs name clash is not allowed + ** @verdict pass reject, noexecution + *****************************************************************/ + +/* The following requirements are tested: + * When defining component types by extension, there shall be + * no name clash between the definitions being taken from the parent type + * and the definitions being added in the extended type + */ + +module NegSyn_060210_ReuseofComponentTypes_003 { + + type port loopbackPort message { + inout integer; + inout float; + } with {extension "internal"} + + type component MyCompA { + port loopbackPort pt_myPortA; + var integer MyInt; + } + + + type component GeneralComp extends MyCompA { + port loopbackPort pt_myPortB; + var integer MyInt; //error: name clash from parent type + } + + testcase TC_NegSyn_060210_ReuseofComponentTypes_003() runs on GeneralComp { + + pt_myPortA.send(2); + pt_myPortB.send(2.0); + } + + control{ + execute(TC_NegSyn_060210_ReuseofComponentTypes_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_003.MyCompA +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The length subtyping check for 'record of' or 'set of' types > + +<COMPILE> + +<MODULE TTCN NegSem_06021301_LengthSubtyping_001 NegSem_06021301_LengthSubtyping_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types + ** @verdict pass reject + ***************************************************/ +module NegSem_06021301_LengthSubtyping_001 { + type record length(0..10) of integer RecordOfLengthLessThan10; + + type RecordOfLengthLessThan10 RecordOfLength4To5 length(4..5); + type RecordOfLength4To5 RecordOfLength6 length(6); //length out of parent type range + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(6\) is not subset of subtype length\(4..5\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The length subtyping check for 'record of' or 'set of' types > + +<COMPILE> + +<MODULE TTCN NegSem_06021301_LengthSubtyping_002 NegSem_06021301_LengthSubtyping_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types + ** @verdict pass reject + ***************************************************/ +module NegSem_06021301_LengthSubtyping_002 { + type set length(0..10) of integer SetOfLengthLessThan10; + + type SetOfLengthLessThan10 SetOfLength4To5 length(4..5); + type SetOfLength4To5 SetOfLength6 length(6); //length out of parent type range + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The subtype restriction is not a subset of the restriction on the parent type. Subtype length\(6\) is not subset of subtype length\(4..5\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The length subtyping check for 'record of' or 'set of' types > + +<COMPILE> + +<MODULE TTCN NegSem_06021301_LengthSubtyping_003 NegSem_06021301_LengthSubtyping_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types + ** @verdict pass reject + ***************************************************/ +module NegSem_06021301_LengthSubtyping_003 { + type record length(0..!10) of integer RecordOfLengthLessThan10; //only inclusive boundary is allowed + + type RecordOfLengthLessThan10 RecordOfLength4To5 length(4..5); + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `!': syntax error, unexpected '!' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - The length subtyping check for 'record of' or 'set of' types > + +<COMPILE> + +<MODULE TTCN NegSem_06021301_LengthSubtyping_004 NegSem_06021301_LengthSubtyping_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.1, The length subtyping check for 'record of' or 'set of' types + ** @verdict pass reject + ***************************************************/ +module NegSem_06021301_LengthSubtyping_004 { + type set length(0..10) of integer SetOfLengthLessThan10; + + type SetOfLengthLessThan10 SetOfLength5 length(!4..5); //only inclusive boundary is allowed + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `!': syntax error, unexpected '!' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021302_ListSubtyping_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that list subtyping check for record types is properly handled > + +<COMPILE> + +<MODULE TTCN NegSem_06021302_ListSubtyping_001 NegSem_06021302_ListSubtyping_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.2, ensure that list subtyping check for record types is properly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_06021302_ListSubtyping_001 { + type record MyRecord { + integer f1 optional, + charstring f2, + charstring f3 + } + + type MyRecord MyRecordSub1 ( + { f1 := omit, f2 := "user", f3 := "password" }, + { f1 := 1, f2 := "User", f3 := "Password" } + ); // a valid subtype of MyRecord containing 2 values + + type MyRecordSub1 MyRecordSub2 ( + { f1 := 1, f2 := "user", f3 := "password" }, + { f1 := 1, f2 := "User", f3 := "Password" } + ); //invalid subtype, the omitted element cannot be overwritten + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ f1 := 1, f2 := "user", f3 := "password" \},\{ f1 := 1, f2 := "User", f3 := "Password" \}\) is not subset of subtype \(\{ f1 := omit, f2 := "user", f3 := "password" \},\{ f1 := 1, f2 := "User", f3 := "Password" \}\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021302_ListSubtyping_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - ensure that list subtyping check for record types is properly handled > + +<COMPILE> + +<MODULE TTCN NegSem_06021302_ListSubtyping_002 NegSem_06021302_ListSubtyping_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.13.2, ensure that list subtyping check for record types is properly handled + ** @verdict pass reject + ***************************************************/ +module NegSem_06021302_ListSubtyping_002 { + type record MyRecord { + integer f1 optional, + charstring f2, + charstring f3 + } + + type MyRecord MyRecordSub1 ( + { f1 := -, f2 := "user", f3 := "password" }, + { f1 := -, f2 := "User", f3 := "Password" } + ); // a valid subtype of MyRecord containing 2 values + + type MyRecordSub1 MyRecordSub2 ( + { f1 := 1, f2 := "user", f3 := "password" }, + { f1 := 2, f2 := "user", f3 := "Password" } + ); //invalid subtype, contains wrong combination of f2 and f3 + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The subtype restriction is not a subset of the restriction on the parent type. Subtype \(\{ f1 := 1, f2 := "user", f3 := "password" \},\{ f1 := 2, f2 := "user", f3 := "Password" \}\) is not subset of subtype \(\{ f1 := -, f2 := "user", f3 := "password" \},\{ f1 := -, f2 := "User", f3 := "Password" \}\) +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 0603_type_compatibility folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_060301_non_structured_types_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles assignments from compatible size restrictions > + +<COMPILE> + +<MODULE TTCN NegSem_060301_non_structured_types_007 NegSem_060301_non_structured_types_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.1, Ensure that the IUT correctly handles assignments from compatible size restrictions + ** @verdict pass reject + ***************************************************/ + +module NegSem_060301_non_structured_types_007 { + type integer ConstrainedInt[1]; + + type component GeneralComp { + } + + testcase TC_NegSem_060301_non_structured_types_007() runs on GeneralComp { + + var integer v_int[2]:={5,4}; + var ConstrainedInt v_constrainedInt; + + + v_constrainedInt:=v_int; // length 2 array assigned to length 1 array type + } + + control{ + execute(TC_NegSem_060301_non_structured_types_007()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer\[1\]' was expected instead of `integer\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060301_non_structured_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles assignments from compatible size restrictions > + +<COMPILE> + +<MODULE TTCN NegSem_060301_non_structured_types_008 NegSem_060301_non_structured_types_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.1, Ensure that the IUT correctly handles assignments from compatible size restrictions + ** @verdict pass reject + ***************************************************/ + +module NegSem_060301_non_structured_types_008 { + type float ConstrainedFloat[1]; + + type component GeneralComp { + } + + testcase TC_NegSem_060301_non_structured_types_008() runs on GeneralComp { + + var float v_float[2]:={5.0,4.0}; + var ConstrainedFloat v_constrainedFloat; + + + v_constrainedFloat:=v_float; // length 2 array assigned to length 1 array type + } + + control{ + execute(TC_NegSem_060301_non_structured_types_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `float\[1\]' was expected instead of `float\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Reject assignment of other enumerated types since they are only compatible to synonym types > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_001 NegSem_060302_structured_types_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2.1, Reject assignment of other enumerated types since they are only compatible to synonym types + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_001 { + + type enumerated EnumeratedType {e_black, e_white}; + type enumerated EnumeratedRedefinition {e_black, e_white}; + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_001() runs on GeneralComp { + + var EnumeratedType v_enum1:=e_black; + var EnumeratedRedefinition v_enum2; + + v_enum2:=v_enum1; // not a synonym type + setverdict(pass); + } + + control{ + execute(TC_NegSem_060302_structured_types_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_001.EnumeratedRedefinition' was expected instead of `@NegSem_060302_structured_types_001.EnumeratedType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_002 NegSem_060302_structured_types_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_002 { + + type record RecordType1 { + integer a(0..10) optional, + integer b(0..5) optional, + boolean c + } + type record RecordType2 { + integer e optional, + integer f(0..10) , + boolean g + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_002() runs on GeneralComp { + + var RecordType1 v_rec1:={a:=4,b:=omit,c:=false}; + var RecordType2 v_rec2; + + v_rec2:=v_rec1; // optionality mismatch (e.g. b is optional where f is mandatory) + setverdict(pass); + } + + control{ + execute(TC_NegSem_060302_structured_types_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_002.RecordType2' was expected instead of `@NegSem_060302_structured_types_002.RecordType1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_003 NegSem_060302_structured_types_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_003 { + + type record RecordType { + integer a(0..10) optional, + integer b(0..10) optional, + boolean c + } + type record ModifiedRecord { + integer e optional, + integer f(0..5) optional, + boolean g + } + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_003() runs on GeneralComp { + + var ModifiedRecord v_rec1:={e:=15,f:=4,g:=false}; + var RecordType v_rec2; + + v_rec2:=v_rec1; //subtyping range mismatch + setverdict(pass); + + } + + control{ + execute(TC_NegSem_060302_structured_types_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_003.RecordType' was expected instead of `@NegSem_060302_structured_types_003.ModifiedRecord' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_004 NegSem_060302_structured_types_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_004 { + + type set SetType { + integer a(0..10) optional, + integer b(0..10) optional, + boolean c + } + type set ModifiedSet { + integer e optional, + integer f(0..5) , + boolean g + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_004() runs on GeneralComp { + + var ModifiedSet v_set1:={f:=4,e:=8,g:=false}; + var SetType v_set2; + + v_set2:=v_set1; //optionality mismatch + setverdict(pass); + + } + + control{ + execute(TC_NegSem_060302_structured_types_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_004.SetType' was expected instead of `@NegSem_060302_structured_types_004.ModifiedSet' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_005 NegSem_060302_structured_types_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_005 { + + type set SetType { + integer a(0..10) optional, + integer b(0..10) optional, + boolean c + } + type set ModifiedSet { + integer e optional, + integer f(0..5) optional, + boolean g + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_005() runs on GeneralComp { + + var ModifiedSet v_set1:={f:=4,e:=15,g:=false}; + var SetType v_set2; + + v_set2:=v_set1; //subtyping range mismatch + setverdict(pass); + + } + + control{ + execute(TC_NegSem_060302_structured_types_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_005.SetType' was expected instead of `@NegSem_060302_structured_types_005.ModifiedSet' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_008 NegSem_060302_structured_types_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_008 { + + type enumerated EnumeratedType {e_black, e_white}; + type EnumeratedType EnumeratedSynonym; + + type union UnionType { + integer a(0..10), + EnumeratedType b, + boolean c + } + + type union ModifiedUnion { + integer a, + boolean c, + EnumeratedSynonym b + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_008() runs on GeneralComp { + + var ModifiedUnion v_union1:={a:=12}; + var UnionType v_union2; + + v_union2:=v_union1; //subtyping range mismatch + setverdict(pass); + + } + + control{ + execute(TC_NegSem_060302_structured_types_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_008.UnionType' was expected instead of `@NegSem_060302_structured_types_008.ModifiedUnion' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_009 NegSem_060302_structured_types_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_009 { + + type enumerated EnumeratedType {e_black, e_white}; + type enumerated EnumeratedRedefinition {e_black, e_white}; + + type union UnionType { + integer a(0..10), + EnumeratedType b, + boolean c + } + type union ModifiedUnion { + integer a, + boolean c, + EnumeratedRedefinition b + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_009() runs on GeneralComp { + + var ModifiedUnion v_union1:={b:=e_black}; + var UnionType v_union2; + + v_union2:=v_union1; //enumerated type mismatch + setverdict(pass); + } + + control{ + execute(TC_NegSem_060302_structured_types_009()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_009.UnionType' was expected instead of `@NegSem_060302_structured_types_009.ModifiedUnion' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from incompatible types or type ranges > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_010 NegSem_060302_structured_types_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from incompatible types or type ranges + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_010 { + + type enumerated EnumeratedType {e_black, e_white}; + type EnumeratedType EnumeratedSynonym; + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + type union ModifiedUnion { + integer aa, + boolean cc, + EnumeratedSynonym bb + } + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_010() runs on GeneralComp { + + var ModifiedUnion v_union1:={aa:=1}; + var UnionType v_union2; + + v_union2:=v_union1; //element naming mismatch + setverdict(pass); + + } + +control{ + execute(TC_NegSem_060302_structured_types_010()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_010.UnionType' was expected instead of `@NegSem_060302_structured_types_010.ModifiedUnion' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments from structures having incompatible anytypes > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_011 NegSem_060302_structured_types_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments from structures having incompatible anytypes + ** @verdict pass reject + ***************************************************/ +module NegSem_060302_structured_types_011 { + + import from NegSem_060302_structured_types_011_importA all; + import from NegSem_060302_structured_types_011_importB all; + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_011() runs on GeneralComp { + + var NegSem_060302_structured_types_011_importA.Atype v_a; + var NegSem_060302_structured_types_011_importB.Atype v_b := { F := 1 } + + v_a:=v_b; //v_a's type does not contain the selected alternative + + if ( v_a==1 ) { + setverdict(pass); + } + else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_060302_structured_types_011()); + } + +} +<END_MODULE> + +<MODULE TTCN NegSem_060302_structured_types_011_importA NegSem_060302_structured_types_011_importA.ttcn > +module NegSem_060302_structured_types_011_importA { + type integer I (0..2); + type anytype Atype; + } +<END_MODULE> + +<MODULE TTCN NegSem_060302_structured_types_011_importB NegSem_060302_structured_types_011_importB.ttcn > +module NegSem_060302_structured_types_011_importB { + type integer I (0..2); + type integer F; + type anytype Atype; +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_011_importA.anytype' was expected instead of `@NegSem_060302_structured_types_011_importB.anytype' +<END_RESULT> +<RESULT COUNT 1> +error: The operands of operation `==' should be of compatible types +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_012 NegSem_060302_structured_types_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_012 { + + type record RecordType { + integer a, + integer b optional + } + + type set SetType { + integer a, + integer b optional + } + + type record length (1..2) of integer ShortIntegerList; + type record of integer IntegerList; + + type set length (1..2) of integer ShortUnorderedIntegerList; + type set of integer UnorderedIntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_012() runs on GeneralComp { + + + var IntegerList v_list1:={1,-}; + var ShortIntegerList v_list2; + var RecordType v_rec1; + var UnorderedIntegerList v_ulist1:={1,-}; + var ShortUnorderedIntegerList v_ulist2; + var SetType v_set1; + + var integer v_matcher[2] := {1,-}; + + var boolean v_check1; + + v_list2:=v_list1; + v_rec1:=v_list2; + v_ulist2:=v_ulist1; + v_set1:=v_ulist2; + + v_check1 := match(v_rec1, v_matcher); //mismatch between undefined and omitted elements + + } + + control{ + execute(TC_NegSem_060302_structured_types_012()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.RecordType' was expected instead of `@NegSem_060302_structured_types_012.ShortIntegerList' +<END_RESULT> +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.SetType' was expected instead of `@NegSem_060302_structured_types_012.ShortUnorderedIntegerList' +<END_RESULT> +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_012.RecordType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_013 NegSem_060302_structured_types_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments having mismatch between undefined and omitted elements + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_013 { + + type record RecordType { + integer a, + integer b optional + } + + type set SetType { + integer a, + integer b optional + } + + type record length (1..2) of integer ShortIntegerList; + type record of integer IntegerList; + + type set length (1..2) of integer ShortUnorderedIntegerList; + type set of integer UnorderedIntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_013() runs on GeneralComp { + + var IntegerList v_list1:={1,-}; + var ShortIntegerList v_list2; + var RecordType v_rec1; + var UnorderedIntegerList v_ulist1:={1,-}; + var ShortUnorderedIntegerList v_ulist2; + var SetType v_set1; + + var integer v_matcher[2] := {1,-}; + + var boolean v_check1; + + v_list2:=v_list1; + v_rec1:=v_list2; + v_ulist2:=v_ulist1; + v_set1:=v_ulist2; + + v_check1 := match(v_set1,{ a:= 1, b:= -}); //mismatch between undefined and omitted elements + + } + + control{ + execute(TC_NegSem_060302_structured_types_013()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.RecordType' was expected instead of `@NegSem_060302_structured_types_013.ShortIntegerList' +<END_RESULT> +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.SetType' was expected instead of `@NegSem_060302_structured_types_013.ShortUnorderedIntegerList' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_014 NegSem_060302_structured_types_014.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_014 { + + type record RecordType { + integer a, + integer b optional, + integer c + } + + type record of integer IntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_014() runs on GeneralComp { + + var RecordType v_record := { 1, omit, 2}; + var IntegerList v_IntList; + var integer v_array[2]; + + v_array:=v_record; //assignment between incompatible types + + } + + control{ + execute(TC_NegSem_060302_structured_types_014()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_014.RecordType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_015 NegSem_060302_structured_types_015.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_015 { + + type record RecordType { + integer a, + integer b optional, + integer c + } + + type record of integer IntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_015() runs on GeneralComp { + + var RecordType v_record := { 1, omit, 2}; + var IntegerList v_IntList; + var integer v_array[2]; + + v_IntList:=v_record; //assignment between incompatible types + + } + + control{ + execute(TC_NegSem_060302_structured_types_015()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_015.IntegerList' was expected instead of `@NegSem_060302_structured_types_015.RecordType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_016 NegSem_060302_structured_types_016.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_016 { + + type set SetType { + integer a, + integer b optional, + integer c + } + + type set of integer IntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_016() runs on GeneralComp { + + var SetType v_set := { a:= 1, b:= omit, c:= 2}; // value list not work with sets + var IntegerList v_IntList; + var integer v_array[2]; + + v_array:=v_set; //assignment between incompatible types + + } + + control{ + execute(TC_NegSem_060302_structured_types_016()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_016.SetType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_017 NegSem_060302_structured_types_017.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_017 { + + type set SetType { + integer a, + integer b optional, + integer c + } + + type set of integer IntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_017() runs on GeneralComp { + + var SetType v_set := { a:= 1, b:= omit, c:= 2}; // value list not work with sets + var IntegerList v_IntList; + var integer v_array[2]; + + v_IntList:=v_set; //assignment between incompatible types + + } + + control{ + execute(TC_NegSem_060302_structured_types_017()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_017.IntegerList' was expected instead of `@NegSem_060302_structured_types_017.SetType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_018 NegSem_060302_structured_types_018.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT rejects assignments between incompatible structures + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_018 { + + type set SetType { + integer a, + integer b, + integer c + } + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_018() runs on GeneralComp { + + var SetType v_set := { a:= 1, b:= 2, c:= 3}; + var integer v_array[3]; + + v_array:=v_set; //assignment between incompatible types, see clause G.9 compatibility rules + + } + + control{ + execute(TC_NegSem_060302_structured_types_018()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `integer\[3\]' was expected instead of `@NegSem_060302_structured_types_018.SetType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT rejects assignments between incompatible structures > + +<COMPILE> + +<MODULE TTCN NegSem_060302_structured_types_019 NegSem_060302_structured_types_019.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.2, Ensure that the IUT correctly handles assignments from structures having compatible types and lengths + ** @verdict pass reject + ***************************************************/ + +module NegSem_060302_structured_types_019 { + + type record RecordType { + integer a, + integer b optional + } + + type set SetType { + integer a, + integer b optional + } + + type record length (1..2) of integer ShortIntegerList; + type record of integer IntegerList; + + type set length (1..2) of integer ShortUnorderedIntegerList; + type set of integer UnorderedIntegerList; + + + type component GeneralComp { + } + + testcase TC_NegSem_060302_structured_types_019() runs on GeneralComp { + + var IntegerList v_list1:={1,-}; + var ShortIntegerList v_list2; + var RecordType v_rec1; + var UnorderedIntegerList v_ulist1:={1,-}; + var ShortUnorderedIntegerList v_ulist2; + var SetType v_set1; + + var integer v_matcher[2] := {1,-}; + + var boolean v_check1; + + v_list2:=v_list1; + v_rec1:=v_list2; //incompatible assignment according to TTCN-3:2012 + v_ulist2:=v_ulist1; + v_set1:=v_ulist2; //incompatible assignment according to TTCN-3:2012 + + v_check1 := (v_list2[0]==1); + + + if ( v_check1 ) + { + setverdict(pass); + } + else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_060302_structured_types_019()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.RecordType' was expected instead of `@NegSem_060302_structured_types_019.ShortIntegerList' +<END_RESULT> +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.SetType' was expected instead of `@NegSem_060302_structured_types_019.ShortUnorderedIntegerList' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060303_component_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions > + +<COMPILE> + +<MODULE TTCN NegSem_060303_component_types_001 NegSem_060303_component_types_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.3, Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_060303_component_types_001 { + + type integer ConstrainedInteger(0..10); + + type component TestCaseComp { + const integer c_integer:=2; + } + + type component FunctionComp { + const integer c_integer:=2; + const ConstrainedInteger c_constrained:=2; + } + + function f_testFunction(integer p_arg) runs on FunctionComp return integer { + + var integer v_result; + v_result:=p_arg*c_integer; + return v_result; + } + + testcase TC_NegSem_060303_component_types_001() runs on TestCaseComp { + + var integer v_int:=1; + + v_int := f_testFunction(v_int); + // runs on mtc with type TestCaseComp + // f_testFunction needs to run on FunctionComp + // which has 2 variables not 1 as TestCaseComp + setverdict (fail, "ERROR expected: function runs on mtc with type TestCaseComp f_testFunction needs to run on FunctionComp which has 2 variables not 1 as TestCaseComp"); + } + + control { + execute(TC_NegSem_060303_component_types_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Runs on clause mismatch: A definition that runs on component type `@NegSem_060303_component_types_001.TestCaseComp' cannot call function `@NegSem_060303_component_types_001.f_testFunction', which runs on `@NegSem_060303_component_types_001.FunctionComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060303_component_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles component incompatibility due to differing list of constant definitions > + +<COMPILE> + +<MODULE TTCN NegSem_060303_component_types_002 NegSem_060303_component_types_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:6.3.3, Ensure that the IUT correctly handles component incompatibility due to differing constant types having same name + ** @verdict pass reject + ***************************************************/ + +module NegSem_060303_component_types_002 { + + type integer ConstrainedInteger(0..10); + + type component TestCaseComp { + const integer c_integer:=2; + const integer c_constrained:=2; + } + + type component FunctionComp { + const integer c_integer:=2; + const ConstrainedInteger c_constrained:=2; + } + + function f_testFunction(integer p_arg) runs on FunctionComp return integer { + + var integer v_result; + v_result:=p_arg*c_integer; + return v_result; + } + + testcase TC_NegSem_060303_component_types_002() runs on TestCaseComp { + + var integer v_int:=1; + + f_testFunction(v_int); + + setverdict(fail, "Error expected: as component types are not compatible since their definitions are not identical."); + } + + control { + execute(TC_NegSem_060303_component_types_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Runs on clause mismatch: A definition that runs on component type `@NegSem_060303_component_types_002.TestCaseComp' cannot call function `@NegSem_060303_component_types_002.f_testFunction', which runs on `@NegSem_060303_component_types_002.FunctionComp' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/07-14_folder.script b/conformance_test/negative_tests/07-14_folder.script new file mode 100644 index 0000000000000000000000000000000000000000..98053557dd0a8c4408d56fe0a3d4136b82910482 --- /dev/null +++ b/conformance_test/negative_tests/07-14_folder.script @@ -0,0 +1,3105 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 07_expressions, 08_modules, 09_test_configurations, 10_constants, 11_variables, 12_timers and 14_procedure_signatures folders. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 07_expressions folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_07_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - function without return clause in expression > + +<COMPILE> + +<MODULE TTCN NegSem_07_toplevel_001 NegSem_07_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:7, function without return clause in expression + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Functions used in expressions shall have a return clause. + +module NegSem_07_toplevel_001 +{ + type component GeneralComp { + } + + function f() + { + var integer v_num := 1; + } + + testcase TC_NegSem_07_toplevel_001() runs on GeneralComp { + var integer v_num := 3 * f(); + setverdict(pass); + } + + control { + execute(TC_NegSem_07_toplevel_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of a call of function `@NegSem_07_toplevel_001.f', which does not have return type +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_07_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - template used as expression operand > + +<COMPILE> + +<MODULE TTCN NegSem_07_toplevel_002 NegSem_07_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:7, template used as expression operand + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The operands of the operators used in an expression shall be values and their root +// types shall be the types specified for the appropriate operator in the subsequent +// clauses. + +module NegSem_07_toplevel_002 +{ + type component GeneralComp { + } + + function f() + { + var integer p_num := 1; + } + + testcase TC_NegSem_07_toplevel_002() runs on GeneralComp { + var template(value) integer vm_num := 3; + var integer p_num := 3 * vm_num; + setverdict(pass); + } + + control { + execute(TC_NegSem_07_toplevel_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `vm_num' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_07_toplevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - uninitialized value in an expression > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_07_toplevel_003 NegSem_07_toplevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:7, uninitialized value in an expression + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// At the point, when an expression is evaluated, the evaluated values of the +// operands used in expressions shall be completely initialized except where +// explicitly stated otherwise in the specific clause of the operator. + +module NegSem_07_toplevel_003 +{ + type component GeneralComp { + } + + type record R { + integer field1, + integer field2 optional + } + + testcase TC_NegSem_07_toplevel_003() runs on GeneralComp { + var R v_rec; + v_rec.field1 := 1; + if (10 + v_rec.field2 != -1) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_07_toplevel_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using the value of an optional field containing omit. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that Arithmetic operators are for integer and float values > + +<COMPILE> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_001 NegSem_070101_ArithmeticOperators_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that Arithmetic operators are for integer and float values + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_001 { + +type component GeneralComp { +} + +testcase TC_NegSem_070101_ArithmeticOperators_001() runs on GeneralComp { + var integer v_i := 20; + var boolean v_k :=true; + + var integer v_result := v_i*v_k; // not allowed int*boolean + + setverdict(pass); + + +} +control{ + execute(TC_NegSem_070101_ArithmeticOperators_001()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Second operand of operation `\*' should be integer or float value +<END_RESULT> +<RESULT COUNT 1> +error: The operands of operation `\*' should be of same type +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that arithmetic operators can handle same type of variables > + +<COMPILE> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_002 NegSem_070101_ArithmeticOperators_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that arithmetic operators can handle same type of variables + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_002 { + +type component GeneralComp { +} + +testcase TC_NegSem_070101_ArithmeticOperators_002() runs on GeneralComp { + var integer v_i := 20; + var float v_k :=2.0E0; + + var integer v_result := v_i*v_k; // not allowed int*float + + setverdict(pass); + +} +control{ + execute(TC_NegSem_070101_ArithmeticOperators_002()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operands of operation `\*' should be of same type +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that mod arithmetic operator can handle integer variables > + +<COMPILE> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_003 NegSem_070101_ArithmeticOperators_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that mod arithmetic operator can handle integer variables + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_003 { + +type component GeneralComp { +} + +testcase TC_NegSem_070101_ArithmeticOperators_003() runs on GeneralComp { + var float v_i := 2.0E1; + var float v_k :=2.0E0; + + var integer v_result := v_i mod v_k; // mod operator is only for integer type + + setverdict(pass); +} +control{ + execute(TC_NegSem_070101_ArithmeticOperators_003()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Left operand of operation `mod' should be integer value +<END_RESULT> +<RESULT COUNT 1> +error: Right operand of operation `mod' should be integer value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that rem arithmetic operator can handle integer variables > + +<COMPILE> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_004 NegSem_070101_ArithmeticOperators_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that rem arithmetic operator can handle integer variables + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_004 { + +type component GeneralComp { +} + +testcase TC_NegSem_070101_ArithmeticOperators_004() runs on GeneralComp { + var float v_i := 2.0E1; + var float v_k :=2.0E0; + + var integer v_result := v_i rem v_k; // rem operator is only for integer type + + setverdict(pass); +} +control{ + execute(TC_NegSem_070101_ArithmeticOperators_004()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Left operand of operation `rem' should be integer value +<END_RESULT> +<RESULT COUNT 1> +error: Right operand of operation `rem' should be integer value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that in x mod y arithmetic operator y is non-zero positive number > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_008 NegSem_070101_ArithmeticOperators_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that in x mod y arithmetic operator y is non-zero positive number + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_008 { + + type component GeneralComp { + } + + testcase TC_NegSem_070101_ArithmeticOperators_008() runs on GeneralComp { + var integer v_i := 20; + var integer v_k :=0; + + var integer v_result := v_i mod v_k; // arithmetic operator mod with 0 is not allowed + + setverdict(pass); + + } + control{ + execute(TC_NegSem_070101_ArithmeticOperators_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The right operand of mod operator is zero. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that in x rem y arithmetic operator y is non-zero positive number > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_009 NegSem_070101_ArithmeticOperators_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that in x rem y arithmetic operator y is non-zero positive number + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_009 { + + type component GeneralComp { + } + + testcase TC_NegSem_070101_ArithmeticOperators_009() runs on GeneralComp { + var integer v_i := 20; + var integer v_k :=0; + + var integer v_result := v_i rem v_k; // arithmetic operator rem with 0 is not allowed + + setverdict(pass); + + } + control{ + execute(TC_NegSem_070101_ArithmeticOperators_009()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Integer division by zero. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that in x rem y arithmetic operator y is non-zero positive number > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_070101_ArithmeticOperators_010 NegSem_070101_ArithmeticOperators_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.1, Ensure that in x rem y arithmetic operator y is non-zero positive number + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070101_ArithmeticOperators_010 { + +type component GeneralComp { +} + +testcase TC_NegSem_070101_ArithmeticOperators_010() runs on GeneralComp { + var integer v_i := 20; + var integer v_k :=4; + var integer v_l :=2; + + var integer v_result := v_i rem (v_k mod v_l); // arithmetic operator rem with 0 is not allowed + + setverdict(pass); + +} +control{ + execute(TC_NegSem_070101_ArithmeticOperators_010()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Integer division by zero. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the equals operator on records is evaluated correctly. > + +<COMPILE> + +<MODULE TTCN NegSem_070103_RelationalOperators_002 NegSem_070103_RelationalOperators_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_070103_RelationalOperators_002 { + +type component GeneralComp { +} + + type set IntegerSet1 { + integer a1 optional, + integer a2 optional, + integer a3 optional + }; + + type set IntegerSet2 { + integer a4 optional, + integer a5 optional, + integer a6 optional + }; + + type set LargeSet { + integer a1 optional, + integer a2 optional, + integer a3 optional, + integer a4 optional, + integer a5 optional, + integer a6 optional + }; + + +testcase TC_NegSem_070103_RelationalOperators_002() runs on GeneralComp { + const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; + const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; + const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5,a6:=omit}; + + if ( c_set1 & c_set2 == c_large ) { //It is intentionally forbidden to concatenate record and set values + setverdict(pass); + } + +} + +control{ + execute(TC_NegSem_070103_RelationalOperators_002()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Left operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> +<RESULT COUNT 1> +error: Right operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the equals operator on records is evaluated correctly. > + +<COMPILE> + +<MODULE TTCN NegSem_070103_RelationalOperators_003 NegSem_070103_RelationalOperators_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. + ** @verdict pass reject + *****************************************************************/ +//on hold till resolution of CR6707 + +module NegSem_070103_RelationalOperators_003 { + +type component GeneralComp { +} + + type set IntegerSet1 { + integer a1 optional, + integer a2 optional, + integer a3 optional + }; + + type set IntegerSet2 { + integer a4 optional, + integer a5 optional, + integer a6 optional + }; + + type set LargeSet { + integer a1 optional, + integer a2 optional, + integer a3 optional, + integer a4 optional, + integer a5 optional, + integer a6 optional + }; + + +testcase TC_NegSem_070103_RelationalOperators_003() runs on GeneralComp { + const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; + const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; + const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5,a6:=6}; + + if ( c_set1 & c_set2 != c_large ) { //It is intentionally forbidden to concatenate record and set values + setverdict(pass); + } + +} + +control{ + execute(TC_NegSem_070103_RelationalOperators_003()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Left operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> +<RESULT COUNT 1> +error: Right operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the equals operator on records is evaluated correctly. > + +<COMPILE> + +<MODULE TTCN NegSem_070103_RelationalOperators_004 NegSem_070103_RelationalOperators_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:7.1.3, Ensure that the equals operator on records is evaluated correctly. + ** @verdict pass reject + *****************************************************************/ +//on hold till resolution of CR6707 + +module NegSem_070103_RelationalOperators_004 { + +type component GeneralComp { +} + + type set IntegerSet1 { + integer a1 optional, + integer a2 optional, + integer a3 optional + }; + + type set IntegerSet2 { + integer a4 optional, + integer a5 optional, + integer a6 optional + }; + + type set LargeSet { + integer a1 optional, + integer a2 optional, + integer a3 optional, + integer a4 optional, + integer a5 optional + }; + + +testcase TC_NegSem_070103_RelationalOperators_004() runs on GeneralComp { + const IntegerSet1 c_set1 := {a1:=0,a2:=omit,a3:=2}; + const IntegerSet2 c_set2 := {a4:=3,a5:=5,a6:=omit}; + const LargeSet c_large := {a1:=0,a2:=omit,a3:=2,a4:=3,a5:=5}; + + if ( c_set1 & c_set2 != c_large ) { //It is intentionally forbidden to concatenate record and set values + setverdict(pass); + } + +} + +control{ + execute(TC_NegSem_070103_RelationalOperators_004()); +} + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Left operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> +<RESULT COUNT 1> +error: Right operand of operation `&' should be a string, `record of' or `set of' value +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 08_modules folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSyn_0801_DefinitionOfAModule_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with multiple language specifications is rejected. > + +<COMPILE> + +<MODULE TTCN NegSyn_0801_DefinitionOfAModule_001 NegSyn_0801_DefinitionOfAModule_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with multiple language specifications is rejected. + ** @verdict pass reject + *****************************************************************/ +// list of languages is not allowed +module NegSyn_0801_DefinitionOfAModule_001 language "TTCN-3:2005", "TTCN-3:2009", "TTCN-3:2010" { + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `,': syntax error, unexpected ',', expecting '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that name handling of imported enumerations is properly handled > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_002 NegSem_08020301_GeneralFormatOfImport_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Ensure that name handling of imported enumerations is properly handled + ** @verdict pass reject + *****************************************************************/ + +module NegSem_08020301_GeneralFormatOfImport_002 { + import from NegSem_08020301_GeneralFormatOfImport_002_import all; + + const EnumType2 c_enum := enumX; + + modulepar EnumType px_ModulePar := NegSem_08020301_GeneralFormatOfImport_002.c_enum; //type mismatch +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_002_import NegSem_08020301_GeneralFormatOfImport_002_import.ttcn > +module NegSem_08020301_GeneralFormatOfImport_002_import { + type enumerated EnumType {enumX, enumY, enumZ}; + type enumerated EnumType2 {enumX, enumY, enumZ}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: a value of type `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType' was expected instead of `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that name handling of imported enumerations is properly handled > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003 NegSem_08020301_GeneralFormatOfImport_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.4, Ensure that transitive import rules are properly handled + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_08020301_GeneralFormatOfImport_003 { + +import from NegSem_08020301_GeneralFormatOfImport_003_import { + const all; +}; + +type component GeneralComp {} + +testcase TC_NegSem_08020301_GeneralFormatOfImport_003() runs on GeneralComp { + if (c_myconst == 43532) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_NegSem_08020301_GeneralFormatOfImport_003()); +} +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003_import NegSem_08020301_GeneralFormatOfImport_003_import.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_003_import { + public import from NegSem_08020301_GeneralFormatOfImport_003_import_2 all; +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_003_import_2 NegSem_08020301_GeneralFormatOfImport_003_import_2.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_003_import_2 { + const integer c_myconst := 43532; +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that transitive import rules are properly handled > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004 NegSem_08020301_GeneralFormatOfImport_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.4, Ensure that transitive import rules are properly handled + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_08020301_GeneralFormatOfImport_004 { + +import from NegSem_08020301_GeneralFormatOfImport_004_import all; + +type component GeneralComp {} + +testcase TC_NegSem_08020301_GeneralFormatOfImport_004() runs on GeneralComp { + if (c_myconst == 43532) { + setverdict(pass); + } else { + setverdict(fail); + } +} + +control{ + execute(TC_NegSem_08020301_GeneralFormatOfImport_004()); +} +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004_import NegSem_08020301_GeneralFormatOfImport_004_import.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_004_import { + import from NegSem_08020301_GeneralFormatOfImport_004_import_2 all; +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_004_import_2 NegSem_08020301_GeneralFormatOfImport_004_import_2.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_004_import_2 { + const integer c_myconst := 43532; +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Make sure that the identifier of the current module cannot be used for prefixing imported entities > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_005 NegSem_08020301_GeneralFormatOfImport_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Make sure that the identifier of the current module cannot be used for prefixing imported entities + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Name clashes shall be resolved using qualified name(s) for the imported definition(s), +// i.e. prefixing the imported definition by the identifier of the module in which it has +// been defined; the prefix and the identifier shall be separated by a dot ("."). +// In cases where there are no ambiguities the prefixing need not (but may) be present +// when the imported definitions are used. + +module NegSem_08020301_GeneralFormatOfImport_005 { + +import from NegSem_08020301_GeneralFormatOfImport_005_import all; + +type component GeneralComp {} + +testcase TC_NegSem_08020301_GeneralFormatOfImport_005() runs on GeneralComp { + log(NegSem_08020301_GeneralFormatOfImport_005.c_test); + setverdict(pass); +} + +control{ + execute(TC_NegSem_08020301_GeneralFormatOfImport_005()); +} +} + +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_005_import NegSem_08020301_GeneralFormatOfImport_005_import.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_005_import { + const integer c_test := 5; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no definition with name `c_test' in module `NegSem_08020301_GeneralFormatOfImport_005' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the only top-level visible definitions of a module may be imported. > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_006 NegSem_08020301_GeneralFormatOfImport_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Ensure that the only top-level visible definitions of a module may be imported. + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Restriction b: +// Only top-level visible definitions of a module may be imported. Definitions which +// are top-level but invisible to the importing module or which occur at a lower scope +// (e.g. local constants defined in a function) shall not be imported. + +module NegSem_08020301_GeneralFormatOfImport_006 { +import from NegSem_08020301_GeneralFormatOfImport_006_import { const c_test }; + +type component GeneralComp {} + +testcase TC_NegSem_08020301_GeneralFormatOfImport_006() runs on GeneralComp { + log(c_test); + setverdict(pass); +} + +control{ + execute(TC_NegSem_08020301_GeneralFormatOfImport_006()); +} +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_006_import NegSem_08020301_GeneralFormatOfImport_006_import.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_006_import { + control { + const integer c_test := 5; + } +} + +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_test' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that information about message types is imported together with port type > + +<COMPILE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_007 NegSem_08020301_GeneralFormatOfImport_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Verify that information about message types is imported together with port type + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Restriction d: +// A definition is imported together with all information of referenced definitions that +// are necessary for the usage of the imported definition, independent of the visibility +// of the referenced definitions. +// Table 8: +// User defined type, port type + +module NegSem_08020301_GeneralFormatOfImport_007 { +import from NegSem_08020301_GeneralFormatOfImport_007_import { type P }; + +type component GeneralComp { + port P p1; +} with {extension "internal"} + +testcase TC_NegSem_08020301_GeneralFormatOfImport_007() runs on GeneralComp { + // Since the type of the sent message is not compatible with the allowed types of the imported + // port type, a type compatibility error shall be generated. This proves that the type information + // has been properly imported. + p1.send(charstring:"abc"); + setverdict(pass); +} + +control{ + execute(TC_NegSem_08020301_GeneralFormatOfImport_007()); +} +} +<END_MODULE> + +<MODULE TTCN NegSem_08020301_GeneralFormatOfImport_007_import NegSem_08020301_GeneralFormatOfImport_007_import.ttcn > + +module NegSem_08020301_GeneralFormatOfImport_007_import { + type port P message { + inout integer; + } +} + +<END_MODULE> + + +<RESULT COUNT 1> +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_08020301_GeneralFormatOfImport_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that import statement cannot be used in test case blocks > + +<COMPILE> + +<MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_001 NegSyn_08020301_GeneralFormatOfImport_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Ensure that import statement cannot be used in test case blocks + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Restriction a: +// An import statement shall only be used in the module definitions part and not be used +// within a control part, function definition, and alike. + +module NegSyn_08020301_GeneralFormatOfImport_001 { + + type component GeneralComp {} + + testcase TC_NegSyn_08020301_GeneralFormatOfImport_001() runs on GeneralComp { + import from NegSyn_08020301_GeneralFormatOfImport_001_import all; + log(c_test); + setverdict(pass); + } + + control{ + execute(TC_NegSyn_08020301_GeneralFormatOfImport_001()); + } +} + +<END_MODULE> + +<MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_001_import NegSyn_08020301_GeneralFormatOfImport_001_import.ttcn > + +module NegSyn_08020301_GeneralFormatOfImport_001_import { + const integer c_test := 5; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: at or before token `import': syntax error, unexpected ImportKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_08020301_GeneralFormatOfImport_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that import statement cannot be used in module control part > + +<COMPILE> + +<MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_002 NegSyn_08020301_GeneralFormatOfImport_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.1, Ensure that import statement cannot be used in module control part + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Restriction a: +// An import statement shall only be used in the module definitions part and not be used +// within a control part, function definition, and alike. + +module NegSyn_08020301_GeneralFormatOfImport_002 { + + type component GeneralComp {} + + testcase TC_NegSyn_08020301_GeneralFormatOfImport_002() runs on GeneralComp { + setverdict(pass); + } + + control{ + import from NegSyn_08020301_GeneralFormatOfImport_002_import all; + log(c_test); + execute(TC_NegSyn_08020301_GeneralFormatOfImport_002()); + } + +} +<END_MODULE> + +<MODULE TTCN NegSyn_08020301_GeneralFormatOfImport_002_import NegSyn_08020301_GeneralFormatOfImport_002_import.ttcn > + +module NegSyn_08020301_GeneralFormatOfImport_002_import { + const integer c_test := 5; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: at or before token `import': syntax error, unexpected ImportKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the import of import statements works for import all. > + +<COMPILE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.7, Ensure that the import of import statements works for import all. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 { + + import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA { + import all; + }; + + type component GeneralComp {} + + testcase TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001() runs on GeneralComp { + if (c_myconst == 43532) { // c_myconst shall not be accessible as the import in the importA module is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA.ttcn > + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA { + private import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB all; +} + +<END_MODULE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB.ttcn > + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB { + const integer c_myconst := 43532; +} + +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the import of import statements works for import all. > + +<COMPILE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.3.7, Ensure that the import of import statements works for import all. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 { + + import from Sem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA { + import all; + }; + + type component GeneralComp {} + + testcase TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002() runs on GeneralComp { + if (c_myconst == 43532) { // c_myconst shall not be accessible as the import in the importA module is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002()); + } +} + +<END_MODULE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA.ttcn > + +module Sem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA { + // imports are private by default + import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB all; +} + +<END_MODULE> + +<MODULE TTCN NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB.ttcn > + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB { + const integer c_myconst := 43532; +} + +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080204_DefinitionOfFriendModules_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the import of import statements works for import all. > + +<COMPILE> + +<MODULE TTCN NegSem_080204_DefinitionOfFriendModules_001 NegSem_080204_DefinitionOfFriendModules_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.4, Ensure that friend visibility works for a sample constant. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080204_DefinitionOfFriendModules_001 { + + import from NegSem_080204_DefinitionOfFriendModules_001_import all; + + type component GeneralComp {} + + testcase TC_NegSem_080204_DefinitionOfFriendModules_001() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible. A friend module statement is missing in NegSem_080204_DefinitionOfFriendModules_001_import. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080204_DefinitionOfFriendModules_001()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_080204_DefinitionOfFriendModules_001_import NegSem_080204_DefinitionOfFriendModules_001_import.ttcn > + +module NegSem_080204_DefinitionOfFriendModules_001_import { + friend const integer c_myconst := 32532; +} + +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080204_DefinitionOfFriendModules_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that private definitions are not made visible by friend declarations (for a constant sample definition). > + +<COMPILE> + +<MODULE TTCN NegSem_080204_DefinitionOfFriendModules_002 NegSem_080204_DefinitionOfFriendModules_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.4, Ensure that private definitions are not made visible by friend declarations (for a constant sample definition). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080204_DefinitionOfFriendModules_002 { + + import from NegSem_080204_DefinitionOfFriendModules_002_import all; + + type component GeneralComp {} + + testcase TC_NegSem_080204_DefinitionOfFriendModules_002() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible. The definition is private even though the module is a friend. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080204_DefinitionOfFriendModules_002()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_080204_DefinitionOfFriendModules_002_import NegSem_080204_DefinitionOfFriendModules_002_import.ttcn > + +module NegSem_080204_DefinitionOfFriendModules_002_import { + friend module NegSem_080204_DefinitionOfFriendModules_001; + + private const integer c_myconst := 32532; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that private definition (in this case a sample constant) is not visible using a normal import. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_001 NegSem_080205_VisibilityOfDefinitions_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a normal import. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080205_VisibilityOfDefinitions_001 { + + import from NegSem_080205_VisibilityOfDefinitions_001_import all; + + type component GeneralComp {} + + testcase TC_NegSem_080205_VisibilityOfDefinitions_001() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080205_VisibilityOfDefinitions_001()); + } +} + +<END_MODULE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_001_import NegSem_080205_VisibilityOfDefinitions_001_import.ttcn > + +module NegSem_080205_VisibilityOfDefinitions_001_import { + private const integer c_myconst := 32532; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that private definition (in this case a sample constant) is not visible using an import of a friend module. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_002 NegSem_080205_VisibilityOfDefinitions_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using an import of a friend module. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080205_VisibilityOfDefinitions_002 { + + import from NegSem_080205_VisibilityOfDefinitions_002_import all; + + type component GeneralComp {} + + testcase TC_NegSem_080205_VisibilityOfDefinitions_002() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080205_VisibilityOfDefinitions_002()); + } +} + + +<END_MODULE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_002_import NegSem_080205_VisibilityOfDefinitions_002_import.ttcn > + +module NegSem_080205_VisibilityOfDefinitions_002_import { + friend module NegSem_080205_VisibilityOfDefinitions_002; + + private const integer c_myconst := 32532; +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_003 NegSem_080205_VisibilityOfDefinitions_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.5, Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080205_VisibilityOfDefinitions_003 { + + import from NegSem_080205_VisibilityOfDefinitions_003_import { + group CONST_GROUP; + } + + type component GeneralComp {} + + testcase TC_NegSem_080205_VisibilityOfDefinitions_003() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080205_VisibilityOfDefinitions_003()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_003_import NegSem_080205_VisibilityOfDefinitions_003_import.ttcn > + +module NegSem_080205_VisibilityOfDefinitions_003_import { + group CONST_GROUP { + friend const integer c_myconst := 32532; + } +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that friend definition (in this case a sample constant) is not visible using a group import of a non-friend module. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_004 NegSem_080205_VisibilityOfDefinitions_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a group import of a non-friend module. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080205_VisibilityOfDefinitions_004 { + + import from NegSem_080205_VisibilityOfDefinitions_004_import { + group CONST_GROUP; + } + + type component GeneralComp {} + + testcase TC_NegSem_080205_VisibilityOfDefinitions_004() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080205_VisibilityOfDefinitions_004()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_004_import NegSem_080205_VisibilityOfDefinitions_004_import.ttcn > + +module NegSem_080205_VisibilityOfDefinitions_004_import { + group CONST_GROUP { + private const integer c_myconst := 32532; + } +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that private definition (in this case a sample constant) is not visible using a group import of a friend module. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005 NegSem_080205_VisibilityOfDefinitions_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.2.5, Ensure that private definition (in this case a sample constant) is not visible using a group import of a friend module. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_080205_VisibilityOfDefinitions_005 { + + import from NegSem_080205_VisibilityOfDefinitions_005_import { + group CONST_GROUP; + } + + type component GeneralComp {} + + testcase TC_NegSem_080205_VisibilityOfDefinitions_005() runs on GeneralComp { + if (c_myconst == 32532) { // c_myconst shall not be visible on import as the definition is private. + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_080205_VisibilityOfDefinitions_005()); + } +} +<END_MODULE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005_import NegSem_080205_VisibilityOfDefinitions_005_import.ttcn > + +module NegSem_080205_VisibilityOfDefinitions_005_import { + friend module NegSem_080205_VisibilityOfDefinitions_005; + + group CONST_GROUP { + private const integer c_myconst := 32532; + } +} +<END_MODULE> + + +<RESULT COUNT 1> +error: There is no local or imported definition with name `c_myconst' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there is not more than one control part. > + +<COMPILE> + +<MODULE TTCN NegSem_080205_VisibilityOfDefinitions_005 NegSem_080205_VisibilityOfDefinitions_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.3, Ensure that there is not more than one control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSyn_0803_ModuleControlPart_001 { + + control { + var integer count := 0; + } + + control { + var integer count := 0; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `control': syntax error, unexpected ControlKeyword, expecting '\{' or '\}' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 09_test_configurations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that a two TSI port cannot be connected > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_0901_Communication_ports_007 NegSem_0901_Communication_ports_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:9.1, Verify that a two TSI port cannot be connected + ** @verdict pass reject + ***************************************************/ + +/*NOTE: see Figure 7(f): Two TSI port cannot be connected + * */ + +module NegSem_0901_Communication_ports_007 { + + type port P message { + inout integer + } with {extension "internal"} + + type component GeneralComp + { + port P p1, p2; + } + + testcase TC_NegSem_0901_Communication_ports_007() runs on GeneralComp system GeneralComp { + var GeneralComp s := system; + map(s:p2, system:p1); // error: p1 and p2 cannot be connected + + setverdict(pass); + } + + control{ + execute(TC_NegSem_0901_Communication_ports_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Both arguments of map operation refer to system ports. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that connections within the test system interface are not allowed > + +<COMPILE> + +<MODULE TTCN NegSem_0901_Communication_ports_009 NegSem_0901_Communication_ports_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:9.1, Verify that connections within the test system interface are not allowed + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Restriction a): Connections within the test system interface are not allowed. + +module NegSem_0901_Communication_ports_009 { + + type port P message { + inout integer + } with {extension "internal"} + + type component GeneralComp + { + port P p1, p2; + } + + testcase TC_NegSem_0901_Communication_ports_009() runs on GeneralComp system GeneralComp { + map(system:p1, system:p1); // mapping system port to itself: error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_0901_Communication_ports_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Both endpoints of the mapping are system ports +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0901_Communication_ports_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that a two TSI port cannot be connected > + +<COMPILE> + +<MODULE TTCN NegSyn_0901_Communication_ports_001 NegSem_0901_Communication_ports_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:9.1, Verify that a two TSI port cannot be connected + ** @verdict pass reject, noexecution + ***************************************************/ + +/*NOTE: see Figure 7(f): Two TSI port cannot be connected + * */ + +module NegSyn_0901_Communication_ports_001 { + + type port P message { + inout integer + } + + type component GeneralComp + { + port P p1, p2; + } + + type component General_System_Comp + { + port P p_system_1, p_system_2; + } + + testcase TC_NegSyn_0901_Communication_ports_001() runs on GeneralComp system General_System_Comp { + + connect(system:p_system_1, system:p_system_2); // error: p_system_1 and p_system_2 cannot be connected + + setverdict(pass); + } + + control{ + execute(TC_NegSyn_0901_Communication_ports_001()); + } +} +<END_MODULE> + +<RESULT COUNT 2> +error: The `system' component reference shall not be used in `connect' operation +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0902_Communication_ports_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the two system interf. port cannot connect > + +<COMPILE> + +<MODULE TTCN NegSem_0902_Communication_ports_003 NegSem_0902_Communication_ports_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:9, Ensure that the two system interf. port cannot connect + ** @verdict pass reject + ***************************************************/ + +//Two system interface ports are not allowed to connect +module NegSem_0902_Communication_ports_003{ + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + type component MyTestSystemInterface + { + port loopbackPort messagePortA,messagePortB + } + // MyTestSystemInterface is the test system interface + + testcase TC_NegSem_0902_Communication_ports_003() runs on MyTestSystemInterface { + // establishing the port connections + map(system:messagePortA, system:messagePortB); // not allowed + + setverdict(fail); + + } + control{ + execute(TC_NegSem_0902_Communication_ports_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Both endpoints of the mapping are system ports +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 10_constants folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Assign rnd to constant used in type, not allowed since constant expressions used in types have to be known at compile-time. > + +<COMPILE> + +<MODULE TTCN NegSem_10_Constants_001 NegSem_10_Constants_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:10, Assign rnd to constant used in type, not allowed since constant expressions used in types have to be known at compile-time. + ** @verdict pass reject + ***************************************************/ +module NegSem_10_Constants_001 { + + const float c_i := rnd(314E-2); // not allowed by standard + type float MyFloat (c_i); + + type component GeneralComp {} + + testcase TC_NegSem_10_Constants_001() runs on GeneralComp { + var MyFloat v_f := c_i; + log(v_f); + setverdict(pass); + } + + control{ + execute(TC_NegSem_10_Constants_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: An evaluatable constant value was expected instead of operation `rnd \(seed\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - A value is assigned only once to a constant. > + +<COMPILE> + +<MODULE TTCN NegSem_10_Constants_002 NegSem_10_Constants_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:10, A value is assigned only once to a constant + ** @verdict pass reject + ***************************************************/ +module NegSem_10_Constants_002 { + + const float c_i := 3.14; + + + type component GeneralComp {} + + testcase TC_NegSem_10_Constants_002() runs on GeneralComp { + c_i := 3.15; //error because value is assigned only once to the constant + } + + control{ + execute(TC_NegSem_10_Constants_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or template variable was expected instead of constant `@NegSem_10_Constants_002.c_i' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Constant shall not be of port type > + +<COMPILE> + +<MODULE TTCN NegSem_10_Constants_003 NegSem_10_Constants_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:10, Constant shall not be of port type + ** @verdict pass reject + ***************************************************/ +module NegSem_10_Constants_003 { + + //only for negSyn constant shall not be of port type + type port MyMessagePortType message + { + inout integer + } with {extension "internal"} + + + type component GeneralComp { + } + + testcase TC_NegSem_10_Constants_003() runs on GeneralComp { + const MyMessagePortType c_port:= 5;//error - constant shall not be of port type + }//end testcase + + control{ + execute(TC_NegSem_10_Constants_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Constant cannot be defined for port type `@NegSem_10_Constants_003.MyMessagePortType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 11_variables folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1101_ValueVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Variables should be assigned only by values > + +<COMPILE> + +<MODULE TTCN NegSem_1101_ValueVars_001 NegSem_1101_ValueVars_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:11.1, Variables should be assigned only by values + ** @verdict pass reject + ***************************************************/ +module NegSem_1101_ValueVars_001 { + type component GeneralComp {} + + testcase TC_NegSem_1101_ValueVars_001() runs on GeneralComp { + var integer v_i := ?; // ? is not a value + setverdict(pass); + } + + control { + execute(TC_NegSem_1101_ValueVars_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\?': syntax error, unexpected '\?' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1101_ValueVars_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that partially initialized variables are evaluated correctly. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1101_ValueVars_002 NegSem_1101_ValueVars_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:11.1, Ensure that partially initialized variables are evaluated correctly. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1101_ValueVars_002 { + + type component GeneralComp { + } + + type set IntegerSet { + integer a1 optional, + integer a2 optional, + integer a3 optional + }; + + testcase TC_NegSem_1101_ValueVars_002() runs on GeneralComp { + var IntegerSet v_set := {a1:=1,a2:=omit}; + + if ( v_set == {a1:=1,a2:=omit,a3:=3} ) { //attempted use of partially initialized variable + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1101_ValueVars_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The left operand of comparison is an unbound optional value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1101_ValueVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Define variables in module scope > + +<COMPILE> + +<MODULE TTCN NegSyn_1101_ValueVars_001 NegSyn_1101_ValueVars_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:11.1, Define variables in module scope + ** @verdict pass reject + ***************************************************/ +module NegSyn_1101_ValueVars_001 { + var integer v_i1 := 5; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `var': syntax error, unexpected VarKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1102_TemplateVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Template variables should be assigned with unitialized variables > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1102_TemplateVars_001 NegSem_1102_TemplateVars_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:11.2, Template variables should be assigned with unitialized variables + ** @verdict pass reject + ***************************************************/ +module NegSem_1102_TemplateVars_001 { + type component GeneralComp {} + + testcase TC_NegSem_1102_TemplateVars_001() runs on GeneralComp { + var template integer v_i1; + var template integer v_i2 := v_i1; // v_i1 is not initialized + + setverdict(pass); + } + + control { + execute(TC_NegSem_1102_TemplateVars_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1102_TemplateVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Define template variables in module scope > + +<COMPILE> + +<MODULE TTCN NegSyn_1102_TemplateVars_001 NegSyn_1102_TemplateVars_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:11.2, Define template variables in module scope + ** @verdict pass reject + ***************************************************/ +module NegSyn_1102_TemplateVars_001 { + var template integer v_i1 := 5; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `var': syntax error, unexpected VarKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 12_timers folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer can not be initialized with negative duration > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_001 NegSem_12_toplevel_timer_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer can not be initialized with negative duration + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer value is non-neg float + **/ + + +module NegSem_12_toplevel_timer_001 { + type component TComp{ + timer t_timer := -1.0; // not allowed + } + testcase TC_NegSem_12_toplevel_timer_001() runs on TComp{ + t_timer.start; + } + control{ + + execute(TC_NegSem_12_toplevel_timer_001()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative float value was expected as timer duration instead of `-1.0e0' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer in array can not be initialized with negative duration > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_002 NegSem_12_toplevel_timer_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer in array can not be initialized with negative duration + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer value is non-neg float + **/ + + +module NegSem_12_toplevel_timer_002 { + + type component TComp{ + timer t_timer[2] := {-1.0, 1.0}; + } + + testcase TC_NegSem_12_toplevel_timer_002() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-negative float value was expected as timer duration instead of `-1.0e0' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure uninitialized timer can't be started > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_003 NegSem_12_toplevel_timer_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure uninitialized timer can't be started + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSem_12_toplevel_timer_003 { + + type component TComp{ + timer t_timer; + } + + testcase TC_NegSem_12_toplevel_timer_003() runs on TComp{ + t_timer.start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Missing duration: timer `@NegSem_12_toplevel_timer_003.TComp.t_timer' does not have default duration +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure uninitialized timer in array can't be started > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_004 NegSem_12_toplevel_timer_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure uninitialized timer in array can't be started + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSem_12_toplevel_timer_004 { + type component TComp{ + timer t_timer[2] := {-, 1.0}; + } + + testcase TC_NegSem_12_toplevel_timer_004() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Missing duration: timer `@NegSem_12_toplevel_timer_004.TComp.t_timer' does not have default duration +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure uninitialized timer in array can't be started > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_005 NegSem_12_toplevel_timer_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure uninitialized timer in array can't be started + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSem_12_toplevel_timer_005 { + + type component TComp{ + timer t_timer[2]; + } + + testcase TC_NegSem_12_toplevel_timer_005() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Missing duration: timer `@NegSem_12_toplevel_timer_005.TComp.t_timer' does not have default duration +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax - reject single timer instance initialized with array > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_006 NegSem_12_toplevel_timer_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax - reject single timer instance initialized with array + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSem_12_toplevel_timer_006 { + + type component TComp{ + timer t_timer := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSem_12_toplevel_timer_006() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_006()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type float was expected +<END_RESULT> +<RESULT COUNT 1> +error: Reference to single timer `@NegSem_12_toplevel_timer_006.TComp.t_timer' cannot have field or array sub-references +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax -- reject array initialization with wrong number of initializers > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_007 NegSem_12_toplevel_timer_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax -- reject array initialization with wrong number of initializers + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSem_12_toplevel_timer_007 { + type component TComp{ + timer t_timer[4] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSem_12_toplevel_timer_007() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSem_12_toplevel_timer_007()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Too few elements in the default duration of timer array: 4 was expected instead of 3 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax -- reject array of timers initizlized with a single float value > + +<COMPILE> + +<MODULE TTCN NegSem_12_toplevel_timer_008 NegSem_12_toplevel_timer_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax -- reject array of timers initizlized with a single float value + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_008 { + + type component TComp{ + timer t_timer[4] := 1.0; + } + + testcase TC_NegSyn_12_toplevel_timer_008() runs on TComp{ + t_timer[0].start; + } + + control{ + execute(TC_NegSyn_12_toplevel_timer_008()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: An array value \(with 4 elements\) was expected as default duration of timer array +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer can`t be used in module control parts when declared in components > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_001 NegSyn_12_toplevel_timer_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer can`t be used in module control parts when declared in components + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timers can be declared in component and used in test cases, functions, altsteps on this component + **/ + + +module NegSyn_12_toplevel_timer_001 { + + type component TComp{ + timer t_timer:= 1.0; + } + + testcase TC_NegSyn_12_toplevel_timer_001(integer f) runs on TComp{ + if (f==0){ + setverdict(fail); + } + else{ + setverdict(pass); + } + } + + control{ + + t_timer.start; + if (t_timer.running){ + execute(TC_NegSyn_12_toplevel_timer_001(0)) + } + else{ + execute(TC_NegSyn_12_toplevel_timer_001(1)) + } + + } +} +<END_MODULE> + +<RESULT COUNT 2> +error: There is no local or imported definition with name `t_timer' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_002 NegSyn_12_toplevel_timer_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_002 { + + type component TComp{ + timer := 10.0; + } + + testcase TC_NegSyn_12_toplevel_timer_002() runs on TComp{ + + } + control{ + execute(TC_NegSyn_12_toplevel_timer_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `:=': syntax error, unexpected :=, expecting Identifier +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_003 NegSyn_12_toplevel_timer_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_003 { + + type component TComp{ + timer t_timer :=; + } + + testcase TC_NegSyn_12_toplevel_timer_003() runs on TComp{ + + } + control{ + execute(TC_NegSyn_12_toplevel_timer_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `;': syntax error, unexpected ';' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_004 NegSyn_12_toplevel_timer_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:04, Ensure timer declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_04_toplevel_timer_004 { + + type component TComp{ + timer t_timer 0.0; + } + + testcase TC_NegSyn_04_toplevel_timer_004() runs on TComp{ + + } + + control{ + execute(TC_NegSyn_04_toplevel_timer_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `0.0': syntax error, unexpected FloatValue +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_005 NegSyn_12_toplevel_timer_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_005 { + + type component TComp{ + timer t_timer := 1; + } + + testcase TC_NegSyn_12_toplevel_timer_005() runs on TComp{ + + } + + control{ + execute(TC_NegSyn_12_toplevel_timer_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type float was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer array declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_006 NegSyn_12_toplevel_timer_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer array declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_006 { + + type component TComp{ + timer t_timer[5] := 1.0, 1.0, 1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_12_toplevel_timer_006() runs on TComp{ + + } + + control{ + execute(TC_NegSyn_12_toplevel_timer_006()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `1.0': syntax error, unexpected FloatValue, expecting Identifier +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer array declaration syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_12_toplevel_timer_007 NegSyn_12_toplevel_timer_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:12, Ensure timer array declaration syntax + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/12 Declaring timers/Timer declaration syntax + **/ + + +module NegSyn_12_toplevel_timer_007 { + + type component TComp{ + timer t_timer[5] := {1.0 1.0, 1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_12_toplevel_timer_007() runs on TComp{ + + } + + control{ + execute(TC_NegSyn_12_toplevel_timer_007()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `1.0': syntax error, unexpected FloatValue, expecting '\}' or ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 14_procedure_signatures folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. egSem_1400_procedure_signatures_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that nonblocking signature contains in parameter > + +<COMPILE> + +<MODULE TTCN egSem_1400_procedure_signatures_001 egSem_1400_procedure_signatures_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.1, Ensure that nonblocking signature contains in parameter + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1400_procedure_signatures_001 { + + signature p_procedure_signatures_001(out integer p_par1) noblock; // noblock keyword, shall only have in parameters + + template p_procedure_signatures_001 s_returnTemplate := { + p_par1 := - } + + type port remotePort procedure { + inout p_procedure_signatures_001; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + function f_ClientQuery() runs on GeneralComp { } + + testcase TC_NegSem_1400_procedure_signatures_001() runs on GeneralComp system GeneralComp { + var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); + var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); + + // map the PTCs to the system port + connect(server:PCO, client:PCO); + + + client.start(f_ClientQuery()); + + alt { + [] client.done { + server.stop; + } + } + + alt { + [] all component.done {} + } + + disconnect(server:PCO, client:PCO); + } + + control{ + execute(TC_NegSem_1400_procedure_signatures_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A non-blocking signature cannot have `out' parameter +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. egSem_1400_procedure_signatures_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that blocking calls needs response or exception handling > + +<COMPILE> + +<MODULE TTCN egSem_1400_procedure_signatures_002 egSem_1400_procedure_signatures_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:14, Ensure that blocking calls needs response or exception handling + ** @verdict pass reject + *****************************************************************/ +// Multiple calls requires response or exception handling if the signature is blocking + +module NegSem_1400_procedure_signatures_002 { + + signature p_Sig1_001( in charstring key ); // noblock needed for multiple calls without response or exections + + type port remotePort procedure { + inout p_Sig1_001; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + var integer MyComp; + } + + + function f_Server() runs on GeneralComp { + timer t_guard; + + const charstring key[3] := {"My String1", "hello", "Probe string"}; + + t_guard.start( 5.0 ); + + for ( var integer i := 0; i < 3; i := i + 1 ) { + PCO.call( p_Sig1_001:{key[i]});} + setverdict(pass); + + t_guard.timeout; + setverdict(fail); + } + + function f_client() runs on GeneralComp { + + } + + testcase TC_NegSem_1400_procedure_signatures_002() runs on GeneralComp system GeneralComp { + + var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); + var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); + + + connect(server:PCO, client:PCO); + + server.start(f_Server()); + client.start(f_client()); + + alt { + [] client.done { + server.stop; + } + } + + alt { + [] all component.done {} + } + + disconnect(server:PCO, client:PCO); + } + + control{ + execute(TC_NegSem_1400_procedure_signatures_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Response and exception handling part is missing from blocking call operation +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/08_empty_modules.script b/conformance_test/negative_tests/08_empty_modules.script new file mode 100644 index 0000000000000000000000000000000000000000..fb0a096652f7ddc15969579b8f708f6e782b6cfc --- /dev/null +++ b/conformance_test/negative_tests/08_empty_modules.script @@ -0,0 +1,288 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains syntactic tests with empty modules from ETSI TTCN3 Conformance Test's 08_modules folders. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 0801_definition_of_a_module folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a "plain" module definition is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_001 Syn_0801_DefinitionOfAModule_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a "plain" module definition is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_001 { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with language specification is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_002 Syn_0801_DefinitionOfAModule_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with language specification is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_002 language "TTCN-3:2005" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with package and without language is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_004 Syn_0801_DefinitionOfAModule_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with package and without language is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_004 language "TTCN-3:2010 Advanced Parameterization" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with ed4.3.1 language and package is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_005 Syn_0801_DefinitionOfAModule_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with ed4.3.1 language and package is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_005 language "TTCN-3:2011" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with ed4.4.1 language and package is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_006 Syn_0801_DefinitionOfAModule_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with ed4.4.1 language and package is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_006 language "TTCN-3:2012" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with ed4.5.1 language and package is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_007 Syn_0801_DefinitionOfAModule_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with ed4.5.1 language and package is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_007 language "TTCN-3:2013" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with ed4.6.1 language and package is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_008 Syn_0801_DefinitionOfAModule_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with ed4.6.1 language and package is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_008 language "TTCN-3:2014" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a module definition with ed4.7.1 language and package is accepted. > + +<COMPILE> + +<MODULE TTCN Syn_0801_DefinitionOfAModule_009 Syn_0801_DefinitionOfAModule_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:8.1, Ensure that a module definition with ed4.7.1 language and package is accepted. + ** @verdict pass accept, noexecution + *****************************************************************/ + +module Syn_0801_DefinitionOfAModule_009 language "TTCN-3:2015" { + +} +<END_MODULE> + +<RESULT IF_PASS NEGATIVE> +error +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/15_templates.script b/conformance_test/negative_tests/15_templates.script new file mode 100644 index 0000000000000000000000000000000000000000..7c70914a023471bf95a5b89f319d3580d6f710c5 --- /dev/null +++ b/conformance_test/negative_tests/15_templates.script @@ -0,0 +1,3854 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 15_templates folder. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 1503_global_and_local_templates folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error for re-assignment of a global non-parameterized template > + +<COMPILE> + +<MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_001 NegSem_1503_GlobalAndLocalTemplates_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global non-parameterized template + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSem_1503_GlobalAndLocalTemplates_001 +{ + template integer t := ?; + type component GeneralComp { + } + + testcase TC_NegSem_1503_GlobalAndLocalTemplates_001() runs on GeneralComp { + t := 2; // error expected + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_001.t' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error for re-assignment of a global non-parameterized template > + +<COMPILE> + +<MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_002 NegSem_1503_GlobalAndLocalTemplates_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global non-parameterized template + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSem_1503_GlobalAndLocalTemplates_002 +{ + type component GeneralComp { + } + + testcase TC_NegSem_1503_GlobalAndLocalTemplates_002() runs on GeneralComp { + template integer t := ?; + t := 2; // error expected + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or template variable was expected instead of template `t' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error for re-assignment of a global parameterized template > + +<COMPILE> + +<MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_003 NegSem_1503_GlobalAndLocalTemplates_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a global parameterized template + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSem_1503_GlobalAndLocalTemplates_003 +{ + template integer t(in integer p) := (0..p); + type component GeneralComp { + } + testcase TC_NegSem_1503_GlobalAndLocalTemplates_003() runs on GeneralComp { + t := 2; // error expected + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_003.t' +<END_RESULT> +<RESULT COUNT 1> +error: Reference to parameterized definition `t' without actual parameter list +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error for re-assignment of a local parameterized template > + +<COMPILE> + +<MODULE TTCN NegSem_1503_GlobalAndLocalTemplates_004 NegSem_1503_GlobalAndLocalTemplates_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error for re-assignment of a local parameterized template + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSem_1503_GlobalAndLocalTemplates_004 +{ + type component GeneralComp { + } + testcase TC_NegSem_1503_GlobalAndLocalTemplates_004() runs on GeneralComp { + template integer t(in integer p) := (0..p); + t := 2; // error expected + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a variable or template variable was expected instead of template `t' +<END_RESULT> +<RESULT COUNT 1> +error: Reference to parameterized definition `t' without actual parameter list +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error if no value is assigned in a global non-parameterized template declaration > + +<COMPILE> + +<MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_001 NegSyn_1503_GlobalAndLocalTemplates_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a global non-parameterized template declaration + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSyn_1503_GlobalAndLocalTemplates_001 +{ + template integer t; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error if no value is assigned in a local non-parameterized template declaration > + +<COMPILE> + +<MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_002 NegSyn_1503_GlobalAndLocalTemplates_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a local non-parameterized template declaration + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSyn_1503_GlobalAndLocalTemplates_002 +{ + type component GeneralComp { + } + testcase TC_NegSyn_1503_GlobalAndLocalTemplates_002() runs on GeneralComp { + template integer t; + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error if no value is assigned in a global parameterized template declaration > + +<COMPILE> + +<MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_003 NegSyn_1503_GlobalAndLocalTemplates_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a global parameterized template declaration + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSyn_1503_GlobalAndLocalTemplates_003 +{ + template integer t(in integer p); +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `;': syntax error, unexpected ';', expecting := +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that there's an error if no value is assigned in a local parameterized template declaration > + +<COMPILE> + +<MODULE TTCN NegSyn_1503_GlobalAndLocalTemplates_004 NegSyn_1503_GlobalAndLocalTemplates_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.3, Ensure that there's an error if no value is assigned in a local parameterized template declaration + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Both global and local templates are initialized at the place of their +// declaration. This means, all template fields which are not affected by +// parameterization shall receive a value or matching mechanism. Template +// fields affected by parameterization are initialized at the time of +// template use. +module NegSyn_1503_GlobalAndLocalTemplates_004 +{ + type component GeneralComp { + } + testcase TC_NegSyn_1503_GlobalAndLocalTemplates_004() runs on GeneralComp { + template integer t(in integer p); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `;': syntax error, unexpected ';', expecting := +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1505_modified_templates folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a modified template does not refer to itself. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_001 NegSem_1505_ModifiedTemplates_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that a modified template does not refer to itself. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_001 { + + type record of integer MyMessageType; + + template MyMessageType m_myBaseTemplate := { 0, 1, 2, 3, 4 }; + + template MyMessageType m_myOtherTemplate modifies m_myOtherTemplate := { + [2]:=3, // switch the positions of 2 and 3 + [3]:=2 + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: While checking the chain of base templates: Circular reference: `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' -> `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a modified template does not omit possible parameters of the base > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_002 NegSem_1505_ModifiedTemplates_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that a modified template does not omit possible parameters of the base template. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_002 { + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_value) := { + field1 := p_value, + field2 := "Hello World", + field3 := true + } + + // illegal definition as the (integer p_value) formal parameter is missing and must + // not be omitted. + template MyMessageType m_templateTwo modifies m_templateOne := { + field3 := false + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The modified template has fewer formal parameters than base template `@NegSem_1505_ModifiedTemplates_002.m_templateOne': at least 1 parameter was expected instead of 0 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a modified template does not omit possible parameters introduced in any modification step. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_003 NegSem_1505_ModifiedTemplates_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that a modified template does not omit possible parameters introduced in any modification step. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_003 { + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_intValue) := { + field1 := p_intValue, + field2 := "Hello World", + field3 := true + } + + template MyMessageType m_templateTwo(integer p_intValue, boolean p_boolValue) modifies m_templateOne := { + field1 := p_intValue, + field3 := p_boolValue + } + + // illegal as it is missing the (boolean p_boolValue) formal parameter introduced in the previous + // modification step. + template MyMessageType m_templateThree(integer p_intValue) modifies m_templateTwo := { + field2 := "foobar" + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The modified template has fewer formal parameters than base template `@NegSem_1505_ModifiedTemplates_003.m_templateTwo': at least 2 parameters were expected instead of 1 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that parameter names in modified templates are the same. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_004 NegSem_1505_ModifiedTemplates_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that parameter names in modified templates are the same. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_004 { + + type component GeneralComp { } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_value) := { + field1 := p_value, + field2 := "Hello World", + field3 := true + } + + // illegal as p_intValue is a different parameter name than p_value + template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateOne := { + field3 := false + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The name of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_004.m_templateOne': `p_value' was expected instead of `p_intValue' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the dash in default parameter values of a modified templates is only accepted when the base template actually has a default value. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_005 NegSem_1505_ModifiedTemplates_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that the dash in default parameter values of a modified templates is only accepted when the base template actually has a default value. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_005 { + + type component GeneralComp { } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_intValue) := { + field1 := p_intValue, + field2 := "Hello World", + field3 := true + } + + // illegal as p_intValue does not have a default value that can be referred to with the "-". + template MyMessageType m_templateTwo(integer p_intValue := -) modifies m_templateOne := { + field1 := p_intValue + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template +<END_RESULT> +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the same parameter name is used when modifying the base template. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_006 NegSem_1505_ModifiedTemplates_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that the same parameter name is used when modifying the base template. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_006 { + + type component GeneralComp { } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_intValue) := { + field1 := p_intValue, + field2 := "Hello World", + field3 := true + } + + // illegal as parameter name mismatch p_intValue defined in m_templateOne + template MyMessageType m_templateTwo(integer p_value := -) modifies m_templateOne := { + field1 := p_value + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The name of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_006.m_templateOne': `p_intValue' was expected instead of `p_value' +<END_RESULT> +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> +<RESULT COUNT 1> +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the same parameter type is used when modifying the base template. > + +<COMPILE> + +<MODULE TTCN NegSem_1505_ModifiedTemplates_007 NegSem_1505_ModifiedTemplates_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that the same parameter type is used when modifying the base template. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1505_ModifiedTemplates_007 { + + type component GeneralComp { } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_intValue) := { + field1 := p_intValue, + field2 := "Hello World", + field3 := true + } + + // illegal as parameter type mismatch boolean defined in m_templateOne + template MyMessageType m_templateTwo(boolean p_intValue) modifies m_templateOne := { + field1 := 5 + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of parameter is not the same as in base template `@NegSem_1505_ModifiedTemplates_007.m_templateOne': `integer' was expected instead of `boolean +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1505_ModifiedTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the base template and modified template cannot be the same > + +<COMPILE> + +<MODULE TTCN NegSyn_1505_ModifiedTemplates_001 NegSyn_1505_ModifiedTemplates_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.5, Ensure that the base template and modified template cannot be the same + ** @verdict pass reject, noexecution + *****************************************************************/ +//Restriction a) +/*A modified template shall not refer to itself, either directly or indirectly, i.e. recursive derivation is not +allowed.*/ + +module NegSyn_1505_ModifiedTemplates_001{ + + type component GeneralComp { } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + template MyMessageType m_templateOne(integer p_intValue) := { + field1 := p_intValue, + field2 := "Hello World", + field3 := true + } + + template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateOne := { + field1 := 5 + } + + //error: not allowed to modify itself + template MyMessageType m_templateTwo(integer p_intValue) modifies m_templateTwo := { + field1 := 10 + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Duplicate definition with name `m_templateTwo' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1506_referencing_elements_of_templates_or_template_fields folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_150601_ReferencingIndividualStringElements_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the referencing of individual string elements inside templates or template fields is forbidden. > + +<COMPILE> + +<MODULE TTCN NegSem_150601_ReferencingIndividualStringElements_001 NegSem_150601_ReferencingIndividualStringElements_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.1, Ensure that the referencing of individual string elements inside templates or template fields is forbidden. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150601_ReferencingIndividualStringElements_001 { + + type component GeneralComp { } + + testcase TC_NegSem_150601_ReferencingIndividualStringElements_001() runs on GeneralComp { + var template charstring m_char1 := "MYCHAR1"; + var template charstring m_char2; + + // illegal acchess. Instead, substr should be used. + m_char2 := m_char1[1]; + + if (valueof(m_char2) == "Y") { + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_150601_ReferencingIndividualStringElements_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to template variable `m_char1' can not be indexed +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that fields with omit values on the right-hand side of an assignment are rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_001 NegSem_150602_ReferencingRecordAndSetFields_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.2, Ensure that fields with omit values on the right-hand side of an assignment are rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150602_ReferencingRecordAndSetFields_001 { + + type component GeneralComp { } + + type record MyRecordTwo { + integer g1, + MyRecordTwo g2 optional + } + + type record MyRecordOne { + integer f1 optional, + MyRecordTwo f2 optional + } + + testcase TC_NegSem_150602_ReferencingRecordAndSetFields_001() runs on GeneralComp { + var template MyRecordOne m_R1 := { + f1 := 5, + f2 := omit + } + + // shall cause an error as omit is assigned to m_R1.f2 + var template MyRecordTwo m_R2 := m_R1.f2.g2; + // if we get here, something must be wrong + setverdict(fail); + } + + control{ + execute(TC_NegSem_150602_ReferencingRecordAndSetFields_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_001.MyRecordTwo. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that fields with omit values on the right-hand side of an assignment are rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_003 NegSem_150602_ReferencingRecordAndSetFields_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.2, Ensure that value lists on the right-hand side of an assignment are not acceped. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150602_ReferencingRecordAndSetFields_003 { + + type component GeneralComp { } + + type record MyRecordTwo { + integer g1, + MyRecordTwo g2 optional + } + + type record MyRecordOne { + integer f1 optional, + MyRecordTwo f2 optional + } + + testcase TC_NegSem_150602_ReferencingRecordAndSetFields_003() runs on GeneralComp { + var template MyRecordOne m_R1 := ( + { + f1 := omit, + f2 := + { + g1 := 0, + g2 := omit + } + }, + { + f1 := 5, + f2 := + { + g1 := 1, + g2 := + { + g1 := 2, + g2 := omit + } + } + } + ); + + // shall cause an error as value list is assigned to m_R1 + var template MyRecordTwo m_R2 := m_R1.f2; + m_R2 := m_R1.f2.g2; + m_R2 := m_R1.f2.g2.g2; + // if we get here, something must be wrong + setverdict(fail); + } + + control{ + execute(TC_NegSem_150602_ReferencingRecordAndSetFields_003()); + } + + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_003.MyRecordTwo. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that complement lists on the right-hand side of an assignment are not acceped. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_004 NegSem_150602_ReferencingRecordAndSetFields_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.2, Ensure that complement lists on the right-hand side of an assignment are not acceped. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150602_ReferencingRecordAndSetFields_004 { + + type component GeneralComp { } + + type record MyRecordTwo { + integer g1, + MyRecordTwo g2 optional + } + + type record MyRecordOne { + integer f1 optional, + MyRecordTwo f2 optional + } + + testcase TC_NegSem_150602_ReferencingRecordAndSetFields_004() runs on GeneralComp { + var template MyRecordOne m_R1 := complement( + { + f1 := omit, + f2 := + { + g1 := 0, + g2 := omit + } + }, + { + f1 := 5, + f2 := + { + g1 := 1, + g2 := + { + g1 := 2, + g2 := omit + } + } + } + ); + + // shall cause an error as a complement list is assigned to m_R1 + var template MyRecordTwo m_R2 := m_R1.f2; + m_R2 := m_R1.f2.g2; + m_R2 := m_R1.f2.g2.g2; + // if we get here, something must be wrong + setverdict(fail); + } + + control{ + execute(TC_NegSem_150602_ReferencingRecordAndSetFields_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_004.MyRecordTwo. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing a template field with the ifpresent attribute causes a rejection. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_005 NegSem_150602_ReferencingRecordAndSetFields_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.2, Ensure that referencing a template field with the ifpresent attribute causes a rejection. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150602_ReferencingRecordAndSetFields_005 { + + type component GeneralComp { } + + type record MyRecordOne { + MyRecordOne f1 optional + } + + testcase TC_NegSem_150602_ReferencingRecordAndSetFields_005() runs on GeneralComp { + var template MyRecordOne m_R1 := { + f1 := * ifpresent + } + var template MyRecordOne m_R2 := { + f1 := m_R1.f1.f1 // access to a field with ifpresent shall cause an error! + } + setverdict(fail); + } + + control{ + execute(TC_NegSem_150602_ReferencingRecordAndSetFields_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Accessing field f1 of a non-specific template of type @NegSem_150602_ReferencingRecordAndSetFields_005.MyRecordOne. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing a field of an address type, which actual value is null shall cause rejection. > + +<COMPILE> + +<MODULE TTCN NegSem_150602_ReferencingRecordAndSetFields_006 NegSem_150602_ReferencingRecordAndSetFields_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.2, Ensure that referencing a field of an address type, which actual value is null shall cause rejection. + ** @verdict pass reject + *****************************************************************/ + +//Restriction d) +/*Special value null: referencing a field of an address type, which actual value is null shall cause an error.*/ + +module NegSem_150602_ReferencingRecordAndSetFields_006 { + + type component GeneralComp { } + + type integer address; + + type record MyRecordOne { + address f1 + } + + testcase TC_NegSem_150602_ReferencingRecordAndSetFields_006() runs on GeneralComp { + var template MyRecordOne m_R1 := { + f1 := null + } + var template MyRecordOne m_R2 := { + f1 := m_R1.f1 // access to a field with null shall cause an error! + } + setverdict(pass); + } + + control{ + execute(TC_NegSem_150602_ReferencingRecordAndSetFields_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing an element within a value list causes an error in the context of record of. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_001 NegSem_150603_ReferencingRecordOfAndSetElements_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing an element within a value list causes an error in the context of record of. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_001 { + + type component GeneralComp { } + + type record of integer RoI; + type record of RoI RoRoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_001() runs on GeneralComp { + var template RoI m_one; + var template RoRoI m_two; + template RoRoI constraint_value := {{},{0},{0,0},{0,0,0}}; + + m_two := ( constraint_value, constraint_value ); // value list + m_one := m_two[0]; // shall cause an error as we access a value list + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_001.RoRoI. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that access to unitialized fields in the context of record of is rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_002 NegSem_150603_ReferencingRecordOfAndSetElements_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that access to unitialized fields in the context of record of is rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_002 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_002() runs on GeneralComp { + var template RoI m_one; + var integer v_test; + + m_one[0] := 0; + m_one[2] := 1; + v_test := valueof(m_one[1]); // shall cause an error as element one is an unitialized field + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that anyvalueornone fields in the context of record of is rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_003 NegSem_150603_ReferencingRecordOfAndSetElements_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that anyvalueornone fields in the context of record of is rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_003 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_003() runs on GeneralComp { + var template RoI m_one; + var integer v_test; + + m_one := {0,*,1,2}; + v_test := valueof(m_one[1]); // shall cause an error as element one is an "any value or none" field + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that complement value lists in the context of record of are rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_004 NegSem_150603_ReferencingRecordOfAndSetElements_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that complement value lists in the context of record of are rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_004 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_004() runs on GeneralComp { + var template RoI m_one; + var integer v_test; + + m_one := {0,complement(1,3,5),1,2}; + v_test := valueof(m_one[1]); // shall cause an error as element one is a complement list + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that subset in the context of record of are rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_005 NegSem_150603_ReferencingRecordOfAndSetElements_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that subset in the context of record of are rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_005 { + + type component GeneralComp { } + + //type record of integer RoI; + + type set of integer SoI; + type record of SoI RoS; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_005() runs on GeneralComp { + //var template RoI m_one; + var template RoS m_one; + + //var integer v_test; + var SoI v_test; + + //m_one := {0,subset(1,3,5),1,2}; + m_one := {{0},subset(1,3,5), {1,2}}; + + v_test := valueof(m_one[1]); // shall cause an error as element one is a subset + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that superset in the context of record of are rejected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_006 NegSem_150603_ReferencingRecordOfAndSetElements_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that superset in the context of record of are rejected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_006 { + + type component GeneralComp { } + + //type record of integer RoI; + type set of integer SoI; + type record of SoI RoS; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_006() runs on GeneralComp { + //var template RoI m_one; + var template RoS m_one; + + //var integer v_test; + var SoI v_test; + + //m_one := {0,superset(1,3,5),1,2}; + m_one := {{0},subset(1,3,5), {1,2}}; + v_test := valueof(m_one[1]); // shall cause an error as element one is a superset + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that access to record of indexes is forbidden when a previous index entry is a permutation with a *. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_008 NegSem_150603_ReferencingRecordOfAndSetElements_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that access to record of indexes is forbidden when a previous index entry is a permutation with a *. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_008 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_008() runs on GeneralComp { + var template RoI m_one; + var integer v_test; + + m_one := {permutation(0,1,3,*),2,?}; + v_test := valueof(m_one[5]); // shall cause an error as the permutation contains a * that is able to cover any record of indexes + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_008()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that access to ifpresent fields is not allowed. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_009 NegSem_150603_ReferencingRecordOfAndSetElements_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that access to ifpresent fields is not allowed. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_009 { + + type component GeneralComp { } + + template integer If := 1 ifpresent; // simple integer can't have ifpresent attribute + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_009() runs on GeneralComp { + var template RoI m_one; + var integer v_test; + + m_one := {If,2,?}; + v_test := valueof(m_one[0]); // shall cause an error due to the presence of ifpresent + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_009()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing AnyValueOrNone fields is not allowed. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_010 NegSem_150603_ReferencingRecordOfAndSetElements_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing AnyValueOrNone fields is not allowed. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_010 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_010() runs on GeneralComp { + var template RoI m_one; + + m_one := ?; + m_one[2] := 2; + // assignment should yield {?,?,2,*} + + if (not match(5,m_one[0])) { + setverdict(fail); + } + if (not match(5,m_one[1])) { + setverdict(fail); + } + if (not match(2,m_one[2])) { + setverdict(fail); + } + if (not match(5,m_one[3])) { // shall cause an error due to the presence of AnyValueOrNone + setverdict(fail); + } + setverdict(pass); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_010()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Matching with an uninitialized/unsupported integer template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing uninitialized fields is not allowed. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_011 NegSem_150603_ReferencingRecordOfAndSetElements_011.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. + ** @verdict pass reject + *****************************************************************/ + + //Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. + + /*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this +shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set +of field or value on the right hand side of an assignment shall cause an error.*/ + + +module NegSem_150603_ReferencingRecordOfAndSetElements_011 { + + type component GeneralComp { } + + type record of integer RoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_011() runs on GeneralComp { + + var template RoI m_one; + var template RoI m_two; + + m_one := {1,-}; // {1,-} + m_two := {m_one[1],4}; // {-,4} error not allowed referencing + + if (not isvalue(m_two)) { + setverdict(pass); + } + + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_011()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing uninitialized fields is not allowed. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_012 NegSem_150603_ReferencingRecordOfAndSetElements_012.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. + ** @verdict pass reject + *****************************************************************/ + +//Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. + +/*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this +shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set +of field or value on the right hand side of an assignment shall cause an error.*/ + + +module NegSem_150603_ReferencingRecordOfAndSetElements_012{ + + type component GeneralComp { } + + type set of integer SoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_012() runs on GeneralComp { + + var template SoI m_one; + var template SoI m_two; + + m_one := {1,-}; // {1,-} + m_two := {m_one[1],2}; // {-,2} error not allowed referencing + + if (not isvalue(m_two)) { + setverdict(pass); + } + + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_012()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Copying an uninitialized/unsupported integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing uninitialized fields is not allowed. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_013 NegSem_150603_ReferencingRecordOfAndSetElements_013.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing uninitialized fields is not allowed. + ** @verdict pass reject + *****************************************************************/ + +//Restriction a) Omit: referencing an element within a record of, set of or array field to which omit is assigned shall follow the rules specified in clause 6.2.3. + +/*Clause 6.2.3: If the value of the element indicated by the index at the right-hand of an assignment is undefined (uninitialized), this +shall cause a semantic or runtime error. Referencing an identified element of an uninitialized or omitted record of or set +of field or value on the right hand side of an assignment shall cause an error.*/ + + +module NegSem_150603_ReferencingRecordOfAndSetElements_013{ + + type component GeneralComp { } + + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_013() runs on GeneralComp { + + var integer m_one[2]; + var integer m_two[2]; + + m_one := {1,-}; // {1,-} + m_two := {m_one[1],2}; // {-,2} error not allowed referencing + + if (not isvalue(m_two)) { + setverdict(pass); + } + + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_013()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Assignment of an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing an element within a value list causes an error in the context of set of. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_014 NegSem_150603_ReferencingRecordOfAndSetElements_014.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing an element within a value list causes an error in the context of set of. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_014 { + + type component GeneralComp { } + + type set of integer SoI; + type set of SoI SoSoI; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_014() runs on GeneralComp { + var template SoI m_one; + var template SoSoI m_two; + template SoSoI constraint_value := {{},{0},{0,0},{0,0,0}}; + + m_two := ( constraint_value, constraint_value ); // value list + m_one := m_two[0]; // shall cause an error as we access a value list + + setverdict(fail); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_014()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_014.SoSoI. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that referencing an element of an address type, which actual value is null shall cause an error. > + +<COMPILE> + +<MODULE TTCN NegSem_150603_ReferencingRecordOfAndSetElements_015 NegSem_150603_ReferencingRecordOfAndSetElements_015.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.3, Ensure that referencing an element of an address type, which actual value is null shall cause an error. + ** @verdict pass reject + *****************************************************************/ + + //Restriction h) +/*Special value null: referencing an element of an address type, which actual value is null shall cause an error.*/ + +module NegSem_150603_ReferencingRecordOfAndSetElements_015 { + + type component GeneralComp { } + + type set of integer RoI; + type integer address; + + testcase TC_NegSem_150603_ReferencingRecordOfAndSetElements_015() runs on GeneralComp { + var address v_add := null; + var template RoI m_one; + + + m_one := {v_add, 1}; // // shall cause an error as we access a value list + + setverdict(pass); + } + + control{ + execute(TC_NegSem_150603_ReferencingRecordOfAndSetElements_015()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150605_Referencing_union_alternatives_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template variables does not allow referencing alternatives inside an union with omit > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150605_Referencing_union_alternatives_001 NegSem_150605_Referencing_union_alternatives_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.5, Ensure that template variables does not allow referencing alternatives inside an union with omit + ** @verdict pass reject + *****************************************************************/ + + //Restriction a) + /*referencing an alternative of a union template or template field to which Omit, AnyValueOrNone, + * a template list or a complemented list is assigned, at the right hand side of an assignment, shall cause an error.*/ + + + +module NegSem_150605_Referencing_union_alternatives_001 { + + type union My_Union { + integer u1, + float u2 + } + + type record ExampleType { // Exampletype record with union + integer a, + My_Union b optional + } + + + type component GeneralComp { } + + + testcase TC_NegSem_150605_Referencing_union_alternatives_001() runs on GeneralComp { + + var template ExampleType m_template; + var template integer m_template_2; + + //assign values to template: + + m_template.a:=10; + m_template.b:= omit; + + m_template_2 := m_template.b.u1; //error: omit + + setverdict(pass); + + } + + control{ + execute(TC_NegSem_150605_Referencing_union_alternatives_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_001.My_Union +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150605_Referencing_union_alternatives_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template variables does not allow referencing alternatives inside an union with AnyValueOrNone > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_150605_Referencing_union_alternatives_002 NegSem_150605_Referencing_union_alternatives_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.6.5, Ensure that template variables does not allow referencing alternatives inside an union with AnyValueOrNone + ** @verdict pass reject + *****************************************************************/ +//Restriction a) +/*referencing an alternative of a union template +or template field to which Omit, AnyValueOrNone, a template list or a complemented list is assigned, at the right hand side of an assignment, shall cause an error.*/ + + +module NegSem_150605_Referencing_union_alternatives_002 { + + type union My_Union { + integer u1, + float u2 + } + + type record ExampleType { // Exampletype record with union + integer a, + My_Union b optional + } + + type component GeneralComp { } + + + testcase TC_NegSem_150605_Referencing_union_alternatives_002() runs on GeneralComp { + + var template ExampleType m_template; + var template integer m_template_2; + + //assign values to template: + + m_template.a:=10; + m_template.b:= *; + + m_template_2 := m_template.b.u1; //error: AnyValueOrNone + + setverdict(pass); + + } + + control{ + execute(TC_NegSem_150605_Referencing_union_alternatives_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_002.My_Union. +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1508_template_restrictions folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with anyvalue(?). > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_001 NegSem_1508_TemplateRestrictions_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyvalue(?). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_001 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := ?; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with setof template. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_002 NegSem_1508_TemplateRestrictions_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with setof template. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_002 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := ({1,true},{2,false}); + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of value list match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with anyvalueornone(*). > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_003 NegSem_1508_TemplateRestrictions_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyvalueornone(*). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_003 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := *; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with value ranges. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_004 NegSem_1508_TemplateRestrictions_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with value ranges. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_004 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := {(1..6), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of value range match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with supersets. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_005 NegSem_1508_TemplateRestrictions_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with supersets. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_005 { + + type record ExampleType { + set of integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := {superset(1,2,3), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of superset match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with supersets. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_006 NegSem_1508_TemplateRestrictions_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with subsets. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_006 { + + type record ExampleType { + set of integer a, + boolean b optional + } + + template(omit) ExampleType exampleOmitAny := {subset(1,2,3), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of subset match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with patterns. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_007 NegSem_1508_TemplateRestrictions_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with patterns. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_007 { + + type record ExampleType { + integer a, + charstring b + } + + template(omit) ExampleType exampleOmitAny := {1, pattern "ab*c"}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of character string pattern +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with anyelement inside values. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_008 NegSem_1508_TemplateRestrictions_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyelement inside values. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_008 { + + type record ExampleType { + integer a, + charstring b + } + + template(omit) ExampleType exampleOmitAny := {2, ?}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with anyelementornone inside values. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_009 NegSem_1508_TemplateRestrictions_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with anyelementornone inside values. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_009 { + + type record ExampleType { + integer a, + charstring b + } + + template(omit) ExampleType exampleOmitAny := {2, *}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with permutation inside values. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_010 NegSem_1508_TemplateRestrictions_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with permutation inside values. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_010 { + + type record ExampleType { + set of integer a, + charstring b + } + + template(omit) ExampleType exampleOmitAny := {permutation(2,4,6),"abcde"}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of permutation match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_011 NegSem_1508_TemplateRestrictions_011.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_011 { + + type record ExampleType { + charstring b + } + + template(omit) ExampleType exampleOmitAny := {"abcde" length(1..3)}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of length restriction +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_012 NegSem_1508_TemplateRestrictions_012.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_012 { + + type record ExampleType { + charstring b + } + + template(omit) ExampleType exampleOmitAny := {"abcde" ifpresent}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of `ifpresent' +<END_RESULT> +<RESULT COUNT 1> +error: `ifpresent' is not allowed here +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_013 NegSem_1508_TemplateRestrictions_013.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) is rejected with length restrictions. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_013 { + + type record ExampleType { + integer f1 + } + + template(omit) ExampleType exampleOmitAny := {complement(2,3)}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of complemented list match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with anyvalue(?). > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_014 NegSem_1508_TemplateRestrictions_014.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with anyvalue(?). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_014 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := ?; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with valuelist. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_015 NegSem_1508_TemplateRestrictions_015.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with valuelist. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_015 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := ({1,true},{2,false}); + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of value list match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with anyvalueornone(*). > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_016 NegSem_1508_TemplateRestrictions_016.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with anyvalueornone(*). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_016 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := *; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with value ranges. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_017 NegSem_1508_TemplateRestrictions_017.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with value ranges. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_017 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := {(1..6), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of value range match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with supersets. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_018 NegSem_1508_TemplateRestrictions_018.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with supersets. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_018 { + + type record ExampleType { + set of integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := {superset(1,2,3), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of superset match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with supersets. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_019 NegSem_1508_TemplateRestrictions_019.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with supersets. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_019 { + + type record ExampleType { + set of integer a, + boolean b optional + } + + template(value) ExampleType exampleOmitAny := {subset(1,2,3), true}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of subset match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with patterns. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_020 NegSem_1508_TemplateRestrictions_020.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with patterns. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_020 { + + type record ExampleType { + integer a, + charstring b + } + + template(value) ExampleType exampleOmitAny := {1, pattern "ab*c"}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of character string pattern +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with anyelement inside values. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_021 NegSem_1508_TemplateRestrictions_021.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with anyelement inside values. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_021 { + + type record ExampleType { + integer a, + charstring b + } + + template(value) ExampleType exampleOmitAny := {2, ?}; + + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with permutation inside values. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_022 NegSem_1508_TemplateRestrictions_022.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with permutation inside values. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_022 { + + type record ExampleType { + set of integer a, + charstring b + } + + template(value) ExampleType exampleOmitAny := {permutation(2,4,6),"abcde"}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of permutation match +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_023 NegSem_1508_TemplateRestrictions_023.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with length restrictions. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_023 { + + type record ExampleType { + charstring b + } + + template(value) ExampleType exampleOmitAny := {"abcde" length(1..3)}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of length restriction +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_024 NegSem_1508_TemplateRestrictions_024.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) is rejected with length restrictions. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_024 { + + type record ExampleType { + charstring b + } + + template(value) ExampleType exampleOmitAny := {"abcde" ifpresent}; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of `ifpresent' +<END_RESULT> +<RESULT COUNT 1> +error: `ifpresent' is not allowed here +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) is rejected with length restrictions. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_025 NegSem_1508_TemplateRestrictions_025.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(present) refuses omitvalue as a whole. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_025 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(present) ExampleType exampleOmit := omit; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of omit value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(value) refuses omit as a whole. > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_026 NegSem_1508_TemplateRestrictions_026.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(value) refuses omit as a whole. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1508_TemplateRestrictions_026 { + + type record ExampleType { + integer a, + boolean b optional + } + + template(value) ExampleType exampleOmit := omit; + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template definition does not allow usage of omit value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the template(present) with anyvalue(?) can't be assigned to an omit restricted variable template > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_029 NegSem_1508_TemplateRestrictions_029.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that the template(present) with anyvalue(?) can't be assigned to an omit restricted variable template + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_029 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a, + boolean b + } + + type component GeneralComp { + var template (omit) ExampleType v_omit; //omit restricted template variable + } + + template (present) ExampleType MyintTemplate :={ + //actual template with present restriction contains anytype (?) + a := ?, + b := false + } + + testcase TC_NegSem_1508_TemplateRestrictions_029() runs on GeneralComp { + + v_omit := MyintTemplate; //error: v_omit is omit restricted, hence can not contain anytype(?) + + if (valueof(v_omit.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_029()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that unrestricted template with anyvalue(?) can't be assigned to an omit restricted variable template > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_030 NegSem_1508_TemplateRestrictions_030.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that unrestricted template with anyvalue(?) can't be assigned to an omit restricted variable template + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_030 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a optional, + boolean b + } + + type component GeneralComp { + var template (omit) ExampleType v_omit; //omit restricted template variable + } + + + template ExampleType MyintTemplate :={ //actual template without restriction contains anyvalue (?) + a := ?, + b := false + } + + + testcase TC_NegSem_1508_TemplateRestrictions_030() runs on GeneralComp { + + v_omit := MyintTemplate; //error: v_omit is omit restricted, hence can not contain anyvalue(?) + + if (valueof(v_omit.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_030()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(omit) can't be assigned to a variable template(value) if omit > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_031 NegSem_1508_TemplateRestrictions_031.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(omit) can't be assigned to a variable template(value) if omit + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_031 { + + type record ExampleType { + // Exampletype record contains a charstring and a boolean + charstring a optional, + boolean b + } + + type component GeneralComp { + var template (value) ExampleType v_value; //value restricted template variable + } + + //actual template (with omit restriction) is omit + template (omit) ExampleType MyintTemplate := omit; + + testcase TC_NegSem_1508_TemplateRestrictions_031() runs on GeneralComp { + + v_value := MyintTemplate; //error: v_value is value restricted, hence can not be omit + + if (valueof(v_value.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_031()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of omit value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_032 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that template(present) can't be assigned to a template(value) variable if contains anyvalueornone(*) > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_032 NegSem_1508_TemplateRestrictions_032.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that template(present) can't be assigned to a template(value) variable if contains anyvalueornone(*) + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_032 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a optional, + boolean b + } + + type component GeneralComp { + var template (value) ExampleType v_value; //value restricted template variable + } + + template (present) ExampleType MyintTemplate :={ + //actual template (with present restriction) contains * + a := *, + b:= true + } + + testcase TC_NegSem_1508_TemplateRestrictions_032() runs on GeneralComp { + + v_value := MyintTemplate; //error: v_value is value restricted, hence can not contain * + + if (valueof(v_value.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_032()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_033 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that an unrestricted template can't be assigned to a template(value) variable if contains anyvalueornone(*) > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_033 NegSem_1508_TemplateRestrictions_033.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that an unrestricted template can't be assigned to a template(value) variable if contains anyvalueornone(*) + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_033 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a optional, + boolean b + } + + type component GeneralComp { + var template (value) ExampleType v_value; //value restricted template variable + } + + + template ExampleType MyintTemplate :={ //actual template (without restriction) contains * + a := *, + b:= true + } + + testcase TC_NegSem_1508_TemplateRestrictions_033() runs on GeneralComp { + + v_value := MyintTemplate; //error: v_value is value restricted, hence can not contain * + + if (valueof(v_value.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_033()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_034 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a template with omit restriction can't be assigned to a template(present)variable if omit > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_034 NegSem_1508_TemplateRestrictions_034.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that a template with omit restriction can't be assigned to a template(present)variable if omit + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_034 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a , + boolean b optional + } + + type component GeneralComp { + var template (present) ExampleType v_present; //value restricted template variable + } + + template (omit) ExampleType MyintTemplate := omit; //actual template (omit) is omit + + testcase TC_NegSem_1508_TemplateRestrictions_034() runs on GeneralComp { + + v_present := MyintTemplate; //error: v_present is present restricted, hence can not be omit + + if (valueof(v_present.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_034()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of omit value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_035 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that an unrestricted template can't be assigned to a template(present)variable if omit > + +<COMPILE> + +<MODULE TTCN NegSem_1508_TemplateRestrictions_035 NegSem_1508_TemplateRestrictions_035.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.8, Ensure that an unrestricted template can't be assigned to a template(present)variable if omit + ** @verdict pass reject + *****************************************************************/ + + +module NegSem_1508_TemplateRestrictions_035 { + + type record ExampleType { // Exampletype record contains a charstring and a boolean + charstring a , + boolean b optional + } + + type component GeneralComp { + var template (present) ExampleType v_present; //value restricted template variable + } + + template ExampleType MyintTemplate := omit; //actual template is omit + + testcase TC_NegSem_1508_TemplateRestrictions_035() runs on GeneralComp { + + v_present := MyintTemplate; //error: v_present is present restricted, hence can not be omit + + if (valueof(v_present.b) == false) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1508_TemplateRestrictions_035()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Restriction on template does not allow usage of omit value +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1509_match_operation folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1509_MatchOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the match operation refuses two templates as actual parameters. > + +<COMPILE> + +<MODULE TTCN NegSem_1509_MatchOperation_001 NegSem_1509_MatchOperation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.9, Ensure that the match operation refuses two templates as actual parameters. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1509_MatchOperation_001 { + + type component GeneralComp { } + + template integer m_lessThan10 := (-infinity..9); + template integer m_second := (-20,-40); + + testcase TC_NegSem_1509_MatchOperation_001() runs on GeneralComp { + if (match(m_second, m_lessThan10)) { // shall fail as both actual parameters refer to templates + setverdict(fail); + } else { + setverdict(pass); + } + } + + control{ + execute(TC_NegSem_1509_MatchOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template `@NegSem_1509_MatchOperation_001.m_second' +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1510_valueof_operation folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the valueof function works correctly on omit. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1510_ValueOfOperation_001 NegSem_1510_ValueOfOperation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.10, Ensure that the valueof function works correctly on omit. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1510_ValueOfOperation_001 { + + type component GeneralComp { } + + testcase TC_NegSem_1510_ValueOfOperation_001() runs on GeneralComp { + var template integer m_int := omit; + var integer v_int := valueof(m_int); + + // if we get here, something must be wrong as valueof on m_int shall cause an error + // due to the omit. + setverdict(fail); + } + + control{ + execute(TC_NegSem_1510_ValueOfOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the valueof function works correctly on templates with wildcards. > + +<COMPILE> + +<MODULE TTCN NegSem_1510_ValueOfOperation_002 NegSem_1510_ValueOfOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.10, Ensure that the valueof function works correctly on templates with wildcards. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1510_ValueOfOperation_002 { + + type component GeneralComp { } + + type record ExampleType { + integer field1, + boolean field2 + } + + template ExampleType m_template := { + field1 := *, + field2 := ? + } + + testcase TC_NegSem_1510_ValueOfOperation_002() runs on GeneralComp { + var ExampleType v_int := valueof(m_template); + + // if we get here, something must be wrong as valueof on m_template shall cause an error + // due to the * and ? wildcards. + setverdict(fail); + } + + control{ + execute(TC_NegSem_1510_ValueOfOperation_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A specific value was expected instead of any value +<END_RESULT> +<RESULT COUNT 1> +error: A specific value was expected instead of any or omit +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the valueof function works correctly on regular value templates. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1510_ValueOfOperation_003 NegSem_1510_ValueOfOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.10, Ensure that the valueof function works correctly on regular value templates. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1510_ValueOfOperation_003 { + + type component GeneralComp { } + + type record ExampleType { + integer field1, + boolean field2 + } + + testcase TC_NegSem_1510_ValueOfOperation_003() runs on GeneralComp { + var template ExampleType f_first := { + field1 := (1, 2), + field2 := true + }; + + var ExampleType v_second := valueof(f_first); + + // if we get here, something must be wrong as valueof on m_template shall cause an error + setverdict(fail); + } + + control{ + execute(TC_NegSem_1510_ValueOfOperation_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the valueof function works correctly on range templates. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1510_ValueOfOperation_004 NegSem_1510_ValueOfOperation_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.10, Ensure that the valueof function works correctly on range templates. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1510_ValueOfOperation_004 { + + type component GeneralComp { } + + testcase TC_NegSem_1510_ValueOfOperation_004() runs on GeneralComp { + var template integer v_test := (1..5); + + var integer v_second := valueof(v_test); + + // if we get here, something must be wrong as valueof on v_test shall cause an error + // as it is not a template. + setverdict(fail); + } + + control{ + execute(TC_NegSem_1510_ValueOfOperation_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the valueof function works correctly on range templates. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1510_ValueOfOperation_005 NegSem_1510_ValueOfOperation_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.10, Ensure that the valueof function works correctly on range templates. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1510_ValueOfOperation_004 { + + type component GeneralComp { } + + testcase TC_NegSem_1510_ValueOfOperation_004() runs on GeneralComp { + var template integer v_test := (1..5); + + var integer v_second := valueof(v_test); + + // if we get here, something must be wrong as valueof on v_test shall cause an error + // as it is not a template. + setverdict(fail); + } + + control{ + execute(TC_NegSem_1510_ValueOfOperation_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 1511_concatenating_templates_of_string_and_list_types folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that concatenation of octetstring types yields an even number of digits. > + +<COMPILE> + +<MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.11, Ensure that concatenation of octetstring types yields an even number of digits. + ** @verdict pass reject + *****************************************************************/ +//Note: see CR5805 regarding corresponding BNF update + +module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 { + + type component GeneralComp { } + + testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001() runs on GeneralComp { + var template octetstring v_str := 'ABCD'O & '?'O & '?E'O; + + // shall cause an error as it would denote 9 (i.e., uneven) number of digits + setverdict(fail); + } + + control{ + execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Octetstring match contains half octet\(s\) +<END_RESULT> +<RESULT COUNT 1> +error: at or before token `'O': syntax error, unexpected OctetStringMatch +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that a simple concatenation of non-wildcard octetstring must not yield in a non-even number of hexadecimals. > + +<COMPILE> + +<MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.11, Ensure that a simple concatenation of non-wildcard octetstring must not yield in a non-even number of hexadecimals. + ** @verdict pass reject + *****************************************************************/ +//Note: see CR5805 regarding corresponding BNF update + +module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 { + + type component GeneralComp { } + + testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003() runs on GeneralComp { + var template octetstring v_str := 'AB'O & '0F'O & '2A'O & 'F'O; + + // shall cause an error as the length of the concantenated octetstring is is uneven + setverdict(fail); + } + + control{ + execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Octetstring value contains odd number of hexadecimal digits +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the inline template definitions are correctly concatenated. > + +<COMPILE> + +<MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.11, Ensure that the inline template definitions are correctly concatenated. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 { + + type component GeneralComp { } + + type record MyRecord { + charstring field1, + charstring field2 + } + + template MyRecord m_receiveTemplate := { + field1 := pattern "AB*DE", + field2 := "ABCC" & * & "EF" //only specific values allowed when there is no pattern keyword + } + + testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004() runs on GeneralComp { + var MyRecord v_value := { + field1 := "AB*DE", + field2 := "ABCCDE*EF" + } + + if (match(v_value, m_receiveTemplate)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\*': syntax error, unexpected '\*' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the inline template definitions are correctly concatenated. > + +<COMPILE> + +<MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.11, Ensure that the inline template definitions are correctly concatenated. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 { + + type component GeneralComp { } + + type record MyRecord { + charstring field1, + charstring field2 + } + + template MyRecord m_receiveTemplate := { + field1 := pattern "AB*DE", + field2 := pattern "ABCC" & * length(2) & "EF" + //cannot use length(n) attribute on charstring pattern + } + + testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005() runs on GeneralComp { + var MyRecord v_value := { + field1 := "AB*DE", + field2 := "ABCCDE*EF" + } + + if (match(v_value, m_receiveTemplate)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\*': syntax error, unexpected '\*', expecting Identifier or Cstring or CharKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that concatenation of octetstring types and ? patterns works as expected. > + +<COMPILE> + +<MODULE TTCN NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:15.11, Ensure that concatenation of octetstring types and ? patterns works as expected. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 { + + type component GeneralComp { } + + testcase TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006() runs on GeneralComp { + var template octetstring v_myString1 := 'ABCD'O & ? length(2) length (6); //missing parenthesis + if (match('ABCD12'O, v_myString1)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\?': syntax error, unexpected '\?' +<END_RESULT> +<RESULT COUNT 1> +error: at or before token `else': syntax error, unexpected ElseKeyword +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/16-20_folders.script b/conformance_test/negative_tests/16-20_folders.script new file mode 100644 index 0000000000000000000000000000000000000000..d639dcab1bccc7f6fe502e737c0ce138407330d5 --- /dev/null +++ b/conformance_test/negative_tests/16-20_folders.script @@ -0,0 +1,4069 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 16_functions_altsteps_testcases, 19_basic_program_statements and 20_statement_and_operations_for_alt folders. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 16_functions_altsteps_testcases folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_001 NegSem_1601_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_001 { + + type component GeneralComp { + } + + function f_test ( integer p_integer := 0 ) return float { + + return p_integer+1; // mismatch between return type and argument type + return p_integer+2; + } + + testcase TC_NegSem_1601_toplevel_001 () runs on GeneralComp { + + if(f_test(1)==2) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + execute(TC_NegSem_1601_toplevel_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operands of operation `==' should be of compatible types +<END_RESULT> +<RESULT COUNT 2> +error: Incompatible value: `float' value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_002 NegSem_1601_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_002 { + + type component GeneralComp { + } + + function f_test ( template octetstring p_ostring ) return octetstring { + return p_ostring; // mismatch between return type and template argument + } + + testcase TC_NegSem_1601_toplevel_002 () runs on GeneralComp { + if( match('FFFFFF'O, f_test('FF??'O)) ) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_1601_toplevel_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template parameter `p_ostring' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_003 NegSem_1601_toplevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_003 { + + type component GeneralComp { + var integer v_comp:=1; + } + + function f_test ( integer p_integer := 0 ) return integer { + + return f_two(p_integer); //against restriction 16.1 / a) + } + + function f_two ( integer p_integer := 0 ) runs on GeneralComp return integer { + + return p_integer+v_comp; + } + + testcase TC_NegSem_1601_toplevel_003 () runs on GeneralComp { + + if(f_test(1)==2) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + execute(TC_NegSem_1601_toplevel_003()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A definition without `runs on' clause cannot call function `@NegSem_1601_toplevel_003.f_two', which runs on component type `@NegSem_1601_toplevel_003.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_004 NegSem_1601_toplevel_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_004 { + + type component GeneralComp { + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + + return p_integer+1; + } + + testcase TC_NegSem_1601_toplevel_004 () runs on GeneralComp { + + if(f_test(1)==2) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + f_test(1); //attempt to invoke a function with runs on clause + execute(TC_NegSem_1601_toplevel_004()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A definition without `runs on' clause cannot call function `@NegSem_1601_toplevel_004.f_test', which runs on component type `@NegSem_1601_toplevel_004.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_005 NegSem_1601_toplevel_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_005 { + + type component GeneralComp { + } + + function f_test (in integer p_integer := 10 ) return integer { + if (p_integer > 5) { + p_integer := 5; + return p_integer; + } + // there is no return value if comparison is false + + } + + testcase TC_NegSem_1601_toplevel_005 () runs on GeneralComp { + + if(f_test(2)==2) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + execute(TC_NegSem_1601_toplevel_005()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The function has return type, but control might leave it without reaching a return statement +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles function definitions > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_006 NegSem_1601_toplevel_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1, Ensure that the IUT correctly handles function definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_1601_toplevel_006 { + + type component GeneralComp { + var integer v_comp:=1; + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + return f_two(p_integer); + } + + function f_two ( integer p_integer := 0 ) return integer { + return p_integer+v_comp; //use of variable from a component but missing 'runs on' clause + } + + testcase TC_NegSem_1601_toplevel_006 () runs on GeneralComp { + + if(f_test(1)==2) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + execute(TC_NegSem_1601_toplevel_006()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_comp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_001 NegSem_160102_predefined_functions_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_001 () runs on GeneralComp { + var charstring v_i; + + v_i:=int2char(128); + } + + control{ + execute(TC_NegSem_160102_predefined_functions_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operand of operation `int2char\(\)' should be in range 0..127 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_002 NegSem_160102_predefined_functions_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_002 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_002 () runs on GeneralComp { + var charstring v_i; + + v_i:=int2char(-1); + } + + control { + execute(TC_NegSem_160102_predefined_functions_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operand of operation `int2char\(\)' should be in range 0..127 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_003 NegSem_160102_predefined_functions_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_003 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_003 () runs on GeneralComp { + var universal charstring v_i; + + v_i:=int2char(2147483648); + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_003()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operand of operation `int2char\(\)' should be in range 0..127 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_004 NegSem_160102_predefined_functions_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_004 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_004 () runs on GeneralComp { + var hexstring v_i; + + v_i:=int2hex(256,2); //mismatch of string length + setverdict(pass); + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_004()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Value 256 does not fit in length 2 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_005 NegSem_160102_predefined_functions_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_005 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_005 () runs on GeneralComp { + var integer v_i; + + v_i:=char2int("blabla"); //mismatch of string length + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_005()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The operand of operation `char2int\(\)' should be of length 1 +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_006 NegSem_160102_predefined_functions_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_006 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_006 () runs on GeneralComp { + var integer v_i; + + v_i:=lengthof('1*F'H); //undetermined string length + setverdict(pass); + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_006()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing lengthof\(\) operation on a hexstring template with no exact length. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_007 NegSem_160102_predefined_functions_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_007 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_007 () runs on GeneralComp { + var integer v_i; + + v_i:=lengthof('1'B length(3)); //undetermined string length + setverdict(pass); + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_007()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There are fewer \(1\) elements in the string than it is allowed by the length restriction \(3\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_008 NegSem_160102_predefined_functions_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_008 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_008 () runs on GeneralComp { + var integer v_i; + + v_i:=lengthof('1*0'B length(3..6)); //undetermined string length + setverdict(pass); + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_008()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing lengthof\(\) operation on a bitstring template with no exact length. +<END_RESULT> + +<END_TC> +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_010 NegSem_160102_predefined_functions_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_010 { + type record of integer IntegerList; + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_010 () runs on GeneralComp { + template IntegerList template1 := { 1, 2, 3, * } length(1..2) ; //incorrect template length + var integer v_i; + + v_i:=lengthof(template1); + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_010()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There are more \(at least 3\) elements in the template than it is allowed by the length restriction \(at most 2\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_017 NegSem_160102_predefined_functions_017.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_017 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_017 () runs on GeneralComp { + var charstring v_example:="example text string"; + var charstring v_i; + + v_i:=regexp(v_example,charstring:"?+(text)?+",1); //wrong group index + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_017()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The third argument \(groupno\) of function regexp\(\) is too large: The requested group index is 1, but the pattern contains only 1 group. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_018 NegSem_160102_predefined_functions_018.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_018 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_018 () runs on GeneralComp { + var charstring v_example:="example text string"; + var charstring v_i; + + v_i:=regexp(v_example,charstring:"?+(text)?+",-1); //wrong group index + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_018()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Third operand of operation `regexp\(\)' should not be negative +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_019 NegSem_160102_predefined_functions_019.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_019 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_019 () runs on GeneralComp { + var charstring v_example:="example text string"; + var charstring v_i; + + v_i:=regexp(v_example,charstring:"?+(text)?+"); //missing group index + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_019()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\)': syntax error, unexpected '\)', expecting ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_021 NegSem_160102_predefined_functions_021.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_021 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_021 () runs on GeneralComp { + var bitstring v_i; + + v_i:=substr('00100110'B,-3,4); //wrong index value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_021()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Second operand of operation `substr\(\)' should not be negative +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_022 NegSem_160102_predefined_functions_022.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_022 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_022 () runs on GeneralComp { + var charstring v_i; + + v_i:=substr('00100110'B,3,-4); //wrong length value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_022()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Third operand of operation `substr\(\)' should not be negative +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_023 NegSem_160102_predefined_functions_023.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_023 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_023 () runs on GeneralComp { + var charstring v_i; + + v_i:=substr('00100110'B,3,14); //too large length value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_023()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The sum of second operand `index' \(3\) and third operand `returncount' \(14\) is greater than the length of the first operand \(8\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_024 NegSem_160102_predefined_functions_024.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_024 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_024 () runs on GeneralComp { + var bitstring v_i; + + v_i:=replace('00000110'B,-1,3,'111'B); //wrong index value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_024()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Second operand of operation `replace\(\)' should not be negative +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_025 NegSem_160102_predefined_functions_025.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_025 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_025 () runs on GeneralComp { + var bitstring v_i; + + v_i:=replace('00000110'B,1,-3,'111'B); //wrong length value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_025()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Third operand of operation `replace\(\)' should not be negative +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_026 NegSem_160102_predefined_functions_026.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_026 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_026 () runs on GeneralComp { + var bitstring v_i; + + v_i:=replace('00000110'B,1,13,'111'B); //too large length value + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_026()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The sum of second operand `index' \(1\) and third operand `len' \(13\) is greater than the length of the first operand \(8\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_027 NegSem_160102_predefined_functions_027.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_027 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_027 () runs on GeneralComp { + var bitstring v_i; + + v_i:=replace('00000110'B,1,4,'8'H); //incompatible replacement type + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_027()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Fourth operand of operation `replace\(\)' is of type `hexstring', but a value of type `bitstring' was expected here +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_029 NegSem_160102_predefined_functions_029.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_029 { + type enumerated EnumeratedType {e_black, e_white}; + type enumerated EnumeratedTypeWithLabels1 {e_black (1), e_white}; + type enumerated EnumeratedTypeWithLabels2 {e_black (-1), e_white}; + type enumerated EnumeratedTypeWithLabels3 {e_black (-1), e_white , e_yellow (0) }; + type enumerated Fruits {e_apple, e_peach, e_cherry}; + + type component GeneralComp { + } + + + testcase TC_NegSem_160102_predefined_functions_029 () runs on GeneralComp { + + var EnumeratedType vl_enum_black := e_black; + var EnumeratedType vl_enum_white := e_white; + var EnumeratedTypeWithLabels1 vl_enum1_black := e_black; + var EnumeratedTypeWithLabels1 vl_enum1_white := e_white; + var EnumeratedTypeWithLabels2 vl_enum2_black := e_black; + var EnumeratedTypeWithLabels2 vl_enum2_white := e_white; + var EnumeratedTypeWithLabels3 vl_enum3_black := e_black; + var EnumeratedTypeWithLabels3 vl_enum3_white := e_white; + var EnumeratedTypeWithLabels3 vl_enum3_yellow := e_yellow; + + + if( match(enum2int(EnumeratedTypeWithLabels1.e_black), 0) //not allowed selection + ) { + setverdict(pass); + } + else { + setverdict(fail); + } + + + } + + + control{ + + execute(TC_NegSem_160102_predefined_functions_029()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of type `@NegSem_160102_predefined_functions_029.EnumeratedTypeWithLabels1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_030 NegSem_160102_predefined_functions_030.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_030 { + type enumerated EnumeratedType {e_black, e_white}; + type enumerated EnumeratedTypeWithLabels1 {e_black (1), e_white}; + type enumerated EnumeratedTypeWithLabels2 {e_black (-1), e_white}; + type enumerated EnumeratedTypeWithLabels3 {e_black (-1), e_white , e_yellow (0) }; + type enumerated Fruits {e_apple, e_peach, e_cherry}; + + type component GeneralComp { + } + + + testcase TC_NegSem_160102_predefined_functions_030 () runs on GeneralComp { + + var EnumeratedType vl_enum_black := e_black; + var EnumeratedType vl_enum_white := e_white; + var EnumeratedTypeWithLabels1 vl_enum1_black := e_black; + var EnumeratedTypeWithLabels1 vl_enum1_white := e_white; + var EnumeratedTypeWithLabels2 vl_enum2_black := e_black; + var EnumeratedTypeWithLabels2 vl_enum2_white := e_white; + var EnumeratedTypeWithLabels3 vl_enum3_black := e_black; + var EnumeratedTypeWithLabels3 vl_enum3_white := e_white; + var EnumeratedTypeWithLabels3 vl_enum3_yellow := e_yellow; + const EnumeratedTypeWithLabels1 c_enum1_black := e_black; + + int2enum(4,vl_enum1_black); //not existing label + + //if( match(int2enum(4,vl_enum1_black), c_enum1_black) // int2enum isn't a return type function + if( match(vl_enum1_black, c_enum1_black) + ) { + setverdict(pass); + } + else { + setverdict(fail); + } + + + } + + + control{ + + execute(TC_NegSem_160102_predefined_functions_030()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Assigning invalid numeric value 4 to a variable of enumerated type @NegSem_160102_predefined_functions_030.EnumeratedTypeWithLabels1. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> + +<MODULE TTCN NegSem_160102_predefined_functions_031 NegSem_160102_predefined_functions_031.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ +module NegSem_160102_predefined_functions_031 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_031 () runs on GeneralComp { + var float v_random1; + + v_random1:=rnd(infinity); //cannot have infinity as a seed + if( match(rnd(infinity), v_random1) and not match(rnd(1.0), v_random1) ) { + setverdict(pass); + } + else { + setverdict(fail); + } + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_031()); + + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: The operand of operation `rnd \(seed\)' cannot be INF, it must be a numeric value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_036 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_036 NegSem_160102_predefined_functions_036.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ + +/* The following requirements are tested: + *In addition to the general error causes in clause 16.1.2, error causes are: + * inpar is a template of a character string type and contains a matching mechanism other than AnyElement or +AnyElementsOrNone; */ + +module NegSem_160102_predefined_functions_036 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_036 () runs on GeneralComp { + + const universal charstring m_Ref:="abc?def?"; + + var template universal charstring Mytemp := pattern "{m_Ref}\q{0,0,1,113}"; + var universal charstring v_i; + + v_i:=substr(Mytemp,1,2); //error: non allowed matching mechanism + + + } + + control{ + + execute(TC_NegSem_160102_predefined_functions_036()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The first argument of function substr\(\) is a template with non-specific value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_037 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_160102_predefined_functions_037 NegSem_160102_predefined_functions_037.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.1.2, Ensure that the IUT recognizes predefined functions and correctly evaluates them (as specified by Annex C) + ** @verdict pass reject + ***************************************************/ + +/* The following requirements are tested: + *In addition to the general error causes in clause 16.1.2, error causes are: + * inpar is a template of a binary string or sequence type or array and it contains other matching mechanism as + * specific value and AnyElement; + */ + +module NegSem_160102_predefined_functions_037 { + + type component GeneralComp { + } + + testcase TC_NegSem_160102_predefined_functions_037 () runs on GeneralComp { + + + var template bitstring Mytemp := '00101*'B; + var bitstring v_i; + + v_i:=substr(Mytemp,1,2); //error: contains a matching mechanism other than AnyElement + + } + + + control{ + + execute(TC_NegSem_160102_predefined_functions_037()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The first argument of function substr\(\) is a template with non-specific value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1602_toplevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes altstep definitions and correctly evaluates them > + +<COMPILE> + +<MODULE TTCN NegSem_1602_toplevel_005 NegSem_1602_toplevel_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.2, Ensure that the IUT recognizes altstep definitions and correctly evaluates them + ** @verdict pass reject + ***************************************************/ +module NegSem_1602_toplevel_005 { + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + + altstep AltSet1() { //altstep port operations without corresponding component reference + + [] messagePort.receive { + setverdict(pass); + } + + } + + testcase TC_NegSem_1602_toplevel_005 () runs on GeneralComp { + var MessageType v_testMessage; + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + + AltSet1(); + + } + + control{ + + execute(TC_NegSem_1602_toplevel_005()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `messagePort' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1602_toplevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes altstep definitions and correctly evaluates them > + +<COMPILE> + +<MODULE TTCN NegSem_1602_toplevel_006 NegSem_1602_toplevel_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.2, Ensure that the IUT recognizes altstep definitions and correctly evaluates them + ** @verdict pass reject + ***************************************************/ +module NegSem_1602_toplevel_006 { + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test(integer p_int) runs on GeneralComp return boolean { + //use of a function with runs on clause from an altstep without a runs on clause + if (p_int==1) + { return true; } + else + { return false; } + } + + + altstep AltSet1() { + var integer v_LocalVar1 := 1; + timer t_timer := 1.0; + + [f_test(v_LocalVar1)] t_timer.timeout { + + setverdict(pass); + } + + } + + testcase TC_NegSem_1602_toplevel_006 () runs on GeneralComp { + var MessageType v_testMessage; + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + + AltSet1(); + + } + + control{ + + execute(TC_NegSem_1602_toplevel_006()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A definition without `runs on' clause cannot call function `@NegSem_1602_toplevel_006.f_test', which runs on component type `@NegSem_1602_toplevel_006.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1602_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes altstep definitions and correctly evaluates them > + +<COMPILE> + +<MODULE TTCN NegSyn_1602_toplevel_001 NegSyn_1602_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.2, Ensure that the IUT recognizes altstep definitions and correctly evaluates them + ** @verdict pass reject + ***************************************************/ +module NegSyn_1602_toplevel_001 { + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + + return p_integer+1; + } + + + altstep AltSet1() runs on GeneralComp { + + [] messagePort.receive { + setverdict(pass); + } + + var integer v_LocalVar := f_test(); //late definition of a local variable + + } + + testcase TC_NegSyn_1602_toplevel_001 () runs on GeneralComp { + var MessageType v_testMessage; + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + + AltSet1(); + + } + + control{ + + execute(TC_NegSyn_1602_toplevel_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `var': syntax error, unexpected VarKeyword, expecting '\}' or '\[' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160201_invoking_altsteps_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT recognizes altstep definitions and correctly evaluates them > + +<COMPILE> + +<MODULE TTCN NegSem_160201_invoking_altsteps_001 NegSem_160201_invoking_altsteps_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.2.1, Ensure that the IUT recognizes altstep definitions and correctly evaluates them + ** @verdict pass reject + ***************************************************/ +module NegSem_160201_invoking_altsteps_001 { + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type port simplePort message { + inout integer + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + type component AltComp { + port simplePort messagePort + } + + + + altstep AltSet1() runs on AltComp { //incompatible component with GeneralComp + + [] messagePort.receive { + setverdict(pass); + } + + } + + testcase TC_NegSem_160201_invoking_altsteps_001 () runs on GeneralComp { + var MessageType v_testMessage; + timer t_timer; + + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + t_timer.start( 1.0 ); + + alt { + [] AltSet1(); + [] t_timer.timeout { + setverdict(pass); + } + } + + } + + control{ + + execute(TC_NegSem_160201_invoking_altsteps_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Runs on clause mismatch: A definition that runs on component type `@NegSem_160201_invoking_altsteps_001.GeneralComp' cannot call altstep `@NegSem_160201_invoking_altsteps_001.AltSet1', which runs on `@NegSem_160201_invoking_altsteps_001.AltComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. 1603_testcases folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1603_testcases_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates invocation of testcases > + +<COMPILE> + +<MODULE TTCN NegSem_1603_testcases_001 NegSem_1603_testcases_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.3, Ensure that the IUT properly evaluates invocation of testcases + ** @verdict pass reject + ***************************************************/ +module NegSem_1603_testcases_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1603_testcases_001 () runs on GeneralComp { + execute(TC_fail()); //testcases can only be invoked from the control part + setverdict(pass); + } + + testcase TC_fail () runs on GeneralComp { + setverdict(fail); + } + + control{ + + execute(TC_NegSem_1603_testcases_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A definition that has `runs on' clause cannot execute testcases +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1603_testcases_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates invocation of testcases > + +<COMPILE> + +<MODULE TTCN NegSem_1603_testcases_002 NegSem_1603_testcases_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:16.3, Ensure that the IUT properly evaluates invocation of testcases + ** @verdict pass reject + ***************************************************/ +module NegSem_1603_testcases_002 { + + type component GeneralComp { + } + + testcase TC_NegSem_1603_testcases_002 () runs on GeneralComp { + TC_fail(); //testcases can only be invoked from the control part + setverdict(pass); + } + + testcase TC_fail () runs on GeneralComp { + setverdict(fail); + } + + control{ + execute(TC_NegSem_1603_testcases_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a function or altstep was expected instead of testcase `@NegSem_1603_testcases_002.TC_fail', which cannot be invoked +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 19_basic_program_statements folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates assignment statements > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1901_assignments_001 NegSem_1901_assignments_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that the IUT properly evaluates assignment statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1901_assignments_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1901_assignments_001 () runs on GeneralComp system GeneralComp { + var integer v_i; + var integer v_j; + + v_j:=v_i; //assignment of unbounded expression + + } + + control{ + + execute(TC_NegSem_1901_assignments_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Assignment of an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates assignment statements > + +<COMPILE> + +<MODULE TTCN NegSem_1901_assignments_002 NegSem_1901_assignments_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that the IUT properly evaluates assignment statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1901_assignments_002 { + + type component GeneralComp { + } + + testcase TC_NegSem_1901_assignments_002 () runs on GeneralComp system GeneralComp { + var integer v_i; + + v_i:=1.5; //assignment of incompatible expression + + } + + control{ + + execute(TC_NegSem_1901_assignments_002()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates assignment statements > + +<COMPILE> + +<MODULE TTCN NegSem_1901_assignments_003 NegSem_1901_assignments_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that the IUT properly evaluates assignment statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1901_assignments_003 { + + type component GeneralComp { + } + + testcase TC_NegSem_1901_assignments_003 () runs on GeneralComp system GeneralComp { + var charstring v_i; + + v_i:=pattern "a??b"; //assignment of incompatible expression + + } + + control{ + + execute(TC_NegSem_1901_assignments_003()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template body with matching symbols cannot be assigned to a variable +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that omit assignment to a record non-optional value is not allowed > + +<COMPILE> + +<MODULE TTCN NegSem_1901_assignments_004 NegSem_1901_assignments_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that omit assignment to a record non-optional value is not allowed + ** @verdict pass reject + ***************************************************/ + +//Restriction c) +/*If the left-hand side of the assignment is a reference to a non-optional value object (i.e. a value definition, a mandatory field, a record/set of/array element, a union alternative, a value parameter), + * the right-hand side shall not be a reference to an omitted field or the omit symbol.*/ + +module NegSem_1901_assignments_004{ + + type component GeneralComp { + } + + type record Myrec{ + integer field1, + float field2 + }; + + testcase TC_NegSem_1901_assignments_004 () runs on GeneralComp system GeneralComp { + + var Myrec v_i; + + v_i:={11,omit}; //assignment not allowed + + setverdict(pass,v_i); + + } + + + control{ + + execute(TC_NegSem_1901_assignments_004()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that omit assignment to set of non-optional value is not allowed > + +<COMPILE> + +<MODULE TTCN NegSem_1901_assignments_005 NegSem_1901_assignments_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that omit assignment to set of non-optional value is not allowed + ** @verdict pass reject + ***************************************************/ + + //Restriction c) +/*If the left-hand side of the assignment is a reference to a non-optional value object (i.e. a value definition, a mandatory field, a record/set of/array element, a union alternative, a value parameter), +the right-hand side shall not be a reference to an omitted field or the omit symbol.*/ + +module NegSem_1901_assignments_005{ + + type component GeneralComp { + } + + type set of integer Myset; + + testcase TC_NegSem_1901_assignments_005 () runs on GeneralComp system GeneralComp { + + var Myset v_i; + + v_i:={11,omit}; //assignment not allowed + + setverdict(pass,v_i); + + } + + + control{ + + execute(TC_NegSem_1901_assignments_005()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that omit assignment to an array is not allowed > + +<COMPILE> + +<MODULE TTCN NegSem_1901_assignments_006 NegSem_1901_assignments_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that omit assignment to an array is not allowed + ** @verdict pass reject + ***************************************************/ + +//Restriction c) +/*If the left-hand side of the assignment is a reference to a non-optional value object (i.e. a value definition, a mandatory field, a record/set of/array element, a union alternative, a value parameter), +the right-hand side shall not be a reference to an omitted field or the omit symbol.*/ + +module NegSem_1901_assignments_006{ + + type component GeneralComp { + } + + + + testcase TC_NegSem_1901_assignments_006 () runs on GeneralComp system GeneralComp { + + var integer v_i[2]; + + v_i:={11,omit}; //assignment not allowed + + setverdict(pass,v_i); + + } + + + control{ + + execute(TC_NegSem_1901_assignments_006()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1901_assignments_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - nsure that the IUT properly evaluates assignment statements > + +<COMPILE> + +<MODULE TTCN NegSyn_1901_assignments_001 NegSyn_1901_assignments_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.1, Ensure that the IUT properly evaluates assignment statements + ** @verdict pass reject + ***************************************************/ +module NegSyn_1901_assignments_001 { + + type component GeneralComp { + } + + testcase TC_NegSyn_1901_assignments_001 () runs on GeneralComp system GeneralComp { + var integer v_i; + var integer v_j; + var integer v_k; + v_i:=1; + v_k:=(v_j:=v_i); //such sequential assignments are not allowed by the syntax + + } + + + control{ + + execute(TC_NegSyn_1901_assignments_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `:=': syntax error, unexpected :=, expecting ',' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1902_if_else_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates assignment statements > + +<COMPILE> + +<MODULE TTCN NegSyn_1902_if_else_statement_001 NegSyn_1902_if_else_statement_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.2, If statement requires curly brackets for the body + ** @verdict pass reject + ***************************************************/ +module NegSyn_1902_if_else_statement_001 { + + type component GeneralComp { + } + + testcase TC_NegSyn_1902_if_else_statement_001 () runs on GeneralComp{ + + for(var integer v_i:=1; v_i<10; v_i:= j+1) {} + + if(v_i==10) + setverdict(pass); // missing { } as defined by grammar rule 175 StatementBlock + + } + + control{ + + execute(TC_NegSyn_1902_if_else_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `setverdict': syntax error, unexpected SetVerdictKeyword, expecting '\{' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1904_for_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates for statements > + +<COMPILE> + +<MODULE TTCN NegSem_1904_for_statement_001 NegSem_1904_for_statement_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.4, Ensure that the IUT properly evaluates for statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1904_for_statement_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1904_for_statement_001 () runs on GeneralComp{ + + for(var integer v_i:=1; v_i<10; v_i:= v_i+1) {} + + if(v_i==10) { setverdict(pass); } //v_i is not accessible from outside the loop + + } + + control{ + + execute(TC_NegSem_1904_for_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_i' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1905_while_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates while statements > + +<COMPILE> + +<MODULE TTCN NegSem_1905_while_statement_001 NegSem_1905_while_statement_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.5, Ensure that the IUT properly evaluates while statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1905_while_statement_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1905_while_statement_001 () runs on GeneralComp{ + var integer v_i:=1; + + while(v_i<10) { + var integer v_j:=1; + v_i:=v_i+1; + } + + if(v_j==1) { setverdict(pass); } //v_j is not accessible from outside the loop + + } + + control{ + + execute(TC_NegSem_1905_while_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_j' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1906_do_while_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates do-while statements > + +<COMPILE> + +<MODULE TTCN NegSem_1906_do_while_statement_001 NegSem_1906_do_while_statement_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.6, Ensure that the IUT properly evaluates do-while statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1906_do_while_statement_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1906_do_while_statement_001 () runs on GeneralComp{ + var integer v_i:=1; + + do { + var integer v_j:=1; + v_i:=v_i+1; + } while(v_i<10); + + if(v_j==1) { setverdict(pass); } //v_j is not accessible from outside the loop + + } + + + control{ + + execute(TC_NegSem_1906_do_while_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: There is no local or imported definition with name `v_j' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1907_label_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles label naming uniqueness. > + +<COMPILE> + +<MODULE TTCN NegSem_1907_label_statement_001 NegSem_1907_label_statement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.7, Ensure that the IUT correctly handles label naming uniqueness. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1907_label_statement_001 { + + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + label L1; + return p_integer+1; + } + + + altstep AltSet1() runs on GeneralComp { + var integer v_LocalVar := f_test(); // local variable + + [] messagePort.receive { + label L_A; + setverdict(pass); + label L_B; + } + + } + + testcase TC_NegSem_1907_label_statement_001 () runs on GeneralComp { + var MessageType v_testMessage; + timer t_timer; + + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + t_timer.start( 1.0 ); + label L1; + + alt { + [] AltSet1(); + [] messagePort.receive { + label L2; + setverdict(pass); + } + [] t_timer.timeout { + label L3; + } + } + label L1; //conflicting label names + } + + control{ + execute(TC_NegSem_1907_label_statement_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Duplicate label `L1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1907_label_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles label syntax. > + +<COMPILE> + +<MODULE TTCN NegSyn_1907_label_statement_001 NegSyn_1907_label_statement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.7, Ensure that the IUT correctly handles label syntax. + ** @verdict pass reject + *****************************************************************/ + +module NegSyn_1907_label_statement_001 { + + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + label L1; + return p_integer+1; + } + + + altstep AltSet1() runs on GeneralComp { + var integer v_LocalVar := f_test(); // local variable + + [] messagePort.receive { + label L_A; + setverdict(pass); + label L_B; + } + + } + + testcase TC_NegSyn_1907_label_statement_001 () runs on GeneralComp { + var MessageType v_testMessage; + timer t_timer; + + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + t_timer.start( 1.0 ); + label L1; + + alt { + [] AltSet1(); + + label L_wrong; //wrong label on the alt toplevel + + [] messagePort.receive { + label L2; + setverdict(pass); + } + [] t_timer.timeout { + label L3; + } + } + + label L4; + } + + control{ + execute(TC_NegSyn_1907_label_statement_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `label': syntax error, unexpected LabelKeyword, expecting '\}' or '\[ +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1907_label_statement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles label syntax. > + +<COMPILE> + +<MODULE TTCN NegSyn_1907_label_statement_002 NegSyn_1907_label_statement_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.7, Ensure that the IUT correctly handles label syntax. + ** @verdict pass reject + *****************************************************************/ + +module NegSyn_1907_label_statement_002 { + + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + label L1; + return p_integer+1; + } + + + altstep AltSet1() runs on GeneralComp { + var integer v_LocalVar := f_test(); // local variable + + label L_wrong; //wrong label on the altstep toplevel + + [] messagePort.receive { + label L_A; + setverdict(pass); + label L_B; + } + + } + + testcase TC_NegSyn_1907_label_statement_002 () runs on GeneralComp { + var MessageType v_testMessage; + timer t_timer; + + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + t_timer.start( 1.0 ); + label L1; + + alt { + [] AltSet1(); + [] messagePort.receive { + label L2; + setverdict(pass); + } + [] t_timer.timeout { + label L3; + } + } + + label L4; + } + + control{ + execute(TC_NegSyn_1907_label_statement_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `label': syntax error, unexpected LabelKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles goto statements. > + +<COMPILE> + +<MODULE TTCN NegSem_1908_goto_statement_001 NegSem_1908_goto_statement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.8, Ensure that the IUT correctly handles goto statements. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_1908_goto_statement_001 { + + type record MessageType { + integer field1, + charstring field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + function f_test ( integer p_integer := 0 ) runs on GeneralComp return integer { + label L1; + return p_integer+1; + } + + + altstep AltSet1() runs on GeneralComp { + var integer v_LocalVar := f_test(); // local variable + + [] messagePort.receive { + label L_A; + label L_B; + } + + } + + testcase TC_NegSem_1908_goto_statement_001 () runs on GeneralComp { + var MessageType v_testMessage; + timer t_timer; + + v_testMessage:= { + field1 := 1, + field2 := "test string" + } + + connect(self:messagePort,self:messagePort); + + messagePort.send(v_testMessage); + t_timer.start( 1.0 ); + label L1; + goto L2; //cannot jump into alt statements + + alt { + [] AltSet1(); + [] messagePort.receive { + label L2; + setverdict(pass); + } + [] t_timer.timeout { + label L2; + } + } + + label L3; + setverdict(pass); + + } + + control{ + execute(TC_NegSem_1908_goto_statement_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Label `L2' is used, but not defined +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles goto statements. > + +<COMPILE> + +<MODULE TTCN NegSem_1908_goto_statement_002 NegSem_1908_goto_statement_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.8, Ensure that the IUT correctly handles goto statements. + ** @verdict pass reject + *****************************************************************/ +module NegSem_1908_goto_statement_002 { + + type component GeneralComp { + } + + testcase TC_NegSem_1908_goto_statement_002 () runs on GeneralComp{ + var integer v_i; + goto L1; //forbidden jump into a loop + + for(v_i:=1; v_i<10; v_i:= v_i+1) { + label L1; + if(v_i==5) { break; } + } + + } + + control{ + + execute(TC_NegSem_1908_goto_statement_002()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Label `L1' is used, but not defined +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles goto statements. > + +<COMPILE> + +<MODULE TTCN NegSem_1908_goto_statement_003 NegSem_1908_goto_statement_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.8, Ensure that the IUT correctly handles goto statements. + ** @verdict pass reject + *****************************************************************/ +module NegSem_1908_goto_statement_003 { + + type component GeneralComp { + } + + testcase TC_NegSem_1908_goto_statement_003 () runs on GeneralComp{ + var integer v_i:=1; + goto L1; //forbidden jump into a loop + + if(v_i==2) { + label L1; + v_i:=1; + } + else { + v_i:=2; + goto L1; //forbidden jump into an if-else statement + } + + } + + control{ + + execute(TC_NegSem_1908_goto_statement_003()); + + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: Label `L1' is used, but not defined +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1910_return_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles return statements. > + +<COMPILE> + +<MODULE TTCN NegSem_1910_return_statement_001 NegSem_1910_return_statement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:19.10, Ensure that the IUT correctly handles return statements. + ** @verdict pass reject + *****************************************************************/ +module NegSem_1910_return_statement_001 { + + type component GeneralComp { + } + + testcase TC_NegSem_1910_return_statement_001 () runs on GeneralComp{ + setverdict(pass); + return 0; //testcase cannot have a return statement + + } + + control{ + + execute(TC_NegSem_1910_return_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Return statement cannot be used in a testcase. It is allowed only in functions and altsteps +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1911_log_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT properly evaluates log statements. > + +<COMPILE> + +<MODULE TTCN NegSem_1911_log_statement_001 NegSem_1911_log_statement_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:19.11, Ensure that the IUT properly evaluates log statements + ** @verdict pass reject + ***************************************************/ +module NegSem_1911_log_statement_001 { + + type component GeneralComp { + } + + function f_no_return(integer p_arg) { + var integer v_f; + v_f:=p_arg; + } + + testcase TC_NegSem_1911_log_statement_001 () runs on GeneralComp{ + var integer v_i; + + for(v_i:=1; v_i<10; v_i:= v_i+1) { + log("Function without return value: ", f_no_return(v_i) ); + //not allowed to use function without return value + } + + } + + control{ + + execute(TC_NegSem_1911_log_statement_001()); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value, template, timer or port was expected instead of a call of function `@NegSem_1911_log_statement_001.f_no_return', which does not have return type +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 20_statement_and_operations_for_alt folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_2002_TheAltStatement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - dynamic error if a test component is completely blocked > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2002_TheAltStatement_001 NegSem_2002_TheAltStatement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.2, dynamic error if a test component is completely blocked + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// The test case shall stop and indicate a dynamic error if a test component is +// completely blocked. This means none of the alternatives can be chosen, no +// relevant test component is running, no relevant timer is running and all +// relevant ports contain at least one message, call, reply or exception that +// do not match. + +module NegSem_2002_TheAltStatement_001 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + template charstring m_test := "ping"; + + testcase TC_NegSem_2002_TheAltStatement_001() runs on GeneralComp { + timer t_tmr1; + + connect(self:p,self:p); + + p.send(m_test); + alt { + [] p.receive("abc") { + setverdict(pass); + } + [] t_tmr1.timeout { + setverdict(pass); + } + } + } + + control { + execute(TC_NegSem_2002_TheAltStatement_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: None of the branches can be chosen in the alt statement in file NegSem_2002_TheAltStatement_001.ttcn +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2003_the_repeat_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly processes repeat statements > + +<COMPILE> + +<MODULE TTCN NegSem_2003_the_repeat_statement_001 NegSem_2003_the_repeat_statement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.3, Ensure that the IUT correctly processes repeat statements + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2003_the_repeat_statement_001 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + template charstring m_test := "ping"; + + testcase TC_NegSem_2003_the_repeat_statement_001() runs on GeneralComp { + var integer counter := 1; + + connect(self:p, self:p); + p.send(m_test); + p.send(m_test); + + alt { + [counter == 1] p.receive(m_test) { + counter := 2; + repeat; + } + [counter == 2] p.receive(m_test) { + setverdict(pass); + } + } + repeat; //repeat statement is used outside of an alt or call structure + } + + control { + execute(TC_NegSem_2003_the_repeat_statement_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Repeat statement cannot be used outside alt statements, altsteps or response and exception handling part of call operations +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - goto inside interleave > + +<COMPILE> + +<MODULE TTCN NegSem_2004_InterleaveStatement_004 NegSem_2004_InterleaveStatement_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, goto inside interleave + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Control transfer statements for, while, do-while, goto, activate, +// deactivate, stop, repeat, return, direct call of altsteps as alternatives +// and (direct and indirect) calls of user-defined functions, which include +// reception statements, shall not be used in interleave statements. + +module NegSem_2004_InterleaveStatement_004 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + testcase TC_NegSem_2004_InterleaveStatement_004() runs on GeneralComp { + + connect(self:p, self:p); + + p.send(charstring:"foo"); + p.send(charstring:"bar"); + + interleave { + [] p.receive(charstring:"bar") { + goto L1; + } + [] p.receive(charstring:"foo") { + } + } + label L1; + setverdict(pass); + } + + control{ + execute(TC_NegSem_2004_InterleaveStatement_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Goto statement is not allowed within an interleave statement +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - repeat inside interleave > + +<COMPILE> + +<MODULE TTCN NegSem_2004_InterleaveStatement_008 NegSem_2004_InterleaveStatement_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, repeat inside interleave + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Control transfer statements for, while, do-while, goto, activate, +// deactivate, stop, repeat, return, direct call of altsteps as alternatives +// and (direct and indirect) calls of user-defined functions, which include +// reception statements, shall not be used in interleave statements. + +module NegSem_2004_InterleaveStatement_008 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + testcase TC_NegSem_2004_InterleaveStatement_008() runs on GeneralComp { + + connect(self:p, self:p); + + p.send(charstring:"foo"); + p.send(charstring:"bar"); + + interleave { + [] p.receive(charstring:"bar") { + repeat; + } + [] p.receive(charstring:"foo") { + } + } + setverdict(pass); + } + + control{ + execute(TC_NegSem_2004_InterleaveStatement_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Repeat statement is not allowed within an interleave statement +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - return inside interleave > + +<COMPILE> + +<MODULE TTCN NegSem_2004_InterleaveStatement_009 NegSem_2004_InterleaveStatement_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, return inside interleave + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Control transfer statements for, while, do-while, goto, activate, +// deactivate, stop, repeat, return, direct call of altsteps as alternatives +// and (direct and indirect) calls of user-defined functions, which include +// reception statements, shall not be used in interleave statements. + +module NegSem_2004_InterleaveStatement_009 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + function f_interleave() runs on GeneralComp { + interleave { + [] p.receive(charstring:"bar") { + setverdict(pass); + return; + } + [] p.receive(charstring:"foo") { + } + } + } + + testcase TC_NegSem_2004_InterleaveStatement_009() runs on GeneralComp { + + connect(self:p, self:p); + + p.send(charstring:"foo"); + p.send(charstring:"bar"); + f_interleave(); + } + + control{ + execute(TC_NegSem_2004_InterleaveStatement_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Return statement is not allowed within an interleave statement +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - explicit altstep call inside interleave > + +<COMPILE> + +<MODULE TTCN NegSem_2004_InterleaveStatement_010 NegSem_2004_InterleaveStatement_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, explicit altstep call inside interleave + ** @verdict pass reject + *****************************************************************/ + +// The following requirement is tested: +// Control transfer statements for, while, do-while, goto, activate, +// deactivate, stop, repeat, return, direct call of altsteps as alternatives +// and (direct and indirect) calls of user-defined functions, which include +// reception statements, shall not be used in interleave statements. + +module NegSem_2004_InterleaveStatement_010 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component GeneralComp { + port MyPort p; + } + + altstep a_receive() runs on GeneralComp { + [] p.receive(charstring:?) { + } + } + + testcase TC_NegSem_2004_InterleaveStatement_010() runs on GeneralComp { + + connect(self:p, self:p); + + p.send(charstring:"foo"); + p.send(charstring:"bar"); + p.send(charstring:"ding"); + + interleave { + [] p.receive(charstring:"bar") { + a_receive(); + } + [] p.receive(charstring:"foo") { + } + } + setverdict(pass); + } + + control{ + execute(TC_NegSem_2004_InterleaveStatement_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Invocation of an altstep is not allowed within an interleave statement +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2004_InterleaveStatement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Validate that interleave statements are properly handled. > + +<COMPILE> + +<MODULE TTCN NegSyn_2004_InterleaveStatement_001 NegSyn_2004_InterleaveStatement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, Validate that interleave statements are properly handled. + ** @verdict pass reject + *****************************************************************/ + +module NegSyn_2004_InterleaveStatement_001 { + + type port loopbackPort message { + inout MyMessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort pt_myPort1,pt_myPort2; + } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + testcase TC_NegSyn_2004_InterleaveStatement_001() runs on GeneralComp { + + connect(self:pt_myPort1, self:pt_myPort1); + connect(self:pt_myPort2, self:pt_myPort2); + + pt_myPort1.send(MyMessageType:{1, "aaa", true}); + + template MyMessageType MySig1 := {1,"aaa",true}; + template MyMessageType MySig2 := {2,"bbb",true}; + template MyMessageType MySig3 := {3,"ccc",true}; + + timer t_timer; + t_timer.start(1.0); + + interleave { + [] pt_myPort1.receive(MySig1) + { + pt_myPort2.send(MySig2); + alt { + [] pt_myPort1.receive(MySig3) { + setverdict(pass); + } + [] t_timer.timeout { + setverdict(fail); + } + } + } + [] pt_myPort2.receive(MySig2) + { + pt_myPort1.send(MySig3); + } + [else] { + setverdict(pass); + } + } + + + } + + control{ + execute(TC_NegSyn_2004_InterleaveStatement_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `else': syntax error, unexpected ElseKeyword, expecting '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2004_InterleaveStatement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Validate that interleave statements are properly handled. > + +<COMPILE> + +<MODULE TTCN NegSyn_2004_InterleaveStatement_002 NegSyn_2004_InterleaveStatement_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:20.4, Validate that interleave statements are properly handled. + ** @verdict pass reject + *****************************************************************/ + +module NegSyn_2004_InterleaveStatement_002 { + + type port loopbackPort message { + inout MyMessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort pt_myPort1,pt_myPort2; + } + + type record MyMessageType { + integer field1, + charstring field2, + boolean field3 + } + + testcase TC_NegSyn_2004_InterleaveStatement_002() runs on GeneralComp { + + connect(self:pt_myPort1, self:pt_myPort1); + connect(self:pt_myPort2, self:pt_myPort2); + + pt_myPort1.send(MyMessageType:{1, "aaa", true}); + + template MyMessageType MySig1 := {1,"aaa",true}; + template MyMessageType MySig2 := {2,"bbb",true}; + template MyMessageType MySig3 := {3,"ccc",true}; + + timer t_timer; + t_timer.start(1.0); + var integer v:=1; + + interleave { + [v>0] pt_myPort1.receive(MySig1) //boolean guard must be empty + { + pt_myPort2.send(MySig2); + alt { + [] pt_myPort1.receive(MySig3) { + setverdict(pass); + } + [] t_timer.timeout { + setverdict(fail); + } + } + } + [v<0] pt_myPort2.receive(MySig2) //boolean guard must be empty + { + pt_myPort1.send(MySig3); + } + + } + + + } + + control{ + execute(TC_NegSyn_2004_InterleaveStatement_002()); + } +} +<END_MODULE> + +<RESULT COUNT 2> +error: at or before token `v': syntax error, unexpected Identifier, expecting '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200501_the_default_mechanism_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify unsuccessful default termination > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_200501_the_default_mechanism_001 NegSem_200501_the_default_mechanism_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.1, verify unsuccessful default termination + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For each test component the defaults, i.e. activated altsteps, are stored as an ordered +// list. The defaults are listed in the reversed order of their activation i.e. the last +// activated default is the first element in the list of active defaults. + +// The default mechanism is evoked at the end of each alt statement, if due to the +// actual snapshot none of the specified alternatives could be executed. An evoked +// default mechanism invokes the first altstep in the list of defaults, i.e. the last +// activated default, and waits for the result of its termination. The termination can +// be successful or unsuccessful. + +// In the case of an unsuccessful termination, the default mechanism invokes the next +// default in the list. If the last default in the list has terminated unsuccessfully, +// the default mechanism will return to the place in the alt statement in which it +// has been invoked, i.e. at the end of the alt statement, and indicate an unsuccessful +// default execution. An unsuccessful default execution will also be indicated if the list +// of defaults is empty. An unsuccessful default execution may cause a new snapshot or +// a dynamic error if the test component is blocked. + +module NegSem_200501_the_default_mechanism_001 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + altstep a1() runs on GeneralComp { + [] p.receive(integer:2) { // no match + setverdict(pass, "First default"); + } + } + + altstep a2() runs on GeneralComp { + [] p.receive(integer:1) { // no match + setverdict(fail, "Last default"); + } + } + + testcase TC_NegSem_200501_the_default_mechanism_001() runs on GeneralComp { + activate(a1()); + activate(a2()); + + connect(self:p, self:p); + + p.send(integer:5); + alt { + [] p.receive(integer:0) { // not expected: leads to default invocation + setverdict(fail); + } + } // defaults are terminated unsuccessfully -> dynamic test case error + } + + control{ + execute(TC_NegSem_200501_the_default_mechanism_001(), 1.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: None of the branches can be chosen in the alt statement in file NegSem_200501_the_default_mechanism_001.ttcn +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify error is generated if activated alstep runs on incompatible component > + +<COMPILE> + +<MODULE TTCN NegSem_200502_the_activate_operation_001 NegSem_200502_the_activate_operation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.2, verify error is generated if activated alstep runs on incompatible component + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// An activate operation will put the referenced altstep as the first element into the list +// of defaults and return a default reference. +// The effect of an activate operation is local to the test component in which it is called. + +module NegSem_200502_the_activate_operation_001 { + + type component GeneralComp { + } + + type port P message { + inout integer; + } with {extension "internal"} + + type component TestComp { + port P p; + } + + altstep a() runs on TestComp { + [] p.receive {} + } + + testcase TC_NegSem_200502_the_activate_operation_001() runs on GeneralComp { + activate(a()); + setverdict(pass); + } + + control{ + execute(TC_NegSem_200502_the_activate_operation_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Runs on clause mismatch: A definition that runs on component type `@NegSem_200502_the_activate_operation_001.GeneralComp' cannot activate altstep `@NegSem_200502_the_activate_operation_001.a', which runs on `@NegSem_200502_the_activate_operation_001.TestComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify error is generated when passing local timer > + +<COMPILE> + +<MODULE TTCN NegSem_200502_the_activate_operation_002 NegSem_200502_the_activate_operation_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.2, verify error is generated when passing local timer + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// All timer instances in the actual parameter list shall be declared as component type local timers. + +module NegSem_200502_the_activate_operation_002 { + + type component GeneralComp { + } + + altstep a(timer t_tmr) runs on GeneralComp { + [] t_tmr.timeout {} + } + + testcase TC_NegSem_200502_the_activate_operation_002() runs on GeneralComp { + if (true) { + timer t_local := 0.5; + t_local.start; + activate(a(t_local)); + } + any port.receive; + setverdict(pass); + } + + control{ + execute(TC_NegSem_200502_the_activate_operation_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Parameter #1 of altstep `@NegSem_200502_the_activate_operation_002.a' refers to timer `t_local', which is a local definition within a statement block and may have shorter lifespan than the activated default. Only references to variables and timers defined in the component type can be passed to activated defaults +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify error is generated when activating function > + +<COMPILE> + +<MODULE TTCN NegSem_200502_the_activate_operation_005 NegSem_200502_the_activate_operation_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.2, verify error is generated when activating function + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// An activate operation will put the referenced altstep as the first element into the list of defaults +// and return a default reference. + +module NegSem_200502_the_activate_operation_005 { + + type component GeneralComp { + } + + function f() runs on GeneralComp { + alt { + [] any port.receive {} + } + } + + testcase TC_NegSem_200502_the_activate_operation_005() runs on GeneralComp { + activate(f()); + setverdict(pass); + } + + control{ + execute(TC_NegSem_200502_the_activate_operation_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to an altstep was expected in the argument instead of function `@NegSem_200502_the_activate_operation_005.f' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - local timer as a parameter of activated altstep in module control > + +<COMPILE> + +<MODULE TTCN NegSem_200502_the_activate_operation_006 NegSem_200502_the_activate_operation_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.2, local timer as a parameter of activated altstep in module control + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For altsteps activated in module control or in functions or altsteps invoked +// directly or indirectly from module control, all timer instances in the actual +// parameter list shall be declared in the highest scope of the module control +// part (see clause 26.2). Timers from lower scopes of the module control part +// (i.e. from the nested statement blocks) are not allowed to occur in the actual +// parameter list. + +module NegSem_200502_the_activate_operation_006 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + altstep a(timer t_tmr) { + [] t_tmr.timeout { log ("Timeout in default"); } + } + + testcase TC_NegSem_200502_the_activate_operation_006() runs on GeneralComp { + setverdict(pass); + } + + function f_test() { + timer t_tmr := 1.0, t_tmr2; + t_tmr.start; + activate(a(t_tmr)); + alt { + [] t_tmr2.timeout { } + } + } + + control{ + f_test(); + execute(TC_NegSem_200502_the_activate_operation_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Parameter #1 of altstep `@NegSem_200502_the_activate_operation_006.a' refers to timer `t_tmr', which is a local definition within a statement block and may have shorter lifespan than the activated default. Only references to variables and timers defined in the component type can be passed to activated defaults +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - local timer (referenced through timer parameter) as a parameter of activated altstep in module control > + +<COMPILE> + +<MODULE TTCN NegSem_200502_the_activate_operation_007 NegSem_200502_the_activate_operation_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.2, local timer (referenced through timer parameter) as a parameter of activated altstep in module control + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For altsteps activated in module control or in functions or altsteps invoked +// directly or indirectly from module control, all timer instances in the actual +// parameter list shall be declared in the highest scope of the module control +// part (see clause 26.2). Timers from lower scopes of the module control part +// (i.e. from the nested statement blocks) are not allowed to occur in the actual +// parameter list. + +module NegSem_200502_the_activate_operation_007 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + altstep a(timer t_tmr) { + [] t_tmr.timeout { log ("Timeout in default"); } + } + + testcase TC_NegSem_200502_the_activate_operation_007() runs on GeneralComp { + setverdict(pass); + } + + function f_activate(timer t_tmr) { + activate(a(t_tmr)); + } + + function f_test() { + timer t_tmr := 1.0; + t_tmr.start; + f_activate(t_tmr); // t_tmr is a local timer, this should lead to an activation error in f_activate + } + + control{ + timer t_tmr2; + f_test(); + alt { + [] t_tmr2.timeout { } + } + execute(TC_NegSem_200502_the_activate_operation_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Parameter #1 of altstep `@NegSem_200502_the_activate_operation_007.a' refers to timer parameter `t_tmr', which may have shorter lifespan than the activated default. Only references to variables and timers defined in the component type can be passed to activated defaults +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200503_the_deactivate_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that deactivate uninitialized default causes error > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_200503_the_deactivate_operation_002 NegSem_200503_the_deactivate_operation_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.1, verify that deactivate uninitialized default causes error + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Calling a deactivate operation with an uninitialized default reference variable +// shall cause a runtime error. + +module NegSem_200503_the_deactivate_operation_002 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + altstep a1() runs on GeneralComp { + [] p.receive(integer:?) { + setverdict(pass); + } + } + + testcase TC_NegSem_200503_the_deactivate_operation_002() runs on GeneralComp { + var default v_default; + var boolean v_flag := false; + if (v_flag) { + v_default := activate(a1()); + } + + connect(self:p, self:p); + p.send(integer:1); + + deactivate(v_default); // uninitialized -> runtime error + + alt { + [] p.receive(integer:0) { // not expected: leads to default invocation + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_200503_the_deactivate_operation_002(), 1.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Performing a deactivate operation on an unbound default reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200503_the_deactivate_operation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - verify that error is generated when deactivated reference is on incorrect type > + +<COMPILE> + +<MODULE TTCN NegSem_200503_the_deactivate_operation_003 NegSem_200503_the_deactivate_operation_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:20.5.1, verify that error is generated when deactivated reference is on incorrect type + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// A deactivate operation will remove the referenced default from the list of defaults. + +module NegSem_200503_the_deactivate_operation_003 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + altstep a1() runs on GeneralComp { + [] p.receive(integer:?) { + setverdict(pass); + } + } + + testcase TC_NegSem_200503_the_deactivate_operation_003() runs on GeneralComp { + var GeneralComp v_ptc := null; + + connect(self:p, self:p); + p.send(integer:1); + + deactivate(v_ptc); // incorrect type -> error + + alt { + [] p.receive(integer:0) { // not expected: leads to default invocation + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_200503_the_deactivate_operation_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type default was expected +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/21_configuration_operations.script b/conformance_test/negative_tests/21_configuration_operations.script new file mode 100644 index 0000000000000000000000000000000000000000..f213b10efc045473ac7f3e76399dd0a4801d5cb3 --- /dev/null +++ b/conformance_test/negative_tests/21_configuration_operations.script @@ -0,0 +1,2478 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 21_configuration_operations folder. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 2101_connection_operations folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that connect operation cannot contain a system port > + +<COMPILE> + +<MODULE TTCN NegSem_1601_toplevel_001 NegSem_1601_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1, Verify that connect operation cannot contain a system port + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// In the case of connections between two test components, the connect operation shall be used. + +module NegSem_2101_TopLevel_001 { + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_210101_TopLevel_001() runs on GeneralComp system GeneralComp { + connect(self:p, system:p); // error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_TopLevel_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The `system' component reference shall not be used in `connect' operation +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that map operation fails if both operands are component ports > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_1601_toplevel_002 NegSem_1601_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1, Verify that map operation fails if both operands are component ports + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// When connecting a test component to a test system interface the map operation shall be used. + +module NegSem_2101_TopLevel_002 { + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_210101_TopLevel_002() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + map(self:p, v_ptc:p); // error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_TopLevel_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Both arguments of map operation refer to test component ports. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that connect operation rejects ports with incompatible message type lists > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_001 NegSem_210101_connect_and_map_operations_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Verify that connect operation rejects ports with incompatible message type lists + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// For the connect operations, only consistent connections are allowed. +// a) Assuming the following: +// 1) ports PORT1 and PORT2 are the ports to be connected; +// 2) inlist-PORT1 defines the messages or procedures of the in-direction of PORT1; +// 3) outlist-PORT1defines the messages or procedures of the out-direction of PORT1; +// 4) inlist-PORT2 defines the messages or procedures of the in-direction of PORT2; and +// 5) outlist-PORT2 defines the messages or procedures of the out-direction of PORT2. +// b) The connect operation is allowed if and only if: +// outlist-PORT1 ⊆ inlist-PORT2 and outlist-PORT2 ⊆ inlist-PORT1. +// +// In this test, inlists and outlists are completely incompatible + +module NegSem_210101_connect_and_map_operations_001 { + type record R { + integer field1, + charstring field2 + } + + type port P1 message { + inout integer; + in R; + } with {extension "internal"} + + type port P2 message { + out bitstring; + in boolean; + } with {extension "internal"} + + type component GeneralComp { + } + + type component C1 { + port P1 p; + } + + type component C2 { + port P2 p; + } + + testcase TC_NegSem_210101_connect_and_map_operations_001() runs on GeneralComp system GeneralComp { + var C1 v_ptc1 := C1.create; + var C2 v_ptc2 := C2.create; + connect(v_ptc1:p, v_ptc2:p); // incompatible message types: error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The connection between port types `@NegSem_210101_connect_and_map_operations_001.P1' and `@NegSem_210101_connect_and_map_operations_001.P2' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that connect operation rejects ports with only partially compatible message type lists > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_002 NegSem_210101_connect_and_map_operations_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Verify that connect operation rejects ports with only partially compatible message type lists + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// For the connect operations, only consistent connections are allowed. +// a) Assuming the following: +// 1) ports PORT1 and PORT2 are the ports to be connected; +// 2) inlist-PORT1 defines the messages or procedures of the in-direction of PORT1; +// 3) outlist-PORT1defines the messages or procedures of the out-direction of PORT1; +// 4) inlist-PORT2 defines the messages or procedures of the in-direction of PORT2; and +// 5) outlist-PORT2 defines the messages or procedures of the out-direction of PORT2. +// b) The connect operation is allowed if and only if: +// outlist-PORT1 ⊆ inlist-PORT2 and outlist-PORT2 ⊆ inlist-PORT1. +// +// In this test, one pair in outlist-PORT1 and inlist-PORT2 is incompatible (using +// strong typing rules) + +module NegSem_210101_connect_and_map_operations_002 { + type record R { + integer field1, + charstring field2 + } + + type record R2 { + integer field1, + charstring field2 + } + + type port P1 message { + inout integer; + out R; + } with {extension "internal"} + + type port P2 message { + in R2, integer; + out integer; + } with {extension "internal"} + + type component GeneralComp { + } + + type component C1 { + port P1 p; + } + + type component C2 { + port P2 p; + } + + testcase TC_NegSem_210101_connect_and_map_operations_002() runs on GeneralComp system GeneralComp { + var C1 v_ptc1 := C1.create; + var C2 v_ptc2 := C2.create; + // R2 and R are compatible types, but strong typing is required in case of connection operation + connect(v_ptc1:p, v_ptc2:p); // incompatible message types: error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The connection between port types `@NegSem_210101_connect_and_map_operations_002.P1' and `@NegSem_210101_connect_and_map_operations_002.P2' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that map operation rejects ports with incompatible message type lists > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_003 NegSem_210101_connect_and_map_operations_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Verify that map operation rejects ports with incompatible message type lists + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// For the connect operations, only consistent connections are allowed. +// a) Assuming the following: +// 1) ports PORT1 and PORT2 are the ports to be connected; +// 2) inlist-PORT1 defines the messages or procedures of the in-direction of PORT1; +// 3) outlist-PORT1defines the messages or procedures of the out-direction of PORT1; +// 4) inlist-PORT2 defines the messages or procedures of the in-direction of PORT2; and +// 5) outlist-PORT2 defines the messages or procedures of the out-direction of PORT2. +// c) The map operation (assuming PORT2 is the test system interface port) is allowed if +// and only if: +// outlist-PORT1 ⊆ outlist-PORT2 and inlist-PORT2 ⊆ inlist-PORT1. +// +// In this test, inlists and outlists are completely incompatible + +module NegSem_210101_connect_and_map_operations_003 { + type record R { + integer field1, + charstring field2 + } + + type port P1 message { + inout integer; + out R; + } with {extension "internal"} + + type port P2 message { + out boolean; + in bitstring; + } with {extension "internal"} + + type component GeneralComp { + port P1 p + } + + type component SystemComp { + port P2 p; + } + + testcase TC_NegSem_210101_connect_and_map_operations_003() runs on GeneralComp system SystemComp { + map(system:p, self:p); // incompatible message types: error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The mapping between system port type `@NegSem_210101_connect_and_map_operations_003.P2' and test component port type `@NegSem_210101_connect_and_map_operations_003.P1' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that connect operation rejects ports with only partially compatible message type lists > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_004 NegSem_210101_connect_and_map_operations_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Verify that connect operation rejects ports with only partially compatible message type lists + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// For the connect operations, only consistent connections are allowed. +// a) Assuming the following: +// 1) ports PORT1 and PORT2 are the ports to be connected; +// 2) inlist-PORT1 defines the messages or procedures of the in-direction of PORT1; +// 3) outlist-PORT1defines the messages or procedures of the out-direction of PORT1; +// 4) inlist-PORT2 defines the messages or procedures of the in-direction of PORT2; and +// 5) outlist-PORT2 defines the messages or procedures of the out-direction of PORT2. +// c) The map operation (assuming PORT2 is the test system interface port) is allowed if +// and only if: +// outlist-PORT1 ⊆ outlist-PORT2 and inlist-PORT2 ⊆ inlist-PORT1. +// +// In this test, one pair in outlist-PORT1 and inlist-PORT2 is incompatible (using +// strong typing rules) + +module NegSem_210101_connect_and_map_operations_004 { + type record R { + integer field1, + charstring field2 + } + + type record R2 { + integer field1, + charstring field2 + } + + type port P1 message { + in integer; + inout R; + } with {extension "internal"} + + type port P2 message { + in integer, R; + out R2; + } with {extension "internal"} + + type component GeneralComp { + port P1 p + } + + type component SystemComp { + port P2 p; + } + + testcase TC_NegSem_210101_connect_and_map_operations_004() runs on GeneralComp system SystemComp { + // R2 and R are compatible types, but strong typing is required in case of connection operation + map(system:p, self:p); // incompatible message types: error expected + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The mapping between system port type `@NegSem_210101_connect_and_map_operations_004.P2' and test component port type `@NegSem_210101_connect_and_map_operations_004.P1' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for local ports in connect operations > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_008 NegSem_210101_connect_and_map_operations_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, violation of strong typing rules for local ports in connect operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined in the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210101_connect_and_map_operations_008 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + function f_connect() runs on GeneralComp { + connect(self:p, self:p2); // although the actual instance of self contains the p2 port, + // it cannot be referenced as the "runs on" clause contains the GeneralComp type and + // not GeneralCompEx + } + + testcase TC_NegSem_210101_connect_and_map_operations_008() runs on GeneralCompEx system GeneralComp { + f_connect(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210101_connect_and_map_operations_008.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for PTC ports in connect operations > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_010 NegSem_210101_connect_and_map_operations_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, violation of strong typing rules for PTC ports in connect operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined in the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210101_connect_and_map_operations_010 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + testcase TC_NegSem_210101_connect_and_map_operations_010() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralCompEx.create; + connect(self:p, v_ptc:p2); // although the actual PTC instance contains the p2 port, + // it cannot be referenced as the variable v_ptc is of the GeneralComp type and + // not GeneralCompEx + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210101_connect_and_map_operations_010.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for PTC ports in map operations > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_and_map_operations_013 NegSem_210101_connect_and_map_operations_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, violation of strong typing rules for PTC ports in map operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined in the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210101_connect_and_map_operations_013 { + + type port P message { + inout integer; + //map param (integer p_par1); // map param not implemented + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + testcase TC_NegSem_210101_connect_and_map_operations_013() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralCompEx.create; + map(system:p, v_ptc:p2); // although the actual PTC instance contains the p2 port, + // it cannot be referenced as the variable v_ptc is of the GeneralComp type and + // not GeneralCompEx + setverdict(pass); + } + + control{ + execute(TC_NegSem_210101_connect_and_map_operations_013()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210101_connect_and_map_operations_013.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the the IUT does not allows two output port connection > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_operation_001 NegSem_210101_connect_operation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Ensure that the the IUT does not allows two output port connection + ** @verdict pass reject + ***************************************************/ +//Test the two output port cannot connect +module NegSem_210101_connect_operation_001{ + + type port myport message { + out integer + } with {extension "internal"} + + type component Mysystem + { + port myport messagePort; + } + + testcase TC_NegSem_210101_connect_operation_001() runs on Mysystem system Mysystem { + var Mysystem MyCompA; + var Mysystem MyCompB; + + MyCompA:=Mysystem.create; + MyCompB:=Mysystem.create; + + connect(MyCompA:messagePort, MyCompB:messagePort); //not allowed messageports are output + + } + + control{ + execute(TC_NegSem_210101_connect_operation_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: The connection between port types `@NegSem_210101_connect_operation_001.myport' and `@NegSem_210101_connect_operation_001.myport' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that IUT cannot map input port with output port > + +<COMPILE> + +<MODULE TTCN NegSem_210101_connect_operation_001 NegSem_210101_connect_operation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.1, Ensure that IUT cannot map input port with output port + ** @verdict pass reject + ***************************************************/ + +// Mycompport A P1 is output port mapped to SUT in port +module NegSem_210101_map_operation_002{ + + type port loopbackPort message { + in integer + } with {extension "internal"} + + type port IntegerOutputPortType message { + out integer + } with {extension "internal"} + + type component GeneralComp + { + port IntegerOutputPortType MycomportA + } + + type component MyTestSystemInterface + { + port loopbackPort messagePort + } + + // MyTestSystemInterface is the test system interface + testcase TC_NegSem_210101_map_operation_002() runs on GeneralComp system MyTestSystemInterface { + + // establishing the port connections + map(mtc:MycomportA, system:messagePort); + //not allowed: MycomportA is out port, meanwhile MySysteminterface port is input + + setverdict(fail); + + } + + control{ + execute(TC_NegSem_210101_map_operation_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The mapping between test component port type `@NegSem_210101_map_operation_002.IntegerOutputPortType' and system port type `@NegSem_210101_map_operation_002.loopbackPort' is not consistent +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that unmap operation cannot contain a system port reference > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210102_disconnect_and_unmap_operations_001 NegSem_210102_disconnect_and_unmap_operations_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.2, Verify that unmap operation cannot contain a system port reference + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// The disconnect and unmap operations are the opposite operations of connect and map. +// (21.1) The ports of a test component can be connected to other components or to the +// ports of the test system interface. When connecting a test component to a test system +// interface the map operation shall be used. + +module NegSem_210102_disconnect_and_unmap_operations_001 { + + type port P message { + inout integer + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_210102_disconnect_and_unmap_operations_001() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + + connect(self:p, v_ptc:p); + unmap(self:p, v_ptc:p); // no system port reference: error expected + } + + control{ + execute(TC_NegSem_210102_disconnect_and_unmap_operations_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Both arguments of unmap operation refer to test component ports. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for local ports in disconnect operations > + +<COMPILE> + +<MODULE TTCN NegSem_210102_disconnect_and_unmap_operations_008 NegSem_210102_disconnect_and_unmap_operations_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.2, violation of strong typing rules for local ports in disconnect operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210102_disconnect_and_unmap_operations_008 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + function f_disconnect() runs on GeneralComp { + disconnect(self:p, self:p2); // although the actual instance of self contains the p2 port, + // it cannot be referenced as the "runs on" clause contains the GeneralComp type and + // not GeneralCompEx + } + + testcase TC_NegSem_210102_disconnect_and_unmap_operations_008() runs on GeneralCompEx system GeneralComp { + connect(self:p, self:p2); + f_disconnect(); + setverdict(pass); + } + + control{ + execute(TC_NegSem_210102_disconnect_and_unmap_operations_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_008.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for PTC ports in disconnect operations > + +<COMPILE> + +<MODULE TTCN NegSem_210102_disconnect_and_unmap_operations_010 NegSem_210102_disconnect_and_unmap_operations_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.2, violation of strong typing rules for PTC ports in disconnect operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210102_disconnect_and_unmap_operations_010 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + testcase TC_NegSem_210102_disconnect_and_unmap_operations_010() runs on GeneralComp system GeneralComp { + var GeneralCompEx v_ptc := GeneralCompEx.create; + var GeneralComp v_ptcAlias := v_ptc; + connect(self:p, v_ptc:p2); + disconnect(self:p, v_ptcAlias:p2);// although the actual PTC instance contains the p2 port, + // it cannot be referenced as the variable v_ptc is of the GeneralComp type and + // not GeneralCompEx + setverdict(pass); + } + + control{ + execute(TC_NegSem_210102_disconnect_and_unmap_operations_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_010.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - violation of strong typing rules for PTC ports in disconnect operations > + +<COMPILE> + +<MODULE TTCN NegSem_210102_disconnect_and_unmap_operations_013 NegSem_210102_disconnect_and_unmap_operations_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.2, violation of strong typing rules for PTC ports in unmap operations + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// If the type of the component referenced in a connection operation is known (either +// when the component reference is a variable or value returned from a function or the +// type is defined the runs on, mtc or system clause of the calling function), the +// referenced port declaration shall be present in this component type. + +module NegSem_210102_disconnect_and_unmap_operations_013 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type component GeneralCompEx extends GeneralComp { + port P p2; + } + + testcase TC_NegSem_210102_disconnect_and_unmap_operations_013() runs on GeneralComp system GeneralComp { + var GeneralCompEx v_ptc := GeneralCompEx.create; + var GeneralComp v_ptcAlias := v_ptc; + map(system:p, v_ptc:p2); + unmap(system:p, v_ptcAlias:p2);// although the actual PTC instance contains the p2 port, + // it cannot be referenced as the variable v_ptc is of the GeneralComp type and + // not GeneralCompEx + setverdict(pass); + } + + control{ + execute(TC_NegSem_210102_disconnect_and_unmap_operations_013()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_013.GeneralComp' does not have port with name `p2' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that mapped port cannot disconnect > + +<COMPILE> + +<MODULE TTCN NegSem_210102_disconnect_operation_001 NegSem_210102_disconnect_operation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.1.2, Ensure that mapped port cannot disconnect + ** @verdict pass reject + ***************************************************/ +// System and component interface cannot disconnect +module NegSem_210102_disconnect_operation_001{ + + type port myport message { + inout integer + } with {extension "internal"} + + type component Mysystem + { + port myport messagePort; + } + + function f() runs on Mysystem {} + + testcase TC_NegSem_210102_disconnect_operation_001() runs on Mysystem system Mysystem { + var Mysystem MyCompA; + + MyCompA:=Mysystem.create; + + map(MyCompA:messagePort,system:messagePort); + + MyCompA.start(f()); + + disconnect(MyCompA:messagePort,system:messagePort); // system interface cannot disconnect + + } + control{ + execute(TC_NegSem_210102_disconnect_operation_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> + error: The `system' component reference shall not be used in `disconnect' operation +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 2102_test_case_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_2102_testcase_stop_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Stopping test case > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2102_testcase_stop_001 NegSem_2102_testcase_stop_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.2, Stopping test case + ** @verdict pass reject + ***************************************************/ +// Explicit test case termination test +module NegSem_2102_testcase_stop_001 { + type component GeneralComp {} + + testcase TC_NegSem_2102_testcase_stop_001() runs on GeneralComp { + var boolean v_b := true; + + setverdict(pass, "Unexpected termination with verdict pass"); + + testcase.stop("Expected Termination with verdict error"); + // stop runing test case now with verdict error + } + + control { + execute(TC_NegSem_2102_testcase_stop_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: testcase.stop +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 2103_test_component_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that named components on hosts are accepted > + +<COMPILE> + +<MODULE TTCN NegSem_210301_CreateOperation_001 NegSem_210301_CreateOperation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.1, Ensure that named components on hosts are accepted + ** @verdict pass reject + *****************************************************************/ +module NegSem_210301_CreateOperation_001 { + + type component GeneralComp { } + + testcase TC_NegSem_210301_CreateOperation_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create(5); // it should expect charstring + setverdict(pass); + } + + control { + execute(TC_NegSem_210301_CreateOperation_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: First operand of operation `create\(\)' should be charstring value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that named components on hosts are accepted > + +<COMPILE> + +<MODULE TTCN NegSem_210301_CreateOperation_002 NegSem_210301_CreateOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.1, Ensure that named components on hosts are accepted + ** @verdict pass reject + *****************************************************************/ +module NegSem_210301_CreateOperation_002 { + + type component GeneralComp { } + + testcase TC_NegSem_210301_CreateOperation_002() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create(true); // it should expect charstring + setverdict(pass); + } + + control { + execute(TC_NegSem_210301_CreateOperation_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: First operand of operation `create\(\)' should be charstring value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that named components on hosts are accepted > + +<COMPILE> + +<MODULE TTCN NegSem_210301_CreateOperation_003 NegSem_210301_CreateOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.1, Ensure that named components on hosts are accepted + ** @verdict pass reject + *****************************************************************/ +module NegSem_210301_CreateOperation_003 { + + type component GeneralComp { } + + testcase TC_NegSem_210301_CreateOperation_003() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create(-, 'CAFFEE'O); // it should expect charstring + setverdict(pass); + } + + control { + execute(TC_NegSem_210301_CreateOperation_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Second operand of operation `create\(\)' should be charstring value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that non-alive ptc cannot start again > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210302_Start_test_component_001 NegSem_210302_Start_test_component_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, Ensure that non-alive ptc cannot start again + ** @verdict pass reject + *****************************************************************/ +//Non alive test component cannot start another function behavior +module NegSem_210302_Start_test_component_001 { + + type component GeneralComp { } + function f() runs on GeneralComp {} + function f2() runs on GeneralComp {} + + testcase TC_NegSem_210302_Start_test_component_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc; + ptc:=GeneralComp.create; + + ptc.start(f()); + ptc.done; + ptc.start(f2()); // test case error, ptc is non-alive + + setverdict(pass); + } + + control { + execute(TC_NegSem_210302_Start_test_component_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that only component type is allowed for ptc declaration > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_002 NegSem_210302_Start_test_component_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, Ensure that only component type is allowed for ptc declaration + ** @verdict pass reject + *****************************************************************/ +// VariableRef (being a component type variable, a component type parameter +module NegSem_210302_Start_test_component_002 { + + type component GeneralComp { } + + type record Rectype{} + + function f() runs on GeneralComp {} + + testcase TC_NegSem_210302_Start_test_component_002() runs on GeneralComp system GeneralComp { + var Rectype ptc; + ptc:= GeneralComp.create; + // VariableRef (being a component type variable, a component type parameter + + ptc.start(f()); + + setverdict(pass); + } + + control { + execute(TC_NegSem_210302_Start_test_component_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210302_Start_test_component_002.Rectype' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that only component type is allowed for ptc declaration > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_003 NegSem_210302_Start_test_component_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, altstep in test component start operation + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// The start operation shall bind the required behaviour to the test component. This +// behaviour is defined by reference to an already defined function. + +module NegSem_210302_Start_test_component_003 { + + type port P message { + inout integer; + } + + type component GeneralComp { + port P p; + } + + altstep a_test() runs on GeneralComp { + [] p.receive(integer:?) { + setverdict(pass); + } + } + + testcase TC_NegSem_210302_Start_test_component_003() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + connect(self:p, v_ptc:p); + p.send(1); + v_ptc.start(a_test()); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a function was expected in the argument instead of altstep `@NegSem_210302_Start_test_component_003.a_test' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - starting behaviour on already running non-alive component > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210302_Start_test_component_004 NegSem_210302_Start_test_component_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, starting behaviour on already running non-alive component + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Starting a second behaviour function on a non-alive PTC or starting a function +// on a PTC that is still running results in a test case error. + +module NegSem_210302_Start_test_component_004 { + + type component GeneralComp { + } + + function f_ptcBehaviour() runs on GeneralComp { + timer t_tmr := 10.0; + t_tmr.start; + t_tmr.timeout; + } + + testcase TC_NegSem_210302_Start_test_component_004() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC") alive; + v_ptc.start(f_ptcBehaviour()); + v_ptc.start(f_ptcBehaviour()); + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Error message was received from MC: PTC with component reference 3 cannot be started because it is already executing function NegSem_210302_Start_test_component_004.f_ptcBehaviour. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - starting behaviour on already running non-alive component > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210302_Start_test_component_005 NegSem_210302_Start_test_component_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, starting behaviour on already running non-alive component + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Starting a second behaviour function on a non-alive PTC or starting a function +// on a PTC that is still running results in a test case error. + +module NegSem_210302_Start_test_component_005 { + + type component GeneralComp { + } + + function f_ptcBehaviour() runs on GeneralComp { + timer t_tmr := 10.0; + t_tmr.start; + t_tmr.timeout; + } + + testcase TC_NegSem_210302_Start_test_component_005() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + v_ptc.start(f_ptcBehaviour()); + v_ptc.start(f_ptcBehaviour()); + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Error message was received from MC: PTC with component reference 3 cannot be started because it is already executing function NegSem_210302_Start_test_component_005.f_ptcBehaviour. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - function invocation in the start operation doesn't return a component > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_006 NegSem_210302_Start_test_component_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, function invocation in the start operation doesn't return a component + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// The variable associated with VariableRef (being a component type variable, +// a component type parameter, etc.) or the return type associated with +// FunctionInstance shall be of component type. + +module NegSem_210302_Start_test_component_006 { + + type component GeneralComp { + } + + type record R { + GeneralComp comp + } + + function f_create() return R { + var R v_rec := { GeneralComp.create("PTC") } + return v_rec; + } + + function f_ptcBehaviour() runs on GeneralComp { + } + + testcase TC_NegSem_210302_Start_test_component_006() runs on GeneralComp system GeneralComp { + f_create().start(f_ptcBehaviour()); + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_006()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210302_Start_test_component_006.R' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - starting function with incompatible "runs on" clause > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_007 NegSem_210302_Start_test_component_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, starting function with incompatible "runs on" clause + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// The function invoked in a start test component operation shall have a runs on +// definition referencing a component type that is compatible with the newly +// created component (see clause 6.3.3). + +module NegSem_210302_Start_test_component_007 { + + type component GeneralComp { + var charstring vc_str := "abc"; + } + + type component DifferentComp { + var integer vc_int := 0; + } + + + function f_ptcBehaviour() runs on DifferentComp { + setverdict(pass, "Executing PTC behaviour..."); + } + + testcase TC_NegSem_210302_Start_test_component_007() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC") alive; + v_ptc.start(f_ptcBehaviour()); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_007()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component type mismatch: The component reference is of type `@NegSem_210302_Start_test_component_007.GeneralComp', but function `@NegSem_210302_Start_test_component_007.f_ptcBehaviour' runs on `@NegSem_210302_Start_test_component_007.DifferentComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - passing port to started component function > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_008 NegSem_210302_Start_test_component_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, passing port to started component function + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Ports, defaults and timers shall not be passed into a function invoked in a start +// test component operation. + +module NegSem_210302_Start_test_component_008 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f_behaviour(P p_port) runs on GeneralComp { + p_port.receive(integer:?); + setverdict(pass); + } + + testcase TC_NegSem_210302_Start_test_component_008() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + connect(self:p, self:p); + p.send(1); + v_ptc.start(f_behaviour(p)); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_008()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Function `@NegSem_210302_Start_test_component_008.f_behaviour' cannot be started on a parallel test component because it has port parameter `p_port' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - passing default to started component function > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_009 NegSem_210302_Start_test_component_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, passing default to started component function + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Ports, defaults and timers shall not be passed into a function invoked in a start +// test component operation. + +module NegSem_210302_Start_test_component_009 { + + type component GeneralComp { + } + + function f_behaviour(default p_default) runs on GeneralComp { + setverdict(pass); + } + + altstep a_timeout() { + [] any timer.timeout { } + } + + testcase TC_NegSem_210302_Start_test_component_009() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + var default v_def := activate(a_timeout()); + v_ptc.start(f_behaviour(v_def)); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_009()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Default type cannot be a parameter or embedded in a parameter of a function used in a start operation. Function `@NegSem_210302_Start_test_component_009.f_behaviour' cannot be started on a parallel test component because of `value parameter `p_default'' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - passing timer to started component function > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_010 NegSem_210302_Start_test_component_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, passing timer to started component function + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// Ports, defaults and timers shall not be passed into a function invoked in a start +// test component operation. + +module NegSem_210302_Start_test_component_010 { + + type component GeneralComp { + } + + function f_behaviour(timer t_tmr) runs on GeneralComp { + t_tmr.timeout; + setverdict(pass); + } + + testcase TC_NegSem_210302_Start_test_component_010() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + timer t_tmr := 0.0; + t_tmr.start; + v_ptc.start(f_behaviour(t_tmr)); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_010()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Function `@NegSem_210302_Start_test_component_010.f_behaviour' cannot be started on a parallel test component because it has timer parameter `t_tmr' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - passing structured value containing ports to started component function > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_011 NegSem_210302_Start_test_component_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, passing structured value containing ports to started component function + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// All formal parameter types of the function shall neither be of port or default type +// or should contain a direct or indirect element or field of port or default type. + +module NegSem_210302_Start_test_component_011 { + + type port P message { + inout integer; + } + + type P PortArray[2]; + + type component GeneralComp { + port P p[2]; + } + + function f_behaviour(PortArray p_ports) runs on GeneralComp { + p_ports[0].receive(integer:?); + setverdict(pass); + } + + testcase TC_NegSem_210302_Start_test_component_011() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + connect(self:p[0], self:p[0]); + p[0].send(1); + v_ptc.start(f_behaviour(p)); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_011()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Port type `@NegSem_210302_Start_test_component_011.P' cannot be a parameter or embedded in a parameter of a function used in a start operation. Function `@NegSem_210302_Start_test_component_011.f_behaviour' cannot be started on a parallel test component because of `value parameter `p_ports'' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - passing structured value containing ports to started component function > + +<COMPILE> + +<MODULE TTCN NegSem_210302_Start_test_component_012 NegSem_210302_Start_test_component_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.2, passing default to started component function + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// All formal parameter types of the function shall neither be of port or default type +// or should contain a direct or indirect element or field of port or default type. + +module NegSem_210302_Start_test_component_012 { + + type record R { + default def + } + + type component GeneralComp { + } + + function f_behaviour(R p_def) runs on GeneralComp { + setverdict(pass); + } + + altstep a_timeout() { + [] any timer.timeout { } + } + + testcase TC_NegSem_210302_Start_test_component_012() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + var R v_def := { def := activate(a_timeout()) }; + v_ptc.start(f_behaviour(v_def)); + v_ptc.done; + setverdict(pass); + } + + control{ + execute(TC_NegSem_210302_Start_test_component_012()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Default type cannot be a parameter or embedded in a parameter of a function used in a start operation. Function `@NegSem_210302_Start_test_component_012.f_behaviour' cannot be started on a parallel test component because of `value parameter `p_def'' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - restarting explicitly stopped non-alive component > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210303_Stop_test_component_001 NegSem_210303_Stop_test_component_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.3, restarting explicitly stopped non-alive component + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Stopping a non-alive-type test component (implicitly or explicitly) shall destroy +// it and all resources associated with the test component shall be released. + +module NegSem_210303_Stop_test_component_001 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + p.receive(integer:?); + } + + testcase TC_NegSem_210303_Stop_test_component_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create; + ptc.start(f()); + ptc.stop; + ptc.start(f()); + setverdict(pass); + } + + control { + execute(TC_NegSem_210303_Stop_test_component_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Error message was received from MC: PTC with component reference 3 cannot be started because it is not alive anymore. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - stopping all PTCs from a PTC > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210303_Stop_test_component_002 NegSem_210303_Stop_test_component_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.3, stopping all PTCs from a PTC + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The all keyword can be used by the MTC only in order to stop all running PTCs but +// the MTC itself. + +module NegSem_210303_Stop_test_component_002 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + all component.stop; + } + + testcase TC_NegSem_210303_Stop_test_component_002() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create; + ptc.start(f()); + ptc.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_210303_Stop_test_component_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Operation 'all component.stop' can only be performed on the MTC. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - applying stop operation to a variable of a different than component type > + +<COMPILE> + +<MODULE TTCN NegSem_210303_Stop_test_component_003 NegSem_210303_Stop_test_component_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.3, applying stop operation to a variable of a different than component type + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The variable associated with VariableRef (being a component type variable, a component +// type parameter, etc.) or the return type associated with FunctionInstance shall be of +// component type. + +module NegSem_210303_Stop_test_component_003 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f_behaviour() runs on GeneralComp { + p.receive(integer:?); // infinite blocking + } + + testcase TC_NegSem_210303_Stop_test_component_003() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc[2]; + v_ptc[0] := GeneralComp.create; + v_ptc[1] := GeneralComp.create; + v_ptc[0].start(f_behaviour()); + v_ptc[1].start(f_behaviour()); + v_ptc.stop; + setverdict(pass); + } + + control { + execute(TC_NegSem_210303_Stop_test_component_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210303_Stop_test_component_003.GeneralComp\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - applying stop operation to a variable of a different than component type > + +<COMPILE> + +<MODULE TTCN NegSem_210303_Stop_test_component_004 NegSem_210303_Stop_test_component_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.3, applying stop operation to a function call result of a different than component type + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The variable associated with VariableRef (being a component type variable, a component +// type parameter, etc.) or the return type associated with FunctionInstance shall be of +// component type. + +module NegSem_210303_Stop_test_component_004 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type GeneralComp CompArray[2]; + + function f_behaviour() runs on GeneralComp { + p.receive(integer:?); // infinite blocking + } + + function f_createComponents() return CompArray { + var CompArray v_ptc; + v_ptc[0] := GeneralComp.create; + v_ptc[1] := GeneralComp.create; + v_ptc[0].start(f_behaviour()); + v_ptc[1].start(f_behaviour()); + return v_ptc; + } + + testcase TC_NegSem_210303_Stop_test_component_004() runs on GeneralComp system GeneralComp { + f_createComponents().stop; + setverdict(pass); + } + + control { + execute(TC_NegSem_210303_Stop_test_component_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210303_Stop_test_component_004.GeneralComp\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - restarting explicitly killed non-alive component > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210304_kill_test_component_001 NegSem_210304_kill_test_component_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.4, restarting explicitly killed non-alive component + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The kill operation applied on a test component stops the execution of the currently +// running behaviour - if any - of that component and frees all resources associated +// to it (including all port connections of the killed component) and removes the +// component from the test system. + +module NegSem_210304_kill_test_component_001 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + p.receive(integer:?); + } + + testcase TC_NegSem_210304_kill_test_component_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create; + ptc.start(f()); + ptc.kill; + ptc.start(f()); + setverdict(pass); + } + + control { + execute(TC_NegSem_210304_kill_test_component_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - restarting explicitly killed alive component > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210304_kill_test_component_002 NegSem_210304_kill_test_component_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.3, restarting explicitly killed alive component + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The kill operation applied on a test component stops the execution of the currently +// running behaviour - if any - of that component and frees all resources associated +// to it (including all port connections of the killed component) and removes the +// component from the test system. + +module NegSem_210304_kill_test_component_002 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + p.receive(integer:?); + } + + testcase TC_NegSem_210304_kill_test_component_002() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create alive; + ptc.start(f()); + ptc.kill; + ptc.start(f()); + setverdict(pass); + } + + control { + execute(TC_NegSem_210304_kill_test_component_002()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - killing all PTCs from a PTC > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_210304_kill_test_component_003 NegSem_210304_kill_test_component_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.4, killing all PTCs from a PTC + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The all keyword can be used by the MTC only in order to stop and kill all running PTCs +// but the MTC itself. + +module NegSem_210304_kill_test_component_003 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + all component.kill; + } + + testcase TC_NegSem_210304_kill_test_component_003() runs on GeneralComp system GeneralComp { + var GeneralComp ptc := GeneralComp.create; + ptc.start(f()); + ptc.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_210304_kill_test_component_003()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Operation 'all component.kill' can only be performed on the MTC. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - applying kill operation to a variable of a different than component type > + +<COMPILE> + +<MODULE TTCN NegSem_210304_kill_test_component_004 NegSem_210304_kill_test_component_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.4, applying kill operation to a variable of a different than component type + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The variable associated with VariableRef (being a component type variable, a component +// type parameter, etc.) or the return type associated with FunctionInstance shall be of +// component type. + +module NegSem_210304_kill_test_component_004 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f_behaviour() runs on GeneralComp { + p.receive(integer:?); // infinite blocking + } + + testcase TC_NegSem_210304_kill_test_component_004() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc[2]; + v_ptc[0] := GeneralComp.create; + v_ptc[1] := GeneralComp.create; + v_ptc[0].start(f_behaviour()); + v_ptc[1].start(f_behaviour()); + v_ptc.kill; + setverdict(pass); + } + + control { + execute(TC_NegSem_210304_kill_test_component_004()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210304_kill_test_component_004.GeneralComp\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - applying kill operation to a function call result of a different than component type > + +<COMPILE> + +<MODULE TTCN NegSem_210304_kill_test_component_005 NegSem_210304_kill_test_component_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.4, applying kill operation to a function call result of a different than component type + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The variable associated with VariableRef (being a component type variable, a component +// type parameter, etc.) or the return type associated with FunctionInstance shall be of +// component type. + +module NegSem_210304_kill_test_component_005 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + type GeneralComp CompArray[2]; + + function f_behaviour() runs on GeneralComp { + p.receive(integer:?); // infinite blocking + } + + function f_createComponents() return CompArray { + var CompArray v_ptc; + v_ptc[0] := GeneralComp.create; + v_ptc[1] := GeneralComp.create; + v_ptc[0].start(f_behaviour()); + v_ptc[1].start(f_behaviour()); + return v_ptc; + } + + testcase TC_NegSem_210304_kill_test_component_005() runs on GeneralComp system GeneralComp { + f_createComponents().kill; + setverdict(pass); + } + + control { + execute(TC_NegSem_210304_kill_test_component_005()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210304_kill_test_component_005.GeneralComp\[2\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210307_done_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that done operator can be used only for ptcs. > + +<COMPILE> + +<MODULE TTCN NegSem_210307_done_operation_001 NegSem_210307_done_operation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.7, Ensure that done operator can be used only for ptcs. + ** @verdict pass reject + *****************************************************************/ +// Done operator can be used only for ptcs, not for mtcs. + +module NegSem_210307_done_operation_001 { + + type component GeneralComp {} + function f1 ( ) runs on GeneralComp {} + + testcase TC_NegSem_210307_done_operation_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc; + var GeneralComp ptc2; + ptc:=GeneralComp.create alive; + ptc2:=GeneralComp.create alive; + + ptc.start(f1()); + + GeneralComp.done; // not allowed. Done only allowed for ptcs. + + } + + control { + execute(TC_NegSem_210307_done_operation_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of type `@NegSem_210307_done_operation_001.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210308_killed_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that killed operator is only valid for ptcs. > + +<COMPILE> + +<MODULE TTCN NegSem_210308_killed_operation_001 NegSem_210308_killed_operation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:21.3.8, Ensure that killed operator is only valid for ptcs. + ** @verdict pass reject + *****************************************************************/ +// killed operator is not allowed for mtc check. + +module NegSem_210308_killed_operation_001 { + + type component GeneralComp {} + function f1 ( ) runs on GeneralComp {} + + testcase TC_NegSem_210308_killed_operation_001() runs on GeneralComp system GeneralComp { + var GeneralComp ptc; + var GeneralComp ptc2; + ptc:=GeneralComp.create alive; + ptc2:=GeneralComp.create alive; + + ptc.start(f1()); + + mtc.killed; // not allowed. killed only allowed for ptcs. + + alt { + [] any component.killed {setverdict(pass);} + } + } + + control { + execute(TC_NegSem_210308_killed_operation_001()); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `killed': syntax error, unexpected DotKilledKeyword, expecting DotKillKeyword +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. + diff --git a/conformance_test/negative_tests/22_communication_operations.script b/conformance_test/negative_tests/22_communication_operations.script new file mode 100644 index 0000000000000000000000000000000000000000..8879176af2a8a788558170f35acff9133ddd5ea1 --- /dev/null +++ b/conformance_test/negative_tests/22_communication_operations.script @@ -0,0 +1,3726 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 22_communication_operations folder. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 2202_message_based_communication folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message sending operations > + +<COMPILE> + +<MODULE TTCN NegSem_220201_SendOperation_001 NegSem_220201_SendOperation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, Ensure that the IUT correctly handles message sending operations + ** @verdict pass reject + ***************************************************/ + +module NegSem_220201_SendOperation_001 { + + type enumerated EnumeratedType {e_black, e_white}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type set SetType { + integer a optional, + integer b optional, + boolean c + } + + type record length (1..2) of integer IntegerList; + + type set length (1..2) of integer IntegerUList; + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2, + boolean field3, + integer field4[4], + EnumeratedType field5, + RecordType field6, + SetType field7, + UnionType field8, + IntegerList field9, + IntegerUList field10 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220201_SendOperation_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := 1, + field2 := "test string", + field3 := true, + field4 := {1,2,3,4}, + field5 := e_black, + field6 := {a:=1,b:=2,c:=true}, + field7 := {a:=1,b:=2,c:=true}, + field8 := {a:=1}, + field9 := {1}, + field10 := {1,2} + } + + template MessageType mw_sendingTemplate:= + { + field1 := 1, + field2 := "test string", + field3 := true, + field4 := {1,2,3,4}, + field5 := e_black, + field6 := {a:=*,b:=2,c:=true}, + field7 := {a:=1,b:=*,c:=true}, + field8 := {a:=1}, + field9 := {1}, + field10 := {1,2} + } + + connect(self:messagePort, self:messagePort); + + messagePort.send(mw_sendingTemplate); //can only send specific values + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220201_SendOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: A specific value was expected instead of any or omit +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message sending operations > + +<COMPILE> + +<MODULE TTCN NegSem_220201_SendOperation_002 NegSem_220201_SendOperation_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, Ensure that the IUT correctly handles message sending operations + ** @verdict pass reject + ***************************************************/ + +module NegSem_220201_SendOperation_002 { + + type enumerated EnumeratedType {e_black, e_white}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type set SetType { + integer a optional, + integer b optional, + boolean c + } + + type record length (1..2) of integer IntegerList; + + type set length (1..2) of integer IntegerUList; + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2, + boolean field3, + integer field4[4], + EnumeratedType field5, + RecordType field6, + SetType field7, + UnionType field8, + IntegerList field9, + IntegerUList field10 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220201_SendOperation_002() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := 1, + field2 := "test string", + field3 := true, + field4 := {1,2,3,4}, + field5 := e_black, + field6 := {a:=1,b:=2,c:=true}, + field7 := {a:=1,b:=2,c:=true}, + field8 := {a:=1}, + field9 := {1}, + field10 := {1,2} + } + + template MessageType mw_sendingTemplate:= + { + field1 := 1, + field2 := "test string", + field3 := true, + field4 := {1,2,3,4}, + field5 := e_black, + field6 := {a:=?,b:=2,c:=true}, + field7 := {a:=1,b:=?,c:=true}, + field8 := {a:=1}, + field9 := {1}, + field10 := {1,2} + } + + connect(self:messagePort, self:messagePort); + + messagePort.send(mw_sendingTemplate); //can only send specific values + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220201_SendOperation_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: A specific value was expected instead of any value +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message sending operations > + +<COMPILE> + +<MODULE TTCN NegSem_220201_SendOperation_003 NegSem_220201_SendOperation_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, Ensure that the IUT correctly handles message sending operations + ** @verdict pass reject + ***************************************************/ + +module NegSem_220201_SendOperation_003 { + + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220201_SendOperation_003() runs on GeneralComp { + + connect(self:messagePort, self:messagePort); + + messagePort.send(float:2.0); //sent type does not match port specification + + alt { + [] messagePort.receive(2) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220201_SendOperation_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Incompatible explicit type specification: `integer' was expected instead of `float' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message sending operations > + +<COMPILE> + +<MODULE TTCN NegSem_220201_SendOperation_004 NegSem_220201_SendOperation_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, Ensure that the IUT correctly handles message sending operations + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220201_SendOperation_004 { + +signature p_NegSem_220201_SendOperation_004(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + /*template p_NegSem_220201_SendOperation_004 s_baseTemplate := { + p_par1 := -, + p_par2 := 4, + p_par3 := ? + } + + template p_NegSem_220201_SendOperation_004 s_returnTemplate modifies s_baseTemplate := { + p_par3 := 5 + } + + template p_NegSem_220201_SendOperation_004 s_wrongTemplate modifies s_baseTemplate := { + p_par3 := 3 + }*/ + + template p_NegSem_220201_SendOperation_004 s_callTemplate := { + p_par1 := 1, + p_par2 := -, + p_par3 := 3 + } + + type port remotePort procedure { + out p_NegSem_220201_SendOperation_004; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + testcase NegSem_220201_SendOperation_004() runs on GeneralComp { + + //connect(self:PCO,self:PCO); + + PCO.send(p_NegSem_220201_SendOperation_004:s_callTemplate); + + //cannot use send operation on a procedure based port + /*PCO.send(p_NegSem_220201_SendOperation_004:s_callTemplate, 5.0) { + [] PCO.getreply(p_NegSem_220201_SendOperation_004:s_wrongTemplate value 1) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220201_SendOperation_004:s_returnTemplate value 2) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220201_SendOperation_004:s_returnTemplate value 1) { + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + }*/ + } + + control{ + execute(NegSem_220201_SendOperation_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Message-based operation `send' is not applicable to a procedure-based port of type `@NegSem_220201_SendOperation_004.remotePort' +<END_RESULT> +<RESULT COUNT 1> +error: The type of send parameter is signature `@NegSem_220201_SendOperation_004.p_NegSem_220201_SendOperation_004', which cannot be a message type +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - missing to clause in case of one-to-many connections > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220201_SendOperation_005 NegSem_220201_SendOperation_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, missing to clause in case of one-to-many connections + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Unicast, multicast and broadcast communication can be determined by the optional to clause +// in the send operation. A to clause can be omitted in case of a one-to-one connection where +// unicast communication is used and the message receiver is uniquely determined by the test +// system structure. +// A to clause shall be present in case of one-to-many connections. + +module NegSem_220201_SendOperation_005 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f(integer p_expected) runs on GeneralComp + { + alt { + [] p.receive(p_expected) { setverdict(pass); } + [] p.receive { setverdict(fail); } + } + } + + const integer c_ptcCount := 2; + + testcase TC_NegSem_220201_SendOperation_005() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptcs[c_ptcCount]; + + for (var integer i := 0; i < c_ptcCount; i := i + 1) { + v_ptcs[i] := GeneralComp.create; + connect(self:p, v_ptcs[i]:p); + v_ptcs[i].start(f(0)); + } + + p.send(0); + all component.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_220201_SendOperation_005(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Port p has more than one active connections. Message can be sent on it only with explicit addressing. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - partially initialized template > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220201_SendOperation_006 NegSem_220201_SendOperation_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, partially initialized template + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The TemplateInstance (and all parts of it) shall have a specific value i.e. the use +// of matching mechanisms such as AnyValue is not allowed. + +module NegSem_220201_SendOperation_006 { + + type record of integer RoI; + + type port P message { + inout RoI; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220201_SendOperation_006() runs on GeneralComp { + var template RoI vm_msg := {1, -, 2}; + + connect(self:p,self:p); + + p.send(vm_msg); + p.receive; + setverdict(pass); + } + + control { + execute(TC_NegSem_220201_SendOperation_006(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Text encoder: Encoding an unbound integer value. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - no type prefix in inline template > + +<COMPILE> + +<MODULE TTCN NegSem_220201_SendOperation_007 NegSem_220201_SendOperation_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, no type prefix in inline template + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// When defining the message in-line, the optional type part shall be used if there is +// ambiguity of the type of the message being sent. + + +module NegSem_220201_SendOperation_007 { + + type record R1 + { + integer field1, + integer field2 + } + + type record of integer RoI; + + type port P message { + inout R1, RoI; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220201_SendOperation_007() runs on GeneralComp { + + connect(self:p,self:p); + + p.send({1, 2}); + p.receive; + setverdict(pass); + } + + control { + execute(TC_NegSem_220201_SendOperation_007(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Cannot determine the type of the outgoing message +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the to clause of send operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220201_SendOperation_010 NegSem_220201_SendOperation_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, null component in the to clause of send operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220201_SendOperation_010 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220201_SendOperation_010() runs on GeneralComp system GeneralComp { + var GeneralComp v_comp := null; + connect(self:p, v_comp:p); + + p.send(0) to v_comp; + p.receive(integer:?); + + setverdict(pass); + } + + control { + execute(TC_NegSem_220201_SendOperation_010(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - send operation on disconnected and unmapped ports > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220201_SendOperation_011 NegSem_220201_SendOperation_011.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.1, send operation on disconnected and unmapped ports + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Applying a send operation to an unmapped or disconnected port shall cause a test case +// error. + +module NegSem_220201_SendOperation_011 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220201_SendOperation_011() runs on GeneralComp system GeneralComp { + p.send(0); + setverdict(pass); + } + + control { + execute(TC_NegSem_220201_SendOperation_011(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Port p has neither connections nor mappings. Message cannot be sent on it. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message receiving operations > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_001 NegSem_220202_ReceiveOperation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, Ensure that the IUT correctly handles message receiving operations + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220202_ReceiveOperation_001 { + +signature p_NegSem_220202_ReceiveOperation_001(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + template p_NegSem_220202_ReceiveOperation_001 s_baseTemplate := { + p_par1 := -, + p_par2 := 4, + p_par3 := ? + } + + template p_NegSem_220202_ReceiveOperation_001 s_returnTemplate modifies s_baseTemplate := { + p_par3 := 5 + } + + /*template p_NegSem_220202_ReceiveOperation_001 s_wrongTemplate modifies s_baseTemplate := { + p_par3 := 3 + } + + template p_NegSem_220202_ReceiveOperation_001 s_callTemplate := { + p_par1 := 1, + p_par2 := -, + p_par3 := 3 + }*/ + + type port remotePort procedure { + out p_NegSem_220202_ReceiveOperation_001; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + testcase NegSem_220202_ReceiveOperation_001() runs on GeneralComp { + + PCO.receive(s_returnTemplate); + + /* PCO.call(p_NegSem_220202_ReceiveOperation_001:s_callTemplate, 5.0) { + [] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_wrongTemplate value 1) { + //cannot receive from procedure based port + setverdict(fail); + } + [] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_returnTemplate value 2) { + setverdict(fail); + } + [] PCO.receive(p_NegSem_220202_ReceiveOperation_001:s_returnTemplate value 1) { + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + }*/ + } + + control{ + execute(NegSem_220202_ReceiveOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Message-based operation `receive' is not applicable to a procedure-based port of type `@NegSem_220202_ReceiveOperation_001.remotePort' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - no type prefix in ambiguous inline template > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_002 NegSem_220202_ReceiveOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, no type prefix in ambiguous inline template + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// An optional type field in the matching criteria to the receive operation shall +// be used to avoid any ambiguity of the type of the value being received. + +module NegSem_220202_ReceiveOperation_002 { + + type record of integer RoI; + type record R { + integer field1, + integer field2 + } + + type port P message { + inout R, RoI; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_002() runs on GeneralComp { + + connect(self:p, self:p); + + p.send(R:{1, 2}); + alt { + [] p.receive({?, 2}) { setverdict(pass); } // error (ambiguous type) + [] p.receive { setverdict(pass); } + } + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_002(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Cannot determine the type of the incoming message +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - type mismatch in redirect value assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_003 NegSem_220202_ReceiveOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, type mismatch in redirect value assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The variable or formal parameter shall be type compatible with the received message. + +module NegSem_220202_ReceiveOperation_003 { + + type port P message { + inout integer, charstring; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_003() runs on GeneralComp { + var charstring v_str; + + connect(self:p, self:p); + + p.send(1); + alt { + [] p.receive(integer:?) -> value v_str { setverdict(pass); } + // error (type mismatch in redirect assignment) + [] p.receive { setverdict(pass); } + } + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_003(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch in value redirect: A variable of type `integer' was expected instead of `charstring' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - attempting to store component name in redirect assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_010 NegSem_220202_ReceiveOperation_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, attempting to store component name in redirect assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// When the message is received on a connected port, only the component reference is +// stored in the following the sender keyword, but the test system shall internally +// store the component name too, if any (to be used in logging). + +module NegSem_220202_ReceiveOperation_010 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_010() runs on GeneralComp system GeneralComp { + var charstring v_name; + connect(self:p, self:p); + p.send(10); + p.receive(integer:?) -> sender v_name; + if (v_name == "MTC") { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_010(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - attempting to receive a type missing from the port list > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_011 NegSem_220202_ReceiveOperation_011.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, attempting to receive a type missing from the port list + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The receive operation shall only be used on message-based ports and the type of the +// value to be received shall be included in the list of incoming types of the port type +// definition. + + +module NegSem_220202_ReceiveOperation_011 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_011() runs on GeneralComp { + var integer v_index; + + connect(self:p, self:p); + p.send(10); + + alt { + [] p.receive(charstring:?) { setverdict(pass); } + [] any port.receive { setverdict(pass); } + } + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_011(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - value redirect assignment in receive any message statement > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_012 NegSem_220202_ReceiveOperation_012.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, value redirect assignment in receive any message statement + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// AddressRef for retrieving the sending entity shall be of type address, component or +// of the type provided in the address declaration of the port type of the port instance +// referenced in the receive operation. + +module NegSem_220202_ReceiveOperation_012 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_012() runs on GeneralComp { + var integer v_val; + + connect(self:p, self:p); + p.send(10); + + p.receive -> value v_val; + setverdict(pass); + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_012(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Value redirect cannot be used without receive parameter +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - type mismatch in sender redirect assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_014 NegSem_220202_ReceiveOperation_014.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, type mismatch in sender redirect assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// AddressRef for retrieving the sending entity shall be of type address, component or +// of the type provided in the address declaration of the port type of the port instance +// referenced in the receive operation. + +module NegSem_220202_ReceiveOperation_014 { + + type port P message { + inout integer; + // address integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_014() runs on GeneralComp { + var charstring v_addr; + connect(self:p, self:p); + p.send(10); + p.receive -> sender v_addr; + setverdict(pass); + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_014(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component reference in from clause of receive operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220202_ReceiveOperation_015 NegSem_220202_ReceiveOperation_015.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, null component reference in from clause of receive operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220202_ReceiveOperation_015 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_015() runs on GeneralComp system GeneralComp { + var GeneralComp v_comp := null; + connect(self:p, v_comp:p); + p.send(10); + alt { + [] p.receive from v_comp {} + [] p.receive {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_015(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - incompatible from and sender clause > + +<COMPILE> + +<MODULE TTCN NegSem_220202_ReceiveOperation_022 NegSem_220202_ReceiveOperation_022.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.2, incompatible from and sender clause + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// If the receive operation contains both from and sender clause, the variable or parameter +// referenced in the sender clause shall be type compatible with the template in the from +// clause. + +module NegSem_220202_ReceiveOperation_022 { + + type integer address; + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220202_ReceiveOperation_022() runs on GeneralComp { + var address v_addr; + + connect(self:p, self:p); + p.send(100); + alt { + [] p.receive(integer:?) from GeneralComp:? -> sender v_addr { } + [] p.receive {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220202_ReceiveOperation_022(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `integer' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles message trigger operations > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_001 NegSem_220203_TriggerOperation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, Ensure that the IUT correctly handles message trigger operations + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220203_TriggerOperation_001 { + +signature p_NegSem_220203_TriggerOperation_001(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + template p_NegSem_220203_TriggerOperation_001 s_baseTemplate := { + p_par1 := -, + p_par2 := 4, + p_par3 := ? + } + + /*template p_NegSem_220203_TriggerOperation_001 s_returnTemplate modifies s_baseTemplate := { + p_par3 := 5 + }*/ + + template p_NegSem_220203_TriggerOperation_001 s_wrongTemplate modifies s_baseTemplate := { + p_par3 := 3 + } + + /*template p_NegSem_220203_TriggerOperation_001 s_callTemplate := { + p_par1 := 1, + p_par2 := -, + p_par3 := 3 + }*/ + + type port remotePort procedure { + out p_NegSem_220203_TriggerOperation_001; + } + + type component GeneralComp { + port remotePort PCO; + } + + testcase NegSem_220203_TriggerOperation_001() runs on GeneralComp { + + PCO.trigger(p_NegSem_220203_TriggerOperation_001:s_wrongTemplate); + + /*PCO.call(p_NegSem_220203_TriggerOperation_001:s_callTemplate, 5.0) { + + [] PCO.trigger(p_NegSem_220203_TriggerOperation_001:s_wrongTemplate value 1) { + //cannot trigger from procedure based port + setverdict(fail); + } + [] PCO.trigger(p_NegSem_220203_TriggerOperation_001:s_returnTemplate value 2) { + setverdict(fail); + } + [] PCO.trigger(p_NegSem_220203_TriggerOperation_001:s_returnTemplate value 1) { + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + }*/ + } + + control{ + execute(NegSem_220203_TriggerOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Message-based operation `trigger' is not applicable to a procedure-based port of type `@NegSem_220203_TriggerOperation_001.remotePort' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - no type prefix in ambiguous inline template > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_002 NegSem_220203_TriggerOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, no type prefix in ambiguous inline template + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The matching criteria as defined in clause 22.2.2 apply also to the trigger operation. +// An optional type field in the matching criteria to the [trigger] operation shall +// be used to avoid any ambiguity of the type of the value being received. + +module NegSem_220203_TriggerOperation_002 { + + type record of integer RoI; + type record R { + integer field1, + integer field2 + } + + type port P message { + inout R, RoI; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_002() runs on GeneralComp { + + connect(self:p, self:p); + p.send(R:{1, 2}); + + alt { + [] p.trigger({?, 2}) { setverdict(pass); } // error (ambiguous type) + [else] { setverdict(pass); } + } + } + + control { + execute(TC_NegSem_220203_TriggerOperation_002(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Cannot determine the type of the incoming message +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - type mismatch in redirect value assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_003 NegSem_220203_TriggerOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, type mismatch in redirect value assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Rules in clause 22.2.2 shall apply. +// The variable or formal parameter shall be type compatible with the received message. + +module NegSem_220203_TriggerOperation_003 { + + type port P message { + inout integer, charstring; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_003() runs on GeneralComp { + var charstring v_str; + + connect(self:p, self:p); + p.send(1); + alt { + [] p.trigger(integer:?) -> value v_str { setverdict(pass); } + // error (type mismatch in redirect assignment) + } + } + + control { + execute(TC_NegSem_220203_TriggerOperation_003(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type mismatch in value redirect: A variable of type `integer' was expected instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - attempting to store component name in redirect assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_010 NegSem_220203_TriggerOperation_010.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, attempting to store component name in redirect assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Rules in clause 22.2.2 shall apply. +// When the message is received on a connected port, only the component reference is +// stored in the following the sender keyword, but the test system shall internally +// store the component name too, if any (to be used in logging). + +module NegSem_220203_TriggerOperation_010 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_010() runs on GeneralComp system GeneralComp { + var charstring v_name; + + connect(self:p, self:p); + p.send(10); + p.trigger(integer:?) -> sender v_name; + + if (v_name == "MTC") { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_220203_TriggerOperation_010(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - attempting to receive a type missing from the port list > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_011 NegSem_220203_TriggerOperation_011.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, attempting to receive a type missing from the port list + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// The trigger operation shall only be used on message-based ports and the type of the +// value to be received shall be included in the list of incoming types of the port type +// definition. + + +module NegSem_220203_TriggerOperation_011 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_011() runs on GeneralComp { + var integer v_index; + + connect(self:p, self:p); + p.send(10); + alt { + [] p.trigger(charstring:?) { setverdict(pass); } + [else] { setverdict(pass); } + } + } + + control { + execute(TC_NegSem_220203_TriggerOperation_011(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - value redirect assignment in receive any message statement > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_012 NegSem_220203_TriggerOperation_012.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, value redirect assignment in receive any message statement + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// AddressRef for retrieving the sending entity shall be of type address, component or +// of the type provided in the address declaration of the port type of the port instance +// referenced in the receive operation. + +module NegSem_220203_TriggerOperation_012 { + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_012() runs on GeneralComp { + var integer v_val; + + connect(self:p, self:p); + p.send(10); + p.trigger -> value v_val; + setverdict(pass); + } + + control { + execute(TC_NegSem_220203_TriggerOperation_012(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Value redirect cannot be used without receive parameter +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - type mismatch in sender redirect assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_014 NegSem_220203_TriggerOperation_014.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, type mismatch in sender redirect assignment + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// AddressRef for retrieving the sending entity shall be of type address, component or +// of the type provided in the address declaration of the port type of the port instance +// referenced in the receive operation. + + +module NegSem_220203_TriggerOperation_014 { + + type port P message { + inout integer; + //address integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_014() runs on GeneralComp { + var charstring v_addr; + + connect(self:p, self:p); + p.send(10); + p.trigger -> sender v_addr; + setverdict(pass); + } + + control { + execute(TC_NegSem_220203_TriggerOperation_014(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `charstring' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component reference in from clause of trigger operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220203_TriggerOperation_015 NegSem_220203_TriggerOperation_015.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, null component reference in from clause of trigger operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220203_TriggerOperation_015 { + + type port P message { + inout integer; + //address integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_015() runs on GeneralComp system GeneralComp { + var GeneralComp v_comp := null; + + connect(self:p, v_comp:p); + p.send(10); + alt { + [] p.trigger from v_comp {} + [else] {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220203_TriggerOperation_015(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - incompatible from and sender clause > + +<COMPILE> + +<MODULE TTCN NegSem_220203_TriggerOperation_022 NegSem_220203_TriggerOperation_022.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.2.3, incompatible from and sender clause + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// If the trigger operation contains both from and sender clause, the variable or parameter +// referenced in the sender clause shall be type compatible with the template in the from +// clause. + +module NegSem_220203_TriggerOperation_022 { + + type integer address; + + type port P message { + inout integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220203_TriggerOperation_022() runs on GeneralComp { + var address v_addr; + + connect(self:p, self:p); + p.send(100); + alt { + [] p.trigger(integer:?) from GeneralComp:? -> sender v_addr { } + [else] {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220203_TriggerOperation_022(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type of the variable should be a component type instead of `integer' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 2203_procedure_based_communication folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles procedure call operations > + +<COMPILE> + +<MODULE TTCN NegSem_220301_CallOperation_001 NegSem_220301_CallOperation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.1, Ensure that the IUT correctly handles procedure call operations + ** @verdict pass reject + ***************************************************/ + +module NegSem_220301_CallOperation_001 { + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220301_CallOperation_001() runs on GeneralComp { + + connect(self:messagePort, self:messagePort); + + messagePort.call(2); //cannot use call on a message based port + + alt { + [] messagePort.receive { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220301_CallOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Procedure-based operation `call' is not applicable to a message-based port of type `@NegSem_220301_CallOperation_001.loopbackPort' +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly procedure calls > + +<COMPILE> + +<MODULE TTCN NegSem_220301_CallOperation_002 NegSem_220301_CallOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.1, Ensure that the IUT correctly procedure calls + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220301_CallOperation_002 { + + /** + * @desc testing of inline return template for remote procedure call + * @param p_par1 only input parameter + * @param p_par2 must have value 4 at return + * @param p_par3 must have value 5 at return + * @return must return value 1 + */ + signature p_NegSem_220301_CallOperation_002(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + template p_NegSem_220301_CallOperation_002 s_returnTemplate := { + p_par1 := -, + p_par2 := 4, + p_par3 := 5 + } + + template p_NegSem_220301_CallOperation_002 s_wrongTemplate := { + p_par1 := -, + p_par2 := 2, + p_par3 := 3 + } + + template p_NegSem_220301_CallOperation_002 s_callTemplate := { + p_par1 := 1, + p_par2 := -, + p_par3 := 3 + } + + type port remotePort procedure { + inout p_NegSem_220301_CallOperation_002; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + function f_ClientQuery() runs on GeneralComp { + var integer v_zero:=0; + var integer v_one:=1; + + //nowait cannot be used in this construct with timeout checking + PCO.call(p_NegSem_220301_CallOperation_002:s_callTemplate, nowait) { + + [] PCO.getreply(p_NegSem_220301_CallOperation_002:s_wrongTemplate value 1) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220301_CallOperation_002:s_returnTemplate value 2) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220301_CallOperation_002:s_returnTemplate value 1) { + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + } + } + + function f_ServerResponses() runs on GeneralComp { + + var integer v_par1; + var integer v_par3; + timer t_timeout:=30.0; + + template p_NegSem_220301_CallOperation_002 s_acceptTemplate := { + p_par1 := ?, + p_par2 := ?, + p_par3 := ? + }; + + + t_timeout.start; + + alt { + [] PCO.getcall(p_NegSem_220301_CallOperation_002:s_acceptTemplate) -> param(v_par1, v_par3) { + PCO.reply(p_NegSem_220301_CallOperation_002:{p_par1 := -, p_par2 := v_par1+v_par3, p_par3 := v_par1+v_par3+1} value v_par1); //procedure return values are sent + repeat; + } + [] t_timeout.timeout { + setverdict(fail); + } + } + + } + + + testcase TC_NegSem_220301_CallOperation_002() runs on GeneralComp system GeneralComp { + var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); + var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); + // map the PTCs to the system port + connect(server:PCO, client:PCO); + + server.start(f_ServerResponses()); + client.start(f_ClientQuery()); + + alt { + [] client.done { + server.stop; + } + } + + alt { + [] all component.done {} + } + + disconnect(server:PCO, client:PCO); + } + + control{ + execute(TC_NegSem_220301_CallOperation_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A call with `nowait' keyword cannot have response and exception handling part +<END_RESULT> +<RESULT COUNT 1> +error: Catching of `timeout' exception is not allowed because the previous `call' operation does not have timer +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the to clause of the call operation > + +<COMPILE> +<EXECUTE_PARALLEL> + + +<MODULE TTCN NegSem_220301_CallOperation_003 NegSem_220301_CallOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.1, null component in the to clause of the call operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220301_CallOperation_003 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_220301_CallOperation_003() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"), v_compRef := null; + connect(self:p, v_compRef:p); + p.call(S:{}, nowait) to v_compRef; + setverdict(pass); + } + + control{ + execute(TC_NegSem_220301_CallOperation_003(), 5.0); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that getcall operations are only used on procedure based ports > + +<COMPILE> + +<MODULE TTCN NegSem_220302_GetcallOperation_001 NegSem_220302_GetcallOperation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.2, Ensure that getcall operations are only used on procedure based ports + ** @verdict pass reject + ***************************************************/ + +module NegSem_220302_GetcallOperation_001 { + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220302_GetcallOperation_001() runs on GeneralComp { + + connect(self:messagePort, self:messagePort); + + messagePort.send(2); + + alt { + [] messagePort.getcall { //cannot use getcall on a message based port + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220302_GetcallOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Procedure-based operation `getcall' is not applicable to a message-based port of type `@NegSem_220302_GetcallOperation_001.loopbackPort' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that getcall operation does not allow value assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220302_GetcallOperation_002 NegSem_220302_GetcallOperation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.2, Ensure that getcall operation does not allow value assignment + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220302_GetcallOperation_002 { + + /** + * @desc testing of inline return template for remote procedure call + * @param p_par1 only input parameter + * @param p_par2 must have value 4 at return + * @param p_par3 must have value 5 at return + * @return must return value 1 + */ + signature p_NegSem_220302_GetcallOperation_002(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + template p_NegSem_220302_GetcallOperation_002 s_returnTemplate := { + p_par1 := 0, // p_par1 := -, core dump + p_par2 := 4, + p_par3 := 5 + } + + template p_NegSem_220302_GetcallOperation_002 s_wrongTemplate := { + p_par1 := 0, // p_par1 := -, core dump + p_par2 := 2, + p_par3 := 3 + } + + template p_NegSem_220302_GetcallOperation_002 s_callTemplate := { + p_par1 := 1, + p_par2 := 0, // p_par2 := -, core dump + p_par3 := 3 + } + + type port remotePort procedure { + inout p_NegSem_220302_GetcallOperation_002; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + function f_ClientQuery() runs on GeneralComp { + var integer v_zero:=0; + var integer v_one:=1; + + PCO.call(p_NegSem_220302_GetcallOperation_002:s_callTemplate, 5.0) { + + [] PCO.getreply(p_NegSem_220302_GetcallOperation_002:s_wrongTemplate value 1) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220302_GetcallOperation_002:s_returnTemplate value 2) { + setverdict(fail); + } + [v_one>v_zero] PCO.getreply(p_NegSem_220302_GetcallOperation_002:s_returnTemplate value 1) { //check that boolean guard is correctly evaluated + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + } + } + + function f_ServerResponses() runs on GeneralComp { + + var integer v_par1; + var integer v_par3; + var integer v_return; + timer t_timeout:=30.0; + + template p_NegSem_220302_GetcallOperation_002 s_acceptTemplate := { + p_par1 := ?, + p_par2 := ?, + p_par3 := ? + }; + + + t_timeout.start; + + alt { + [] PCO.getcall(p_NegSem_220302_GetcallOperation_001:s_acceptTemplate) -> value v_return { + //not allowed assignment + } + [] t_timeout.timeout { + } + } + + } + + + testcase TC_NegSem_220302_GetcallOperation_002() runs on GeneralComp system GeneralComp { + var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); + var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); + timer t_wait:=1.0; + + + connect(server:PCO, client:PCO); + + server.start(f_ServerResponses()); + client.start(f_ClientQuery()); + + alt { + [] client.done { + t_wait.start; + while(t_wait.running) { + //this gives a chance for server to still test for second getcall match + } + server.stop; + } + } + + alt { + [] all component.done {} + } + + disconnect(server:PCO, client:PCO); + } + + control{ + execute(TC_NegSem_220302_GetcallOperation_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `value': syntax error, unexpected ValueKeyword, expecting ParamKeyword or SenderKeyword +<END_RESULT> +<RESULT COUNT 1> +error: at or before token `testcase': syntax error, unexpected TestcaseKeyword, expecting \$end +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that getcall for any call does not allow param assignment > + +<COMPILE> + +<MODULE TTCN NegSem_220302_GetcallOperation_003 NegSem_220302_GetcallOperation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.2, Ensure that getcall for any call does not allow param assignment + ** @verdict pass reject + *****************************************************************/ + +module NegSem_220302_GetcallOperation_003 { + + /** + * @desc testing of inline return template for remote procedure call + * @param p_par1 only input parameter + * @param p_par2 must have value 4 at return + * @param p_par3 must have value 5 at return + * @return must return value 1 + */ + signature p_NegSem_220302_GetcallOperation_003(in integer p_par1, out integer p_par2, inout integer p_par3) return integer; + + template p_NegSem_220302_GetcallOperation_003 s_returnTemplate := { + p_par1 := 0, // p_par1 := -, core dump + p_par2 := 4, + p_par3 := 5 + } + + template p_NegSem_220302_GetcallOperation_003 s_wrongTemplate := { + p_par1 := 0, // p_par1 := -, core dump + p_par2 := 2, + p_par3 := 3 + } + + template p_NegSem_220302_GetcallOperation_003 s_callTemplate := { + p_par1 := 1, + p_par2 := 0, // p_par2 := -, core dump + p_par3 := 3 + } + + type port remotePort procedure { + inout p_NegSem_220302_GetcallOperation_003; + } with {extension "internal"} + + type component GeneralComp { + port remotePort PCO; + } + + function f_ClientQuery() runs on GeneralComp { + var integer v_zero:=0; + var integer v_one:=1; + + PCO.call(p_NegSem_220302_GetcallOperation_003:s_callTemplate, 5.0) { + + [] PCO.getreply(p_NegSem_220302_GetcallOperation_003:s_wrongTemplate value 1) { + setverdict(fail); + } + [] PCO.getreply(p_NegSem_220302_GetcallOperation_003:s_returnTemplate value 2) { + setverdict(fail); + } + [v_one>v_zero] PCO.getreply(p_NegSem_220302_GetcallOperation_003:s_returnTemplate value 1) { //check that boolean guard is correctly evaluated + setverdict(pass); + } + [] PCO.catch (timeout) { + setverdict(fail); + } + } + } + + function f_ServerResponses() runs on GeneralComp { + + var integer v_par1; + var integer v_par3; + timer t_timeout:=30.0; + + template p_NegSem_220302_GetcallOperation_003 s_acceptTemplate := { + p_par1 := ?, + p_par2 := ?, + p_par3 := ? + }; + + + t_timeout.start; + + alt { + [] PCO.getcall -> param(v_par1, v_par3) { //not allowed param assignment for any call + } + [] t_timeout.timeout { + } + } + + } + + + testcase TC_NegSem_220302_GetcallOperation_003() runs on GeneralComp system GeneralComp { + var GeneralComp server := GeneralComp.create("RemoteProcedure Service"); + var GeneralComp client := GeneralComp.create("RemoteProcedure Client"); + timer t_wait:=1.0; + + // map the PTCs to the system port + connect(server:PCO, client:PCO); + + server.start(f_ServerResponses()); + client.start(f_ClientQuery()); + + alt { + [] client.done { + t_wait.start; + while(t_wait.running) { + //this gives a chance for server to still test for second getcall match + } + server.stop; + } + } + + alt { + [] all component.done {} + } + + disconnect(server:PCO, client:PCO); + } + + control{ + execute(TC_NegSem_220302_GetcallOperation_003()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Parameter redirect cannot be used without signature template +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the from clause of the getcall operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220302_GetcallOperation_009 NegSem_220302_GetcallOperation_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.2, null component in the from clause of the getcall operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220302_GetcallOperation_009 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp + { + var GeneralComp v_compRef := null; + connect(self:p, v_compRef:p); + + alt { + [] p.getcall(S:{}) from v_compRef { setverdict(pass, "first branch");} // error expected + [] p.getcall(S:{}) { setverdict(fail, "second branch"); } + } + } + + testcase TC_NegSem_220302_GetcallOperation_009() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + p.call(S:{}, nowait); + v_ptc.start(f()); + v_ptc.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_220302_GetcallOperation_009(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - incompatible from and sender clause in getcall operation > + +<COMPILE> + +<MODULE TTCN NegSem_220302_GetcallOperation_016 NegSem_220302_GetcallOperation_016.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.2, incompatible from and sender clause in getcall operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// If the getcall operation contains both from and sender clause, the variable or parameter +// referenced in the sender clause shall be type compatible with the template in the from +// clause. + +module NegSem_220302_GetcallOperation_016 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + var integer vc_int; + port P p; + } + + type component AltComp { + var charstring vc_str; + port P px; + } + + function f() runs on GeneralComp { + var GeneralComp v_compRef := null; + alt { + [] p.getcall(S:{}) from AltComp:? -> sender v_compRef { } // error expected + [] p.getcall(S:{}) { } + } + setverdict (pass); + } + + testcase TC_NegSem_220302_GetcallOperation_016() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + p.call(S:{}, nowait); + v_ptc.start(f()); + v_ptc.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_220302_GetcallOperation_016(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The types in `from' clause and `sender' redirect are not the same: `@NegSem_220302_GetcallOperation_016.AltComp' was expected instead of `@NegSem_220302_GetcallOperation_016.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220303_ReplyOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that reply operations are only used on procedure based ports > + +<COMPILE> + +<MODULE TTCN NegSem_220303_ReplyOperation_001 NegSem_220303_ReplyOperation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.3, Ensure that reply operations are only used on procedure based ports + ** @verdict pass reject + ***************************************************/ + +module NegSem_220303_ReplyOperation_001 { + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_220303_ReplyOperation_001() runs on GeneralComp { + + connect(self:messagePort, self:messagePort); + + messagePort.send(2); + + alt { + [] messagePort.receive(2) { + messagePort.reply(3); //cannot use reply on a message based port + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_220303_ReplyOperation_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Procedure-based operation `reply' is not applicable to a message-based port of type `@NegSem_220303_ReplyOperation_001.loopbackPort' +<END_RESULT> +<RESULT COUNT 1> +error: The type of parameter is `integer', which is not a signature +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220303_ReplyOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the to clause of the reply operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220303_ReplyOperation_002 NegSem_220303_ReplyOperation_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.3, null component in the to clause of the reply operation + ** @verdict pass reject + ***************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220303_ReplyOperation_002 { + + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f_server() runs on GeneralComp { + var GeneralComp v_compRef := null; + connect(self:p, v_compRef:p); + p.getcall(S:{}); + p.reply(S:{}) to v_compRef; + } + + testcase TC_NegSem_220303_ReplyOperation_002() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create("PTC"); + connect(self:p, v_ptc:p); + v_ptc.start(f_server()); + p.call(S:{}, 1.0) { + [] p.getreply(S:{}) { } + [] p.catch(timeout) { } + } + setverdict(pass); + } + + control{ + execute(TC_NegSem_220303_ReplyOperation_002(), 5.0); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the from clause of the getreply operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220304_getreply_operation_006 NegSem_220304_getreply_operation_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.4, null component in the from clause of the getreply operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220304_getreply_operation_006 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.reply(S:{}); + } + + testcase TC_NegSem_220304_getreply_operation_006() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + connect(self:p, v_compRef:p); + + v_ptc.start(f()); + p.call(S:{}) { + [] p.getreply(S:{}) from v_compRef {} // error expected + [] p.getreply(S:{}) {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220304_getreply_operation_006(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the multicast list of the from clause of the getreply operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220304_getreply_operation_007 NegSem_220304_getreply_operation_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.4, null component in the multicast list of the from clause of the getreply operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220304_getreply_operation_007 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + function f() runs on GeneralComp { + p.getcall(S:{}); + p.reply(S:{}); + } + + testcase TC_NegSem_220304_getreply_operation_007() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + connect(self:p, v_compRef:p); + + v_ptc.start(f()); + p.call(S:{}) { + [] p.getreply(S:{}) from (mtc, v_compRef) {} // error expected + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220304_getreply_operation_007(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - incompatible from and sender clause in getreply operation > + +<COMPILE> + +<MODULE TTCN NegSem_220304_getreply_operation_013 NegSem_220304_getreply_operation_013.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.4, incompatible from and sender clause in getreply operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// If the getreply operation contains both from and sender clause, the variable or parameter +// referenced in the sender clause shall be type compatible with the template in the from +// clause. + +module NegSem_220304_getreply_operation_013 { + + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + var integer vc_int; + port P p; + } + + type component AltComp { + var charstring vc_str; + port P px; + } + + function f() runs on GeneralComp { + p.getcall(S:{}); + p.reply(S:{}); + } + + testcase TC_NegSem_220304_getreply_operation_013() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + p.call(S:{}) { + [] p.getreply(S:{}) from AltComp:? -> sender v_compRef { } // error expected + [] p.getreply(S:{}) { } + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220304_getreply_operation_013(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The types in `from' clause and `sender' redirect are not the same: `@NegSem_220304_getreply_operation_013.AltComp' was expected instead of `@NegSem_220304_getreply_operation_013.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - raised exception type not in the list of available exceptions > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_001 NegSem_220305_raise_operation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, raised exception type not in the list of available exceptions + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Exceptions are specified as types. Therefore the exception value may either be derived +// from a template or be the value resulting from an expression (which of course can be +// an explicit value). The optional type field in the value specification to the raise +// operation shall be used in cases where it is necessary to avoid any ambiguity of the type +// of the value being sent. + +module NegSem_220305_raise_operation_001 { + signature S() exception(charstring, octetstring); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_001() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_001(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type `integer' is not present on the exception list of signature `@NegSem_220305_raise_operation_001.S' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - exception raised for a signature with no exception list > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_002 NegSem_220305_raise_operation_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, exception raised for a signature with no exception list + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Exceptions are specified as types. Therefore the exception value may either be derived +// from a template or be the value resulting from an expression (which of course can be +// an explicit value). The optional type field in the value specification to the raise +// operation shall be used in cases where it is necessary to avoid any ambiguity of the type +// of the value being sent. + +module NegSem_220305_raise_operation_002 { + signature S(); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_002() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_002(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Signature `@NegSem_220305_raise_operation_002.S' does not have exceptions +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - raised exception type is ambiguous > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_003 NegSem_220305_raise_operation_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, raised exception type is ambiguous + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// Exceptions are specified as types. Therefore the exception value may either be derived +// from a template or be the value resulting from an expression (which of course can be +// an explicit value). The optional type field in the value specification to the raise +// operation shall be used in cases where it is necessary to avoid any ambiguity of the type +// of the value being sent. + +module NegSem_220305_raise_operation_003 { + type integer MyInt1 (1..10); + type integer MyInt2 (1..20); + + signature S() exception(MyInt1, MyInt2); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_003() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_003(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Type of the exception is ambiguous: `integer' is compatible with more than one exception types of signature `@NegSem_220305_raise_operation_003.S' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - missing to clause in case of 1 to n connection > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220305_raise_operation_004 NegSem_220305_raise_operation_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, missing to clause in case of 1 to n connection + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// In case of one-to-one connections, the to clause may be omitted, because the receiving +// entity is uniquely identified by the system structure. + +module NegSem_220305_raise_operation_004 { + signature S() exception(integer); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f(integer p_expected) runs on GeneralComp + { + p.call(S:{}) { + [] p.catch(S, p_expected) { setverdict(pass); } + [] p.catch { setverdict(fail); } + } + } + + testcase TC_NegSem_220305_raise_operation_004() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc1 := GeneralComp.create, v_ptc2 := GeneralComp.create; + connect(self:p, v_ptc1:p); + connect(self:p, v_ptc2:p); + v_ptc1.start(f(1)); + v_ptc2.start(f(1)); + p.getcall(S:{}); + p.getcall(S:{}); // call from both components expected + p.raise(S, 1); // missing to clause: error expected + all component.done; + setverdict(pass); + } + + control { + execute(TC_NegSem_220305_raise_operation_004(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Port p has more than one active connections. Message can be sent on it only with explicit addressing. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - exception on a message port > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_005 NegSem_220305_raise_operation_005.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, exception on a message port + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// An exception shall only be raised at a procedure-based port. An exception is a reaction +// to an accepted procedure call the result of which leads to an exceptional event. + +module NegSem_220305_raise_operation_005 { + signature S() exception(integer); + + type port PSig procedure { + inout S; + } with {extension "internal"} + + type port PMsg message { + inout integer; + } with {extension "internal"} + + type component GeneralComp + { + port PSig p1; + port PMsg p2; + } + + function f() runs on GeneralComp + { + p1.getcall(S:{}); + p2.raise(S, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_005() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p1, v_ptc:p1); + connect(self:p2, v_ptc:p2); + v_ptc.start(f()); + p1.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_005(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Procedure-based operation `raise' is not applicable to a message-based port of type `@NegSem_220305_raise_operation_005.PMsg' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - exception procedure signature not in the port list > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_006 NegSem_220305_raise_operation_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, exception procedure signature not in the port list + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// The type definition of the port shall include in its list of accepted procedure calls the +// name of the procedure to which the exception belongs. + +module NegSem_220305_raise_operation_006 { + signature S1() exception(integer); + signature S2() exception(integer); + + type port P procedure { + inout S1; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S1:{}); + p.raise(S2, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_006() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S1:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_006(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Signature `@NegSem_220305_raise_operation_006.S2' is not present on the incoming list of port type `@NegSem_220305_raise_operation_006.P' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - value of incorrect type in the to clause of the raise operation > + +<COMPILE> + +<MODULE TTCN NegSem_220305_raise_operation_007 NegSem_220305_raise_operation_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, value of incorrect type in the to clause of the raise operation + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// AddressRef shall be of type address, component or of the type provided in the address +// declaration of the port type of the port instance referenced in the raise operation. + +module NegSem_220305_raise_operation_007 { + signature S() exception(integer); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + const charstring c_ptcName := "PTC"; + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, 1) to c_ptcName; + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_007() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create(c_ptcName); + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_007(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A component reference was expected as operand +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null in the to clause of the raise operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220305_raise_operation_008 NegSem_220305_raise_operation_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, null in the to clause of the raise operation + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220305_raise_operation_008 { + signature S() exception(integer); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + var GeneralComp v_compRef := null; + connect(self:p, v_compRef:p); + p.getcall(S:{}); + p.raise(S, 1) to v_compRef; + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_008() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_008(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - raise operation on disconnected and unmapped ports > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220305_raise_operation_009 NegSem_220305_raise_operation_009.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.5, raise operation on disconnected and unmapped ports + ** @verdict pass reject + *****************************************************************/ +// The following requirements are tested: +// Applying a raise operation to an unmapped or disconnected port shall cause a test case +// error. + +module NegSem_220305_raise_operation_009 { + signature S() exception(integer); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + disconnect(self:p, mtc:p); + p.raise(S, 1); + setverdict(pass); + } + + testcase TC_NegSem_220305_raise_operation_009() runs on GeneralComp system GeneralComp { + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + v_ptc.start(f()); + p.call(S:{}, nowait); + // no processing of the exception to avoid possible errors in the catch operation + v_ptc.done; + } + + control { + execute(TC_NegSem_220305_raise_operation_009(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Port p has neither connections nor mappings. Message cannot be sent on it. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220306_catch_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the from clause of the catch operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220306_catch_operation_006 NegSem_220306_catch_operation_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.6, null component in the from clause of the catch operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220306_catch_operation_006 { + + signature S() exception (charstring); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, "exc"); + } + + testcase TC_NegSem_220306_catch_operation_006() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + connect(self:p, v_compRef:p); + v_ptc.start(f()); + p.call(S:{}) { + [] p.catch(S, charstring:?) from v_compRef {} // error expected + [] p.catch {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220306_catch_operation_006(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220306_catch_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component in the multicast list of the from clause of the catch operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_220306_catch_operation_007 NegSem_220306_catch_operation_007.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.6, null component in the multicast list of the from clause of the catch operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_220306_catch_operation_007 { + + signature S() exception (charstring); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp + { + port P p; + } + + function f() runs on GeneralComp + { + p.getcall(S:{}); + p.raise(S, "exc"); + } + + testcase TC_NegSem_220306_catch_operation_007() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + connect(self:p, v_compRef:p); + v_ptc.start(f()); + p.call(S:{}) { + [] p.catch(S, charstring:?) from (mtc, v_compRef) {} // error expected + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220306_catch_operation_007(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220306_catch_operation_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - incompatible from and sender clause in catch operation > + +<COMPILE> + +<MODULE TTCN NegSem_220306_catch_operation_013 NegSem_220306_catch_operation_013.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.3.6, incompatible from and sender clause in catch operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// If the catch operation contains both from and sender clause, the variable or parameter +// referenced in the sender clause shall be type compatible with the template in the from +// clause. + +module NegSem_220306_catch_operation_013 { + + signature S() exception (charstring); + + type port P procedure { + inout S; + } with {extension "internal"} + + type component GeneralComp { + var integer vc_int; + port P p; + } + + type component AltComp { + var charstring vc_str; + port P px; + } + + function f() runs on GeneralComp { + p.getcall(S:{}); + p.raise(S, "exc"); + } + + testcase TC_NegSem_220306_catch_operation_013() runs on GeneralComp system GeneralComp { + var GeneralComp v_compRef := null; + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p, v_ptc:p); + + p.call(S:{}) { + [] p.catch(S, charstring:?) from AltComp:? -> sender v_compRef { } // error expected + [] p.catch { } + } + setverdict(pass); + } + + control { + execute(TC_NegSem_220306_catch_operation_013(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: The types in `from' clause and `sender' redirect are not the same: `@NegSem_220306_catch_operation_013.AltComp' was expected instead of `@NegSem_220306_catch_operation_013.GeneralComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 2204_the_check_operation folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_2204_the_check_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - null component reference in from clause of check operation > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2204_the_check_operation_001 NegSem_2204_the_check_operation_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:22.4, null component reference in from clause of check operation + ** @verdict pass reject + *****************************************************************/ + +// The following requirements are tested: +// No AddressRef shall contain the special value null at the time of the operation. + +module NegSem_2204_the_check_operation_001 { + + type port P message { + inout integer; + //address integer; + } with {extension "internal"} + + type component GeneralComp { + port P p; + } + + testcase TC_NegSem_2204_the_check_operation_001() runs on GeneralComp system GeneralComp { + var GeneralComp v_comp := null; + connect(self:p, self:p); + connect(self:p, v_comp:p); + p.send(10); + alt { + [] p.check (from v_comp) {} + [] p.check {} + } + setverdict(pass); + } + + control { + execute(TC_NegSem_2204_the_check_operation_001(), 5.0); + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: The second argument of connect operation contains the null component reference. +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/23-27-B_folders.script b/conformance_test/negative_tests/23-27-B_folders.script new file mode 100644 index 0000000000000000000000000000000000000000..d95f1689aaa9592fcb7bc7a786a3c83207977a88 --- /dev/null +++ b/conformance_test/negative_tests/23-27-B_folders.script @@ -0,0 +1,6279 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains negative tests from ETSI TTCN3 Conformance Test's 23_timer_operations, 24_test_verdict_operations, 26_module_control and B_matching_incoming_values folders. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2. 23_timer_operations folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_23_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer operations are not allowed outside of module control, test case, function, altstep > + +<COMPILE> + +<MODULE TTCN NegSem_23_toplevel_001 NNegSem_23_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer operations are not allowed outside of module control, test case, function, altstep + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/Usage of timers is allowed in test cases, functions, altsteps, module control/Timer read is not allowed in component definitions +module NegSem_23_toplevel_001 +{ + type component TComp + { + timer t_timer1 := 1.0; + timer t_timer2 := t_timer1.read; + } + + testcase TC_NegSem_23_toplevel_001() runs on TComp + { + log("Value of t_timer2.read before starting it", t_timer2.read); + } + + control + { + execute(TC_NegSem_23_toplevel_001()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A static value was expected instead of operation `timer read' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_23_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer operations are not allowed outside of module control, test case, function, altstep > + +<COMPILE> + +<MODULE TTCN NegSem_23_toplevel_002 NegSem_23_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer operations are not allowed outside of module control, test case, function, altstep + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/Usage of timers is allowed in test cases, functions, altsteps, module control/Timer running is not allowed in component definitions +module NegSem_23_toplevel_002 +{ + type component TComp + { + timer t_timer1 := 1.0; + var boolean v_bool := t_timer1.running; + } + + testcase TC_NegSem_23_toplevel_002() runs on TComp + { + log("Value of timer.running before starting it", v_bool); + } + + control + { + execute(TC_NegSem_23_toplevel_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A static value was expected instead of operation `timer running' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_23_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer operations are not allowed outside of module control, test case, function, altstep > + +<COMPILE> + +<MODULE TTCN NegSyn_23_toplevel_001 NegSyn_23_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer operations are not allowed outside of module control, test case, function, altstep + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/Usage of timers is allowed in test cases, functions, altsteps, module control/Timer stop is not allowed in module definitions + +module NegSyn_23_toplevel_001 +{ + all timer.stop; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `all': syntax error, unexpected AllKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_23_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer operations are not allowed outside of module control, test case, function, altstep > + +<COMPILE> + +<MODULE TTCN NegSyn_23_toplevel_002 NegSyn_23_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer operations are not allowed outside of module control, test case, function, altstep + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/Usage of timers is allowed in test cases, functions, altsteps, module control/Timer timeout operation is not allowed in module definitions + +module NegSyn_23_toplevel_002 +{ + any timer.timeout; +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `any': syntax error, unexpected AnyKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2302_timer_start_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure negative value is not allowed > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2302_timer_start_003 NegSem_2302_timer_start_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure negative value is not allowed + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Timer value is non-neg float +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/neg timer value causes error verdict + +module NegSem_2302_timer_start_003 { + type component TComp{ + timer t_timer; + } + + testcase TC_NegSem_2302_timer_start_003() runs on TComp{ + // Timer value shall be a non-negative numerical float number + // (i.e. the value shall be greater or equal 0.0, infinity and not_a_number are disallowed). + var float duration := -1.0; + t_timer.start(duration); + + setverdict(fail); + } + + control{ + + execute(TC_NegSem_2302_timer_start_003()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Starting timer t_timer with a negative duration \(-1\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2302_timer_start_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure negative infinity is not allowed > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2302_timer_start_004 NegSem_2302_timer_start_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure negative infinity is not allowed + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Timer value is non-neg float + + +module NegSem_2302_timer_start_004 { + type component TComp{ + timer t_timer; + } + + testcase TC_NegSem_2302_timer_start_004() runs on TComp{ + // Timer value shall be a non-negative numerical float number + // (i.e. the value shall be greater or equal 0.0, infinity and not_a_number are disallowed). + var float duration := -infinity; + t_timer.start(duration); + + setverdict(fail); + } + + control{ + + execute(TC_NegSem_2302_timer_start_004()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Starting timer t_timer with a negative duration \(-inf\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_001 NegSyn_2302_timer_start_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_001 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2302_timer_start_001() runs on TComp{ + t_timer.start(); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_001()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\)': syntax error, unexpected '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_002 NegSyn_2302_timer_start_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_002 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_002() runs on TComp{ + + t_timers[].start; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_002()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_003 NegSyn_2302_timer_start_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ + + +module NegSyn_2302_timer_start_003 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_003() runs on TComp{ + + t_timers[1].start(); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_003()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\)': syntax error, unexpected '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_004 NegSyn_2302_timer_start_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_004 { + type component TComp{ + + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2302_timer_start_004() runs on TComp{ + + t_timer.start 1.0; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_004()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `1.0': syntax error, unexpected FloatValue +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_005 NegSyn_2302_timer_start_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_005 { + type component TComp{ + + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2302_timer_start_005() runs on TComp{ + + t_timer start(1.0); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_005()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected StartKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_006 NegSyn_2302_timer_start_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_006 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_006() runs on TComp{ + + t_timers[1].start 1.0; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_006()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `1.0': syntax error, unexpected FloatValue +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_007 NegSyn_2302_timer_start_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_007 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_007() runs on TComp{ + + t_timers[1] start(1.0); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_007()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected StartKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_009 NegSyn_2302_timer_start_009.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax + + +module NegSyn_2302_timer_start_009 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_009() runs on TComp{ + + t_timers[1] start; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_009()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected StartKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_010 NegSyn_2302_timer_start_010.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow any timer.start + +module NegSyn_2302_timer_start_010 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_010() runs on TComp{ + // This is not allowed by the TTCN3 grammar + any timer.start; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_010()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected DotStartKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_011 NegSyn_2302_timer_start_011.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow any timer.start + +module NegSyn_2302_timer_start_011 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_011() runs on TComp{ + // This is not allowed by the TTCN3 grammar + any timer.start(1.0); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_011()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected DotStartKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_012 NegSyn_2302_timer_start_012.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow all timer.start + +module NegSyn_2302_timer_start_012 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_012() runs on TComp{ + // This is not allowed by the TTCN3 grammar + all timer.start; + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_012()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected DotStartKeyword, expecting DotStopKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2302_timer_start_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer start syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2302_timer_start_013 NegSyn_2302_timer_start_013.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23, Ensure timer start syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.2 The start timer operation/Start timer syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow all timer.start + + +module NegSyn_2302_timer_start_013 { + type component TComp{ + + timer t_timers[3] := {1.0, 1.0, 1.0}; + } + + testcase TC_NegSyn_2302_timer_start_013() runs on TComp{ + // This is not allowed by the TTCN3 grammar + all timer.start(1.0); + + } + + control{ + + execute(TC_NegSyn_2302_timer_start_013()) + + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `start': syntax error, unexpected DotStartKeyword, expecting DotStopKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_001 NegSyn_2303_timer_stop_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax + + +module NegSyn_2303_timer_stop_001 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2303_timer_stop_001() runs on TComp{ + t_timer.start; + t_timer stop; + + } + + control{ + + execute(TC_NegSyn_2303_timer_stop_001()) + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `stop': syntax error, unexpected StopKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_002 NegSyn_2303_timer_stop_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax + + +module NegSyn_2303_timer_stop_002 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2303_timer_stop_002() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + t_timer[].stop; + + } + + control{ + + execute(TC_NegSyn_2303_timer_stop_002()) + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_003 NegSyn_2303_timer_stop_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure all timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax + + +module NegSyn_2303_timer_stop_003 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2303_timer_stop_003() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + all.stop; + + } + + control{ + + execute(TC_NegSyn_2303_timer_stop_003()) + + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `stop': syntax error, unexpected DotStopKeyword, expecting ComponentKeyword or PortKeyword or TimerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_004 NegSyn_2303_timer_stop_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure all timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax + + +module NegSyn_2303_timer_stop_004 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2303_timer_stop_004() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + timer.stop; + + } + + control{ + execute(TC_NegSyn_2303_timer_stop_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `stop': syntax error, unexpected DotStopKeyword, expecting Identifier +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_005 NegSyn_2303_timer_stop_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure all timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax + + +module NegSyn_2303_timer_stop_005 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2303_timer_stop_005() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + all timer stop; + + } + + control{ + execute(TC_NegSyn_2303_timer_stop_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `stop': syntax error, unexpected StopKeyword, expecting DotStopKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2303_timer_stop_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer stop syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2303_timer_stop_006 NegSyn_2303_timer_stop_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.3, Ensure all timer stop syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.3 The Stop timer operation/Timer stop syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow any timer.stop + +module NegSyn_2303_timer_stop_006 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2303_timer_stop_006() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + any timer.stop; + + } + + control{ + execute(TC_NegSyn_2303_timer_stop_006()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `stop': syntax error, unexpected DotStopKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2304_timer_read_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer read syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2304_timer_read_001 NegSyn_2304_timer_read_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.4, Ensure timer read syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.4 The Read timer operation/Timer Read syntax + + +module NegSyn_2304_timer_read_001 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2304_timer_read_001() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + t_timer[].read; + + } + + control{ + execute(TC_NegSyn_2304_timer_read_001()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2304_timer_read_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer read syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2304_timer_read_002 NegSyn_2304_timer_read_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.4, Ensure timer read syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.4 The Read timer operation/Timer Read syntax + + +module NegSyn_2304_timer_read_002 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2304_timer_read_002() runs on TComp{ + var float v_float; + v_float := t_timer read; + + } + + control{ + execute(TC_NegSyn_2304_timer_read_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `read': syntax error, unexpected ReadKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2304_timer_read_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer read syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2304_timer_read_003 NegSyn_2304_timer_read_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.4, Ensure timer read syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.4 The Read timer operation/Timer Read syntax + + +module NegSyn_2304_timer_read_003 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2304_timer_read_003() runs on TComp{ + var float v_float; + v_float := read(t_timer); + + } + + control{ + execute(TC_NegSyn_2304_timer_read_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `read': syntax error, unexpected ReadKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2304_timer_read_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer read syntax: disallow any timer.read > + +<COMPILE> + +<MODULE TTCN NegSyn_2304_timer_read_004 NegSyn_2304_timer_read_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.4, Ensure timer read syntax: disallow any timer.read + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.4 The Read timer operation/Timer Read syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow any timer.read + +module NegSyn_2304_timer_read_004 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2304_timer_read_004() runs on TComp{ + var float v_float; + v_float := any timer.read; + log ("any timer.read", v_float); + } + + control{ + execute(TC_NegSyn_2304_timer_read_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `read': syntax error, unexpected DotReadKeyword, expecting DotRunningKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2304_timer_read_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer read syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2304_timer_read_005 NegSyn_2304_timer_read_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.4, Ensure timer read syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.4 The Read timer operation/Timer Read syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow all timer.read + +module NegSyn_2305_timer_read_005 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2305_timer_read_005() runs on TComp{ + var float v_float; + v_float := all timer.read; + } + + control{ + execute(TC_NegSyn_2305_timer_read_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timer': syntax error, unexpected TimerKeyword, expecting ComponentKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_001 NegSyn_2305_timer_running_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax + + +module NegSyn_2305_timer_running_001 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2305_timer_running_001() runs on TComp{ + var boolean v_bool; + v_bool := t_timer running; + } + + control{ + execute(TC_NegSyn_2305_timer_running_001()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `running': syntax error, unexpected RunningKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_002 NegSyn_2305_timer_running_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax + + +module NegSyn_2305_timer_running_002 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2305_timer_running_002() runs on TComp{ + var boolean v_bool; + v_bool := t_timer[].running; + + } + + control{ + execute(TC_NegSyn_2305_timer_running_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_003 NegSyn_2305_timer_running_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax + + +module NegSyn_2305_timer_running_003 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2305_timer_running_003() runs on TComp{ + var boolean v_bool; + v_bool := any timer running; + + } + + control{ + execute(TC_NegSyn_2305_timer_running_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `running': syntax error, unexpected RunningKeyword, expecting DotRunningKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_004 NegSyn_2305_timer_running_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax + + +module NegSyn_2305_timer_running_004 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2305_timer_running_004() runs on TComp{ + var boolean v_bool; + v_bool := timer.running; + + } + + control{ + execute(TC_NegSyn_2305_timer_running_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timer': syntax error, unexpected TimerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_005 NegSyn_2305_timer_running_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax + + +module NegSyn_2305_timer_running_005 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2305_timer_running_005() runs on TComp{ + var boolean v_bool; + v_bool := timer any.running; + + } + + control{ + execute(TC_NegSyn_2305_timer_running_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timer': syntax error, unexpected TimerKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2305_timer_running_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer running syntax: disallow all timer.running > + +<COMPILE> + +<MODULE TTCN NegSyn_2305_timer_running_006 NegSyn_2305_timer_running_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.5, Ensure timer running syntax: disallow all timer.running + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.5 The Running timer operation/Timer running syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow all timer.running + +module NegSyn_2305_timer_running_006 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2305_timer_running_006() runs on TComp{ + var boolean v_bool; + v_bool := all timer.running; + + } + + control{ + execute(TC_NegSyn_2305_timer_running_006()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timer': syntax error, unexpected TimerKeyword, expecting ComponentKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_001 NegSyn_2306_timer_timeout_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax + + +module NegSyn_2306_timer_timeout_001 { + type component TComp{ + timer t_timer[2] := {1.0, 1.0}; + } + + testcase TC_NegSyn_2306_timer_timeout_001() runs on TComp{ + t_timer[0].start; + t_timer[1].start; + t_timer[].timeout; + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_001()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\]': syntax error, unexpected '\]' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout can`t be used in boolean expressions > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_002 NegSyn_2306_timer_timeout_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout can`t be used in boolean expressions + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/The timeout shall not be used in a boolean expression. + + +module NegSyn_2306_timer_timeout_002 { + type component TComp{ + timer t_timer[2] := {1.0, 1.1}; + } + + testcase TC_NegSyn_2306_timer_timeout_002() runs on TComp{ + t_timer[0].start; + if (t_timer[0].timeout){ + setverdict(fail); + } + setverdict(pass); + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timeout': syntax error, unexpected DotTimeoutKeyword, expecting '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_003 NegSyn_2306_timer_timeout_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax + + +module NegSyn_2306_timer_timeout_003 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2306_timer_timeout_003() runs on TComp{ + t_timer.start; + t_timer.timeout(); + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_004 NegSyn_2306_timer_timeout_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax + +module NegSyn_2306_timer_timeout_004 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2306_timer_timeout_004() runs on TComp{ + t_timer.start; + any timer.timeout(); + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `\(': syntax error, unexpected '\(' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_005 NegSyn_2306_timer_timeout_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax + + +module NegSyn_2306_timer_timeout_005 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2306_timer_timeout_005() runs on TComp{ + t_timer.start; + any timer timeout; + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timeout': syntax error, unexpected TimeoutKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_006 NegSyn_2306_timer_timeout_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax + + +module NegSyn_2306_timer_timeout_006 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2306_timer_timeout_006() runs on TComp{ + t_timer.start; + timeout(t_timer); + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_006()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timeout': syntax error, unexpected TimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2306_timer_timeout_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure timer timeout syntax > + +<COMPILE> + +<MODULE TTCN NegSyn_2306_timer_timeout_007 NegSyn_2306_timer_timeout_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:23.6, Ensure timer timeout syntax + ** @verdict pass reject + ***************************************************/ +// #reqname /Requirements/23 Timer operations/23.6 The Timeout operation/Timer Timeout syntax +// #reqname /Requirements/23 Timer operations/23.7 Summary of use of any and all with timers/Disallow all timer.timeout + +module NegSyn_2306_timer_timeout_007 { + type component TComp{ + timer t_timer := 1.0; + } + + testcase TC_NegSyn_2306_timer_timeout_007() runs on TComp{ + t_timer.start; + all timer.timeout; + + } + + control{ + execute(TC_NegSyn_2306_timer_timeout_007()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `timeout': syntax error, unexpected DotTimeoutKeyword, expecting DotStopKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 24_test_verdict_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_24_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure getverdict is not allowed in constant initialization in control part > + +<COMPILE> + +<MODULE TTCN NegSem_24_toplevel_001 NegSem_24_toplevel_001.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24, Ensure getverdict is not allowed in constant initialization in control part + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/Getverdict and setverdict operations shall only be used in test cases, altsteps and functions. + **/ + +module NegSem_24_toplevel_001 { + // This should be syntactically correct since BNF does not restrict initialization expression + const verdicttype c_verdict := getverdict; + + type component GeneralComp {} + + testcase TC_NegSem_24_toplevel_001 (verdicttype v_verdict) runs on GeneralComp{ + setverdict(pass) + } + + control { + execute(TC_NegSem_24_toplevel_001(c_verdict)); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: An evaluatable constant value was expected instead of operation `getverdict\(\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_24_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure getverdict is not allowed in parameter initialization in control part. > + +<COMPILE> + +<MODULE TTCN NegSem_24_toplevel_002 NegSem_24_toplevel_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure getverdict is not allowed in parameter initialization in control part. + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/Getverdict and setverdict operations shall only be used in test cases, altsteps and functions. + **/ + +module NegSem_24_toplevel_002 { + type component GeneralComp {} + + testcase TC_NegSem_24_toplevel_002(verdicttype v_param) runs on GeneralComp { + setverdict(fail); + } + + control { + // BNF allows getverdict in expression -- this is a semantic test + execute(TC_NegSem_24_toplevel_002(getverdict)); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `getverdict\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_24_toplevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure getverdict is not allowed in variable definition in control part. > + +<COMPILE> + +<MODULE TTCN NegSem_24_toplevel_003 NegSem_24_toplevel_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure getverdict is not allowed in variable definition in control part. + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/Getverdict and setverdict operations shall only be used in test cases, altsteps and functions. + **/ + +module NegSem_24_toplevel_003 { + type component GeneralComp {} + + testcase TC_NegSem_24_toplevel_003() runs on GeneralComp { + setverdict(fail); + } + + control { + var verdicttype v_verdict := getverdict; + execute(TC_NegSem_24_toplevel_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `getverdict\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_24_toplevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict is not allowed in part whithin compound statement. > + +<COMPILE> + +<MODULE TTCN NegSem_24_toplevel_004 NegSem_24_toplevel_004.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24, Ensure setverdict is not allowed in part whithin compound statement. + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/Getverdict and setverdict operations shall only be used in test cases, altsteps and functions. + **/ + +module NegSem_24_toplevel_004 { + type component GeneralComp {} + + testcase TC_NegSem_24_toplevel_004() runs on GeneralComp { + setverdict(fail); + } + + control { + if (true) { + // It is allowed by BNF: ControlStatement -> BasicStatements -> ConditionalConstruct -> StatementBlock => SetLocalVerdict + setverdict(pass); + } + execute(TC_NegSem_24_toplevel_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Setverdict statement is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_24_toplevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict is not allowed in control part at the top level. > + +<COMPILE> + +<MODULE TTCN NegSem_24_toplevel_005 NegSem_24_toplevel_005.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24, Ensure setverdict is not allowed in control part at the top level. + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/Getverdict and setverdict operations shall only be used in test cases, altsteps and functions. + **/ + +module NegSem_24_toplevel_005 { + type component GeneralComp {} + + testcase TC_NegSem_24_toplevel_005() runs on GeneralComp { + setverdict(fail); + } + + control { + // TODO Check with grammar if it is allowed + // At least grammar allowes it in compound statements + setverdict(pass); + execute(TC_NegSem_24_toplevel_005()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `setverdict': syntax error, unexpected SetVerdictKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2401_SetverdictError_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that setverdict can't set error verdict > + +<COMPILE> + +<MODULE TTCN NegSem_2401_SetverdictError_001 NegSem_2401_SetverdictError_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.1, Ensure that setverdict can't set error verdict + ** @verdict pass reject, manual:"Ensure only one test case was executed " + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Error verdict shall not be set with setverdict + **/ + +module NegSem_2401_SetverdictError_001 { + type component GeneralComp {}; + + testcase TC_NegSem_2401_SetverdictError_001_setverdict(out boolean pb_error_occurred) runs on GeneralComp { + pb_error_occurred := true; + setverdict(error); + // Must abort here + pb_error_occurred := false; + setverdict(pass) + } + + testcase TC_NegSem_2401_SetverdictError_001_check_error_occured(boolean b_error_occurred) runs on GeneralComp { + if (b_error_occurred) { + setverdict(pass); + } else { + setverdict(fail) + } + } + + control { + var boolean b_error_occurred := true; + execute(TC_NegSem_2401_SetverdictError_001_setverdict(b_error_occurred)); + execute(TC_NegSem_2401_SetverdictError_001_check_error_occured(b_error_occurred)); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Error verdict cannot be set by the setverdict operation +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2402_setverdict_params_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict accepts parameters of verdicttype only > + +<COMPILE> + +<MODULE TTCN NegSem_2402_setverdict_params_001 NegSem_2402_setverdict_params_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure setverdict accepts parameters of verdicttype only + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/Setverdict allowed verdict values + **/ + +module NegSem_2402_setverdict_params_001 { + type component TComp {} + + testcase TC_NegSem_2402_setverdict_params_001() runs on TComp { + var charstring v_pass := "pass"; + setverdict(v_pass); + } + + control { + execute(TC_NegSem_2402_setverdict_params_001()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type verdict was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2402_setverdict_params_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict accepts parameters of verdicttype only > + +<COMPILE> + +<MODULE TTCN NegSem_2402_setverdict_params_002 NegSem_2402_setverdict_params_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure setverdict accepts parameters of verdicttype only + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/Setverdict allowed verdict values + **/ + + +module NegSem_2402_setverdict_params_002 { + type component TComp {} + type record TRec { verdicttype field1 } + + testcase TC_NegSem_2402_setverdict_params_002() runs on TComp { + var TRec v_pass := { field1 := pass }; + setverdict(v_pass); + } + + control { + execute(TC_NegSem_2402_setverdict_params_002()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type verdict was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2402_setverdict_params_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict accepts parameters of verdicttype only > + +<COMPILE> + +<MODULE TTCN NegSem_2402_setverdict_params_003 NegSem_2402_setverdict_params_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure setverdict accepts values of verdicttype only + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/Setverdict allowed verdict values + **/ + +module NegSem_2402_setverdict_params_003 { + type component TComp {} + + testcase TC_NegSem_2402_setverdict_params_003() runs on TComp { + var template verdicttype v_pass := pass; + setverdict(v_pass); + } + + control { + execute(TC_NegSem_2402_setverdict_params_003()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `v_pass' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2402_setverdict_params_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict accepts values only as the parameter > + +<COMPILE> + +<MODULE TTCN NegSem_2402_setverdict_params_004 NegSem_2402_setverdict_params_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure setverdict accepts values only as the parameter + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/Setverdict allowed verdict values + **/ + +module NegSem_2402_setverdict_params_004 { + type component TComp {} + + testcase TC_NegSem_2402_setverdict_params_004() runs on TComp { + var template verdicttype v_pass := ?; + setverdict(v_pass); + } + + control { + execute(TC_NegSem_2402_setverdict_params_004()) + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Reference to a value was expected instead of template variable `v_pass' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2402_setverdict_params_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure setverdict accepts values only as the parameter > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_2402_setverdict_params_005 NegSem_2402_setverdict_params_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24, Ensure setverdict accepts values only as the parameter + ** @verdict pass reject + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/Setverdict allowed verdict values + **/ + +module NegSem_2402_setverdict_params_005 { + type component TComp {} + + testcase TC_NegSem_2402_setverdict_params_005() runs on TComp { + var anytype v_var := { integer := 1 }; + setverdict(v_var.verdicttype); + } + + control { + execute(TC_NegSem_2402_setverdict_params_005()) + } +} +with { + extension "anytype integer, verdicttype" +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Using non-selected field verdicttype in a value of union type @NegSem_2402_setverdict_params_005.anytype +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h2. 26_module_control folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_2601_ExecuteStatement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that non-float timeout parameters in the execute statement are rejected (in this case int).> + +<COMPILE> + +<MODULE TTCN NegSem_2601_ExecuteStatement_001 NegSem_2601_ExecuteStatement_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that non-float timeout parameters in the execute statement are rejected (in this case int). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2601_ExecuteStatement_001 { + + type component GeneralComp { } + + testcase TC_NegSem_2601_ExecuteStatement_001() runs on GeneralComp { + setverdict(pass); + } + + control { + execute(TC_NegSem_2601_ExecuteStatement_001(), 1); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type float was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2601_ExecuteStatement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that non-float timeout parameters in the execute statement are rejected (in this case charstring).> + +<COMPILE> + +<MODULE TTCN NegSem_2601_ExecuteStatement_002 NegSem_2601_ExecuteStatement_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that non-float timeout parameters in the execute statement are rejected (in this case charstring). + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2601_ExecuteStatement_002 { + + type component GeneralComp { } + + testcase TC_NegSem_2601_ExecuteStatement_002() runs on GeneralComp { + setverdict(pass); + } + + control { + execute(TC_NegSem_2601_ExecuteStatement_002(), "foobar"); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type float was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2601_ExecuteStatement_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that execution rejects test case execution with infinity timer guard > + +<COMPILE> + +<MODULE TTCN NegSem_2601_ExecuteStatement_004 NegSem_2601_ExecuteStatement_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that execution rejects test case execution with infinity timer guard + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2601_ExecuteStatement_004 { + + type component GeneralComp { } + + testcase TC_NegSem_2601_ExecuteStatement_004(integer p_value, charstring p_string, boolean p_bool) runs on GeneralComp { + setverdict(pass); + } + + control { + var integer v_test := 20; + execute(TC_NegSem_2601_ExecuteStatement_004(v_test, "hello", true), infinity); //not allowed to explicitly assign infinite timer + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The testcase guard timer duration cannot be INF +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that setverdict statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_001 NegSem_2602_TheControlPart_001.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that setverdict statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_001 { + + type component GeneralComp { } + + control { + setverdict(pass); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `setverdict': syntax error, unexpected SetVerdictKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the create component is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_002 NegSem_2602_TheControlPart_002.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the create component is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_002 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + control { + var MTCComp v_myComp := MTCComp.create; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `create\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the create alive component is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_003 NegSem_2602_TheControlPart_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the create alive component is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_003 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + control { + var MTCComp v_myComp := MTCComp.create alive; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `create\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the start statement is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_004 NegSem_2602_TheControlPart_004.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the start statement is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_004 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + v_myComp.start(f_myBehavior()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component operation is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the stop statement is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_005 NegSem_2602_TheControlPart_005.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the stop statement is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_005 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + v_myComp.start(f_myBehavior()); + v_myComp.stop; + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: Component operation is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the kill statement is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_006 NegSem_2602_TheControlPart_006.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the kill statement is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_006 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + v_myComp.start(f_myBehavior()); + v_myComp.kill; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `kill': syntax error, unexpected DotKillKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the alive operation is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_007 NegSem_2602_TheControlPart_007.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the alive operation is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_007 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + if (v_myComp.alive) { + // should be rejected + } + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `alive' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the running operation is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_008 NegSem_2602_TheControlPart_008.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the running operation is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_008 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + if (v_myComp.running) { + // should be rejected + } + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `component running' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the done operation is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_009 NegSem_2602_TheControlPart_009.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the done operation is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_009 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + v_myComp.start(f_myBehavior()); + v_myComp.done; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `done': syntax error, unexpected DotDoneKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the done operation is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_010 NegSem_2602_TheControlPart_010.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the killed operation is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_010 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_myBehavior() runs on MTCComp { + setverdict(fail); + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + if (v_myComp.killed) { + // should be rejected + } + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `killed': syntax error, unexpected DotKilledKeyword, expecting '\)' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the connect statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_011 NegSem_2602_TheControlPart_011.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the connect statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_011 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + type component PTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_firstComp := f_createComp(); // assume create was accepted + var PTCComp v_secondComp := f_createComp(); // assume create was accepted + + connect(v_firstComp:p,v_firstComp:p); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `connect': syntax error, unexpected ConnectKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the disconnect statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_012 NegSem_2602_TheControlPart_012.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the disconnect statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_012 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + type component PTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_firstComp := f_createComp(); // assume create was accepted + var PTCComp v_secondComp := f_createComp(); // assume create was accepted + + disconnect(v_firstComp:p,v_firstComp:p); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `disconnect': syntax error, unexpected DisconnectKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the map statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_013 NegSem_2602_TheControlPart_013.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the map statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_013 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + type component PTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_firstComp := f_createComp(); // assume create was accepted + var PTCComp v_secondComp := f_createComp(); // assume create was accepted + + map(v_firstComp:p,v_firstComp:p); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `map': syntax error, unexpected MapKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the unmap statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_014 NegSem_2602_TheControlPart_014.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the unmap statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_014 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + type component PTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_firstComp := f_createComp(); // assume create was accepted + var PTCComp v_secondComp := f_createComp(); // assume create was accepted + + unmap(v_firstComp:p,v_firstComp:p); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `unmap': syntax error, unexpected UnmapKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the send statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_015 NegSem_2602_TheControlPart_015.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the send statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_015 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.send(charstring:"foobar"); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `send': syntax error, unexpected DotSendOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the receive statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_016 NegSem_2602_TheControlPart_016.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the receive statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_016 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.receive(charstring:"foobar"); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `receive': syntax error, unexpected DotReceiveOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the call statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_017 NegSem_2602_TheControlPart_017.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the call statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_017 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + template MyProcedure s_call := { 2, true } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.call(s_call); + + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `call': syntax error, unexpected DotCallOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the reply statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_018 NegSem_2602_TheControlPart_018.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the reply statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_018 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + template MyProcedure s_call := { 2, true } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.reply(s_call); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `reply': syntax error, unexpected DotReplyKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the raise statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_019 NegSem_2602_TheControlPart_019.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the raise statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_019 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + type charstring Exception; + + signature MyProcedure(integer p_value, boolean p_bool) exception (Exception); + + template Exception s_exception := "Thrown exception"; + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.raise(MyProcedure, s_exception); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `raise': syntax error, unexpected DotRaiseKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the trigger statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_020 NegSem_2602_TheControlPart_020.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the trigger statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_020 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + var MyProcedure v_procValue; + v_myComp.p.trigger(MyProcedure:?) -> value v_procValue; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `trigger': syntax error, unexpected DotTriggerOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the getcall statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_021 NegSem_2602_TheControlPart_021.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the getcall statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_021 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + template MyProcedure s_expected := { 1, ? } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.getcall(s_expected); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `getcall': syntax error, unexpected DotGetCallOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the getreply statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_022 NegSem_2602_TheControlPart_022.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the getreply statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_022 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.getreply; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `getreply': syntax error, unexpected DotGetReplyOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the catch statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_023 NegSem_2602_TheControlPart_023.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the catch statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_023 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.catch; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `catch': syntax error, unexpected DotCatchOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the check statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_024 NegSem_2602_TheControlPart_024.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the check statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_024 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.check; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `check': syntax error, unexpected DotCheckOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the clear statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_025 NegSem_2602_TheControlPart_025.ttcn > +/***************************************************************** + ** @version 0.0.2 + ** @purpose 1:26.2, Ensure that the clear statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_025 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.clear; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `clear': syntax error, unexpected DotClearOpKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the start statements on ports are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_026 NegSem_2602_TheControlPart_026.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the start statements on ports are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_026 { + + type port MyPort procedure { + inout MyProcedure + } + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.start; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The argument of start operation is missing, although it cannot be a start timer or start port operation +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the stop statements on ports are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_027 NegSem_2602_TheControlPart_027.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the stop statements on ports are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_027 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.stop; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Component operation is not allowed in the control part +<END_RESULT> +<RESULT COUNT 1> +error: Invalid field reference `p': type `@NegSem_2602_TheControlPart_027.MTCComp' does not have fields +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_028 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the halt statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_028 NegSem_2602_TheControlPart_028.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the halt statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_028 { + + type port MyPort procedure { + inout MyProcedure + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + signature MyProcedure(integer p_value, boolean p_bool); + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + + v_myComp.p.halt; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `halt': syntax error, unexpected DotHaltKeyword, expecting DotTimeoutKeyword +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that alternative behaviours are only used to control timer behavior in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_029 NegSem_2602_TheControlPart_029.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that alternative behaviours are only used to control timer behavior in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_029 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + function f_createComp() return MTCComp { + return MTCComp.create; + } + + control { + var MTCComp v_myComp := f_createComp(); // assume create was accepted + alt { + [] v_myComp.p.receive(charstring:"foobar") { + } + } + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Port operation is not allowed in the control part +<END_RESULT> +<RESULT COUNT 1> +error: Reference to a port or port parameter was expected instead of variable `v_myComp' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that getverdict statements are not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_030 NegSem_2602_TheControlPart_030.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that getverdict statements are not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_030 { + + type component GeneralComp { } + + control { + var verdicttype v_result; + v_result := getverdict; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `getverdict\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that execute statements are not executed from test cases. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_031 NegSem_2602_TheControlPart_031.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that execute statements are not executed from test cases. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_031 { + + type component GeneralComp { } + + testcase TC_NegSem_2602_TheControlPart_031() runs on GeneralComp { + setverdict(pass); + execute(TC_NegSem_2602_TheControlPart_031_second()); // shall be rejected + } + + testcase TC_NegSem_2602_TheControlPart_031_second() runs on GeneralComp { + setverdict(fail); + } + + + control { + execute(TC_NegSem_2602_TheControlPart_031()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A definition that has `runs on' clause cannot execute testcases +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_032 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the create alive named component is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_032 NegSem_2602_TheControlPart_032.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the create alive named component is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_032 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + control { + var MTCComp v_myComp := MTCComp.create("component name") alive; + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `create\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_033 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the create named component is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_033 NegSem_2602_TheControlPart_033.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the create named component is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_033 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + control { + var MTCComp v_myComp := MTCComp.create("component name"); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `create\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_034 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the create named component on host is not allowed in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_034 NegSem_2602_TheControlPart_034.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the create named component on host is not allowed in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_034 { + + type port MyPort message { + inout charstring + } with {extension "internal"} + + type component MTCComp { + port MyPort p; + } + + control { + var MTCComp v_myComp := MTCComp.create("component name", "localhost"); + } +} +<END_MODULE> + +<RESULT COUNT 1> +error: Operation `create\(\)' is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2602_TheControlPart_035 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that alternative behaviours are only used to control timer behavior in the control part. > + +<COMPILE> + +<MODULE TTCN NegSem_2602_TheControlPart_035 NegSem_2602_TheControlPart_035.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that alternative behaviours are only used to control timer behavior in the control part. + ** @verdict pass reject + *****************************************************************/ + +module NegSem_2602_TheControlPart_035 { + control { + alt { + [] any port.receive { + } + } + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Port operation is not allowed in the control part +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. B_matching_incoming_values folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_B010101_omitting_values_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of omitted values > + +<COMPILE> + +<MODULE TTCN NegSem_B010101_omitting_values_001 NegSem_B010101_omitting_values_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.1.1, Ensure that the IUT correctly handles template matching of omitted values + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010101_omitting_values_001 { + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type set SetType { + integer a optional, + integer b optional, + boolean c + } + + type record MessageType { + RecordType field1, + SetType field2 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010101_omitting_values_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := {a:=1,b:=omit,c:=omit}, //omitting a mandatory field + field2 := {a:=1,b:=omit,c:=omit} + } + + v_testMessage:= { + field1 := {a:=1,b:=omit,c:=true}, + field2 := {a:=1,b:=omit,c:=true} + } + + connect(self:messagePort, self:messagePort); + + messagePort.send(v_testMessage); + + } + + control{ + execute(TC_NegSem_B010101_omitting_values_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010205_value_range_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of value range definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010205_value_range_001 NegSem_B010205_value_range_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.5, Ensure that the IUT correctly handles template matching of value range definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010205_value_range_001 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + EnumeratedType field2, + RecordType field3, + UnionType field4 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010205_value_range_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := (0..2), + field2 := (e_black..e_white), //attempt to use range on enumerated type + field3 := {a:=1,b:=(0..2),c:=true}, + field4 := {a:=(0..2)} + } + + v_testMessage:= { + field1 := 2, + field2 := e_black, + field3 := {a:=1,b:=2,c:=true}, + field4 := {a:=1} + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + } + + control{ + execute(TC_NegSem_B010205_value_range_001()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: value range match cannot be used for enumerated type `@NegSem_B010205_value_range_001.EnumeratedType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010205_value_range_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of value range definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010205_value_range_002 NegSem_B010205_value_range_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.5, Ensure that the IUT correctly handles template matching of value range definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010205_value_range_002 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2, + RecordType field3, + UnionType field4 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010205_value_range_002() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := (2..0), //boundaries in wrong order + field2 := ("a".."f"), + field3 := {a:=1,b:=(0..2),c:=true}, + field4 := {a:=(0..2)} + } + + v_testMessage:= { + field1 := 2, + field2 := "abc", + field3 := {a:=1,b:=2,c:=true}, + field4 := {a:=1} + } + + connect(self:messagePort, self:messagePort); + + messagePort.send(v_testMessage); + + } + + control{ + execute(TC_NegSem_B010205_value_range_002()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: The lower boundary is higher than the upper boundary +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010205_value_range_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of value range definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010205_value_range_003 NegSem_B010205_value_range_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.5, Ensure that the IUT correctly handles template matching of value range definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010205_value_range_003 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2, + RecordType field3, + UnionType field4 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010205_value_range_003() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= + { + field1 := (0..2), + field2 := ("f".."a"), //boundaries in wrong order + field3 := {a:=1,b:=(0..2),c:=true}, + field4 := {a:=(0..2)} + } + + v_testMessage:= { + field1 := 2, + field2 := "abc", + field3 := {a:=1,b:=2,c:=true}, + field4 := {a:=1} + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + } + + control{ + execute(TC_NegSem_B010205_value_range_003()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: The lower boundary has higher character code than the upper boundary +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_001 NegSem_B010206_superset_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010206_superset_001 { + type record MessageType { + record of integer field1 // superset definition is only allowed over set of + } + + type port loopbackPort message { + inout MessageType; + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort; + } + + testcase TC_NegSem_B010206_superset_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate := {field1 := superset(1, 2)} + + v_testMessage := {field1 := {1, 3, 2}}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + setverdict(pass); + } + + control { + execute(TC_NegSem_B010206_superset_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: superset match cannot be used for `record of' type `@NegSem_B010206_superset_001.MessageType.field1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_002 NegSem_B010206_superset_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010206_superset_002 { + type set SetType { + integer a optional, integer b optional, integer c optional + } + + type record MessageType { + SetType field1 // superset definition is only allowed over set of + } + + type port loopbackPort message { + inout MessageType; + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort; + } + + testcase TC_NegSem_B010206_superset_002() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate := {field1 := superset(1, 2)} + + v_testMessage := {field1 := { a:= 1, b:= 3, c:= 2}}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + setverdict(pass); + } + + control { + execute(TC_NegSem_B010206_superset_002()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: superset match cannot be used for set type `@NegSem_B010206_superset_002.SetType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definition > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_004 NegSem_B010206_superset_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definition + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SuperSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, the individual members shall not resolve to AnyValueOrNone and individual +elements of the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010206_superset_004 { + + type set of integer SoI; + type record of integer RoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010206_superset_004() runs on GeneralComp { + + var SoI v_testMessage; + + template RoI Template:= {omit}; + + template SoI mw_matchingTemplate:= superset(all from Template); //error + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010206_superset_004()); + } + +} +<END_MODULE> + +<RESULT COUNT 2> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definition > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_005 NegSem_B010206_superset_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definition + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SuperSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, the individual members shall not resolve to AnyValueOrNone and individual +elements of the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010206_superset_005 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010206_superset_005() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template := superset(1,2); + + template SoI mw_matchingTemplate:= superset(all from Template); //error + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010206_superset_005()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: A template of type '@NegSem_B010206_superset_005.SoI' can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definition > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_006 NegSem_B010206_superset_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definition + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SuperSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, the individual members shall not resolve to AnyValueOrNone and individual +elements of the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010206_superset_006 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010206_superset_006() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= subset(1,2); + + template SoI mw_matchingTemplate:= superset(all from Template); //error + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010206_superset_006()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: A template of type '@NegSem_B010206_superset_006.SoI' can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_007 NegSem_B010206_superset_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SuperSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, the individual members shall not resolve to AnyValueOrNone and individual +elements of the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010206_superset_007 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010206_superset_007() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= {*}; + + template SoI mw_matchingTemplate:= superset(all from Template); //error + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010206_superset_007()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: 'all from' can not refer to permutation or AnyElementsOrNone +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010206_superset_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of superset definition > + +<COMPILE> + +<MODULE TTCN NegSem_B010206_superset_008 NegSem_B010206_superset_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of superset definition + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SuperSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, the individual members shall not resolve to AnyValueOrNone and individual +elements of the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010206_superset_008 { + type record of integer RoI; + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010206_superset_008() runs on GeneralComp { + + var SoI v_testMessage; + + template RoI Template:= {permutation(1,2,3)}; + + template SoI mw_matchingTemplate:= superset(all from Template); //error + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010206_superset_008()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: 'all from' can not refer to permutation or AnyElementsOrNone +<END_RESULT> +<RESULT COUNT 1> +error: permutation match cannot be used for type `integer' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_001 NegSem_B010207_subset_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.7, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ +module NegSem_B010207_subset_001 { + type record MessageType { + record of integer + field1 // subset definition is only allowed over set of + } + + type port loopbackPort message { + inout MessageType; + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort; + } + + testcase TC_NegSem_B010207_subset_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate := {field1 := subset(1, 2)} + + v_testMessage := {field1 := {1}}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + setverdict(pass); + } + + control { + execute(TC_NegSem_B010207_subset_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: subset match cannot be used for `record of' type `@NegSem_B010207_subset_001.MessageType.field1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_002 NegSem_B010207_subset_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.7, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010207_subset_002 { + + type set SetType { + integer a optional, + integer b optional, + integer c optional + } + + type record MessageType { + SetType field1 //subset definition is only allowed over set of + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_002() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= { + field1 := subset(1,2) + } + + v_testMessage:= { + field1 := {a:= 1} + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + } + + control{ + execute(TC_NegSem_B010207_subset_002()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: subset match cannot be used for set type `@NegSem_B010207_subset_002.SetType' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_004 NegSem_B010207_subset_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SubSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, individual members shall not resolve to AnyValueOrNone and individual fields of +the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010207_subset_004 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_004() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= {omit}; + + template SoI mw_matchingTemplate:= subset(all from Template); + //error: Compulsory item cannot be omitted. + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010207_subset_004()); + } + +} + +<END_MODULE> + +<RESULT COUNT 2> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_005 NegSem_B010207_subset_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SubSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, individual members shall not resolve to AnyValueOrNone and individual fields of +the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010207_subset_005 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_005() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= superset(3,4); + + template SoI mw_matchingTemplate:= subset(all from Template); + //error: The "all from" clause contains a matching mechanism. + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010207_subset_005()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: A template of type '@NegSem_B010207_subset_005.SoI' can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_006 NegSem_B010207_subset_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SubSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, individual members shall not resolve to AnyValueOrNone and individual fields of +the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010207_subset_006 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_006() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= subset(3,4); + + template SoI mw_matchingTemplate:= subset(all from Template); + //error: The "all from" clause contains a matching mechanism. + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010207_subset_006()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: A template of type '@NegSem_B010207_subset_006.SoI' can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_007 NegSem_B010207_subset_007.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SubSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, individual members shall not resolve to AnyValueOrNone and individual fields of +the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010207_subset_007 { + + type set of integer SoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_007() runs on GeneralComp { + + var SoI v_testMessage; + + template SoI Template:= {*}; + + template SoI mw_matchingTemplate:= subset(all from Template); + //error: forbidden matching mechanism. + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010207_subset_007()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: 'all from' can not refer to permutation or AnyElementsOrNone +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010207_subset_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of subset definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010207_subset_008 NegSem_B010207_subset_008.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.6, Ensure that the IUT correctly handles template matching of subset definitions + ** @verdict pass reject + ***************************************************/ + +//Restriction e) +/*The individual members of the SubSet's argument and the elements of the template in the all from clause +shall not be the matching mechanisms omit, SuperSet, SubSet and the matching attributes (length restriction +and ifpresent). In addition, individual members shall not resolve to AnyValueOrNone and individual fields of +the template in the all from clause shall not resolve to AnyElementsOrNone or permutation.*/ + +module NegSem_B010207_subset_008 { + + type set of integer SoI; + type record of integer RoI; + + type port loopbackPort message { + inout SoI + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010207_subset_008() runs on GeneralComp { + + var SoI v_testMessage; + + template RoI Template:= {permutation(1,2,4)}; + + template SoI mw_matchingTemplate:= subset(all from Template); + //error: forbidden matching mechanism. + + v_testMessage:={2}; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010207_subset_008()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: 'all from' can not refer to permutation or AnyElementsOrNone +<END_RESULT> +<RESULT COUNT 1> +error: permutation match cannot be used for type `integer' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010208_omit_value_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of omit values > + +<COMPILE> + +<MODULE TTCN NegSem_B010208_omit_value_001 NegSem_B010208_omit_value_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.8, Ensure that the IUT correctly handles template matching of omit values + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010208_omit_value_001 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2 optional, + EnumeratedType field3 optional, + RecordType field4 optional, + UnionType field5 optional, + RecordType field6 optional, + UnionType field7 optional + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010208_omit_value_001() runs on GeneralComp { + + template MessageType mw_matchingTemplate:= + { + field1 := omit,// causes an error as field1 is mandatory + field2 := *, + field3 := *, + field4 := *, + field5 := *, + field6 := *, + field7 := * + } + + var MessageType v_testMessage:= { + field1 := 2, + field2 := omit, + field3 := omit, + field4 := omit, + field5 := omit, + field6 := omit, + field7 := omit + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010208_omit_value_001()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010208_omit_value_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of omit values > + +<COMPILE> + +<MODULE TTCN NegSem_B010208_omit_value_002 NegSem_B010208_omit_value_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.2.8, Ensure that the IUT correctly handles template matching of omit values + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010208_omit_value_002 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1, + charstring field2 optional, + EnumeratedType field3 optional, + RecordType field4 optional, + UnionType field5 optional, + RecordType field6 optional, + UnionType field7 optional + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010208_omit_value_002() runs on GeneralComp { + + template MessageType mw_matchingTemplate:= + { + field1 := ?, + field2 := *, + field3 := *, + field4 := *, + field5 := *, + field6 := {a:=1,b:=2,c:=omit},// causes an error as c field is mandatory + field7 := * + } + + var MessageType v_testMessage:= { + field1 := 2, + field2 := "test string", + field3 := e_black, + field4 := {a:=1,b:=omit,c:=true}, + field5 := {a:=1}, + field6 := {a:=1,b:=2,c:=true}, + field7 := {a:=1} + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] messagePort.receive { + setverdict(fail); + } + } + } + + control{ + execute(TC_NegSem_B010208_omit_value_002()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: `omit' value is not allowed in this context +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010303_permutation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of ? symbols in value elements > + +<COMPILE> + +<MODULE TTCN NegSem_B010303_permutation_001 NegSem_B010303_permutation_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.3.3, Ensure that the IUT correctly handles template matching of ? symbols in value elements + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010303_permutation_001 { + type record MessageType { + set of integer field1, // permutation can only be applied to a record of type + set of integer field2, + set of integer field3, + set of integer field4 + } + + type port loopbackPort message { + inout MessageType; + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort; + } + + testcase TC_NegSem_B010303_permutation_001() runs on GeneralComp { + timer t := 1.0; + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate := { + field1 := {permutation(1, 2, 3), 5}, + field2 := {permutation(1, 2, ?), 5}, + field3 := {permutation(1, 2, 3), *}, + field4 := {permutation((1, 2, 3), 2, 3), 5} + } + + v_testMessage := { + field1 := {2, 1, 3, 5}, + field2 := {2, 1, 8, 5}, + field3 := {3, 2, 1, 8, 8}, + field4 := {3, 2, 2, 5} + }; + + t.start; + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(pass); + } + [] t.timeout { + setverdict(fail); + } + } + } + control { + execute(TC_NegSem_B010303_permutation_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: permutation match cannot be used for `set of' type `@NegSem_B010303_permutation_001.MessageType.field1' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010303_permutation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that all from operand can be a record of or set of only > + +<COMPILE> + +<MODULE TTCN NegSem_B010303_permutation_002 NegSem_B010303_permutation_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.3.3, Ensure that all from operand can be a record of or set of only + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Besides specifying all individual values, it is possible to add all elements of +// a record of or set of template into permutations using an all from clause. + +module NegSem_B010303_permutation_002 { + + type record of integer RoI; + template integer t_source := 2; + // t_source is not a record of or set of -> an error expected + template RoI t_perm1 := { permutation ( 5, all from t_source ) }; + + type component GeneralComp { + } + + testcase TC_NegSem_B010303_permutation_002() runs on GeneralComp { + if (match({ 2, 5 }, t_perm1)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_B010303_permutation_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A template of type 'integer' can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010303_permutation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that type restriction for permutation elements is applied > + +<COMPILE> + +<MODULE TTCN NegSem_B010303_permutation_003 NegSem_B010303_permutation_003.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.3.3, Ensure that type restriction for permutation elements is applied + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Each individual member listed in the permutation shall be of the type replicated +// by the record of type. + +module NegSem_B010303_permutation_003 { + + type record of integer RoI; + + template RoI t_perm1 := { permutation ( 5, 2.0 ) }; // float value is not compatible + + type component GeneralComp { + } + + testcase TC_NegSem_B010303_permutation_003() runs on GeneralComp { + if (match({ 2, 5 }, t_perm1)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_B010303_permutation_003()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: integer value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010303_permutation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify restriction on individual members of all from operand in permutation > + +<COMPILE> + +<MODULE TTCN NegSem_B010303_permutation_005 NegSem_B010303_permutation_005.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.3.3, Verify restriction on individual members of all from operand in permutation + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// The template in the all from clause as a whole shall not resolve into a matching +// mechanism + +module NegSem_B010303_permutation_005 { + + type record of integer RoI; + + template RoI t_source := ?; + // The source template resolves to a matching mechanism. It should cause an error. + template RoI t_perm1 := { permutation ( all from t_source, 2 ) }; + + + type component GeneralComp { + } + + testcase TC_NegSem_B010303_permutation_005() runs on GeneralComp { + if (match({ 2, 3 }, t_perm1)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_B010303_permutation_005()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: Matching mechanism can not be used as target of 'all from' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010303_permutation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify restriction on individual members of all from operand in permutation > + +<COMPILE> + +<MODULE TTCN NegSem_B010303_permutation_006 NegSem_B010303_permutation_006.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.3.3, Verify restriction on individual members of all from operand in permutation + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// Individual members of a permutation and elements of the template in the all from +// clause shall only be expressions, templates, and the AnyElement and +// AnyElementsOrNone matching mechanisms. + +module NegSem_B010303_permutation_006 { + + type record of integer RoI; + + template RoI t_source := { 1, permutation(2, 3) } + // The source template contains a matching mechanism inside value (permutation) + // that is not mentioned as a valid content of the all from operand in + // B.1.3.3. restriction c + template RoI t_perm1 := { permutation ( all from t_source, * ) }; + + + type component GeneralComp { + } + + testcase TC_NegSem_B010303_permutation_006() runs on GeneralComp { + if (match({ 1, 4, 2, 3 }, t_perm1)) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control{ + execute(TC_NegSem_B010303_permutation_006()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: 'all from' can not refer to permutation or AnyElementsOrNone +<END_RESULT> +<RESULT COUNT 1> +error: permutation match cannot be used for type `integer' +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. B0104_matching_attributes_of_values folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_B010401_length_restrictions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of value length definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010401_length_restrictions_002 NegSem_B010401_length_restrictions_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010401_length_restrictions_002 { + + + type record MessageType { + charstring field1, + bitstring field2, + hexstring field3, + charstring field4, + bitstring field5, + hexstring field6 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010401_length_restrictions_002() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= { + field1 := pattern "test s*g" length (6 .. 15), + field2 := '10*'B length (3 .. 5), + field3 := '89?AB'H length (6), //pattern is shorter than length restriction + field4 := pattern "tes?" length (4 .. 13), + field5 := '10?'B length (3 .. 5), + field6 := '89?ABC'H length (6) + } + + v_testMessage:= { + field1 := "test string", + field2 := '10101'B, + field3 := '89ABC'H, + field4 := "test", + field5 := '101'B, + field6 := '899ABC'H + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(fail); + } + [] messagePort.receive { + setverdict(pass); + } + } + } + + control{ + execute(TC_NegSem_B010401_length_restrictions_002()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: There are fewer \(5\) elements in the string than it is allowed by the length restriction \(6\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010401_length_restrictions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of value length definitions > + +<COMPILE> + +<MODULE TTCN NegSem_B010401_length_restrictions_004 NegSem_B010401_length_restrictions_004.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010401_length_restrictions_004 { + + + type record MessageType { + record of integer field1, + record of integer field2, + record of integer field3, + record of integer field4, + record of integer field5, + record of integer field6 + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010401_length_restrictions_004() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= { + field1 := { permutation ( 1, 2, 3 ), * } length (3..4), + field2 := { (1,2),* } length (2 .. 5), + field3 := { permutation ( 1, 2, 3 ), ? } length (2..3), // message length is too long + field4 := { (1,2),? } length (2 .. 5) + } + + v_testMessage:= { + field1 := {2,1,3}, + field2 := {2,1,3,5}, + field3 := {2,1,3,5}, + field4 := {1,1} + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + + alt { + [] messagePort.receive(mw_matchingTemplate) { + setverdict(fail); + } + [] messagePort.receive { + setverdict(pass); + } + } + } + + control{ + execute(TC_NegSem_B010401_length_restrictions_004()); + } + +} + +<END_MODULE> + +<RESULT COUNT 1> +error: There are more \(4\) elements in the template than it is allowed by the length restriction \(at most 3\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010402_ifPresent_indicator_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of ifpresent indicators > + +<COMPILE> + +<MODULE TTCN NegSem_B010402_ifPresent_indicator_001 NegSem_B010402_ifPresent_indicator_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.4.2, Ensure that the IUT correctly handles template matching of ifpresent indicators + ** @verdict pass reject + ***************************************************/ + +module NegSem_B010402_ifPresent_indicator_001 { + + type enumerated EnumeratedType {e_black, e_white, e_green}; + + type record RecordType { + integer a optional, + integer b optional, + boolean c + } + + type union UnionType { + integer a, + EnumeratedType b, + boolean c + } + + type record MessageType { + integer field1 optional, + charstring field2 optional, + RecordType field3, + UnionType field4 optional + } + + type port loopbackPort message { + inout MessageType + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort + } + + testcase TC_NegSem_B010402_ifPresent_indicator_001() runs on GeneralComp { + + var MessageType v_testMessage; + + template MessageType mw_matchingTemplate:= { + field1 := (0..2) ifpresent, + field2 := ("a".."f") ifpresent, + field3 := {a:=1,b:=(0..2) ifpresent,c:=true} ifpresent, + //use of ifpresent on non-optional field + field4 := {a:=(0..2)} ifpresent + } + + v_testMessage:= { + field1 := omit, + field2 := omit, + field3 := {a:=1,b:=omit,c:=true}, + field4 := omit + } + + connect(self:messagePort, self:messagePort); + messagePort.send(v_testMessage); + } + + control{ + execute(TC_NegSem_B010402_ifPresent_indicator_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: `ifpresent' is not allowed here +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_B010501_set_expression_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles template matching of character pattern set expressions > + +<COMPILE> + +<MODULE TTCN NegSem_B010501_set_expression_001 NegSem_B010501_set_expression_001.ttcn > +/*************************************************** + * @author STF 409 + * @version 0.0.1 + * @purpose 1:B.1.5.1, Ensure that the IUT correctly handles template matching of character pattern set expressions + * @verdict pass reject + ***************************************************/ +module NegSem_B010501_set_expression_001 { + type record MessageType { + charstring field1 + } + + type port loopbackPort message { + inout MessageType; + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort messagePort; + } + + testcase TC_NegSem_B010501_set_expression_001() runs on GeneralComp { + + var boolean m_res := match( "test", pattern "te[p[q-t]x]t"); // embedded set is not allowed + + setverdict(fail); + + } + control { + execute(TC_NegSem_B010501_set_expression_001()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +error: Unmatched `\]'. Did you mean `\\\]'\? +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_B010505_pattern_compatibility_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the IUT correctly handles character pattern metacharacters + compatibility rules of template matching > + +<COMPILE> + +<MODULE TTCN NegSyn_B010505_pattern_compatibility_001 NegSyn_B010505_pattern_compatibility_001.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:B.1.5.0, Ensure that the IUT correctly handles character pattern metacharacters + compatibility rules of template matching + ** @verdict pass reject + ***************************************************/ + +module NegSyn_B010505_pattern_compatibility_001 { + + type component GeneralComp {} + + testcase TC_NegSyn_B010505_pattern_compatibility_001() runs on GeneralComp { + + template charstring mw_matchingTemplate:= pattern "??riable reference"; + var charstring mw_matchingTemplate_2:= pattern mw_matchingTemplate; + // error: Cannot assign a template to a non-template variable. + + } + + control{ + execute(TC_NegSyn_B010505_pattern_compatibility_001()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: at or before token `pattern': syntax error, unexpected PatternKeyword +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/24-26_misc_verdict.script b/conformance_test/negative_tests/24-26_misc_verdict.script new file mode 100644 index 0000000000000000000000000000000000000000..af1b4cc4bf687179511c3c7f8512ee84f1762447 --- /dev/null +++ b/conformance_test/negative_tests/24-26_misc_verdict.script @@ -0,0 +1,1442 @@ +.****************************************************************************** +.* Copyright (c) 2000-2016 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 +.* +.* Contributors: +.* Adrien Kirjak – initial implementation +.* +.******************************************************************************/ +text. +:lang eng. +.* +:docname.Test Description +:docno.xz/152 91-CRL 113 200 Uen +:rev.PA1 +:date.2016-04-04 +.* +:prep.ETH/XZ EADRKIR +:subresp.EADRKIR +:appr.ETH/XZ (Elemer Lelik) +:checked. +.* +:title.ETSI TTCN3 Negative Conformance Test +:contents level=3. +.*---------------------------------------------------------------------* +:h1.PREREQUISITES AND PREPARATIONS +.*---------------------------------------------------------------------* +.*---------------------------------------------------------------------* +:h2.Scope of the Test Object +.*---------------------------------------------------------------------* +:xmp tab=1 nokeep. +This TD contains tests with not pass verdicts from ETSI TTCN3 Conformance Test's 24_test_verdict_operations and 26_module_control folders. + +:exmp. + +.*---------------------------------------------------------------------* +:h2.Test Tools +.*---------------------------------------------------------------------* +:p.:us.Software Tools:eus. +:xmp tab=2 nokeep. + + SAtester.pl + +:exmp. +:np. + +.*---------------------------------------------------------------------* +:h1.REQUIREMENT-BASED TESTS +.*---------------------------------------------------------------------* + +.*---------------------------------------------------------------------* +:h2. 24_test_verdict_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_002 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: inconc can overwrite none. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_002 Sem_2401_GlobalVerdict_002.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: inconc can overwrite none. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_002 { + type component GeneralComp {} + + function set_PTC_verdict_none() runs on GeneralComp { + setverdict(none); + } + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + testcase TC_Sem_2401_GlobalVerdict_002() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_none()); + PTC2.start(set_PTC_verdict_inconc()); + all component.done; + // Verdict inconc can overwrite none + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_002()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_003 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: fail can overwrite none. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_003 Sem_2401_GlobalVerdict_003.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: fail can overwrite none. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_003 { + type component GeneralComp {} + + function set_PTC_verdict_none() runs on GeneralComp { + setverdict(none); + } + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + testcase TC_Sem_2401_GlobalVerdict_003() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_none()); + PTC2.start(set_PTC_verdict_fail()); + all component.done; + // Verdict fail can overwrite none + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_003()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_005 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: inconc can overwrite pass. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_005 Sem_2401_GlobalVerdict_005.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: inconc can overwrite pass. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_005 { + type component GeneralComp {} + + function set_PTC_verdict_pass() runs on GeneralComp { + setverdict(pass); + } + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + testcase TC_Sem_2401_GlobalVerdict_005() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_pass()); + PTC2.start(set_PTC_verdict_inconc()); + all component.done; + // Verdict inconc can overwrite pass + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_005()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_006 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: fail can overwrite pass. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_006 Sem_2401_GlobalVerdict_006.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: fail can overwrite pass. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_006 { + type component GeneralComp {} + + function set_PTC_verdict_pass() runs on GeneralComp { + setverdict(pass); + } + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + testcase TC_Sem_2401_GlobalVerdict_006() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_pass()); + PTC2.start(set_PTC_verdict_fail()); + all component.done; + // Verdict fail can overwrite pass + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_006()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_007 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: none can't overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_007 Sem_2401_GlobalVerdict_007.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: none can't overwrite inconc. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_007 { + type component GeneralComp {} + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + function set_PTC_verdict_none() runs on GeneralComp { + setverdict(none); + } + + testcase TC_Sem_2401_GlobalVerdict_007() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_inconc()); + PTC2.start(set_PTC_verdict_none()); + all component.done; + // Verdict none can't overwrite inconc + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_007()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_008 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: pass can't overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_008 Sem_2401_GlobalVerdict_008.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: pass can't overwrite inconc. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_008 { + type component GeneralComp {} + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + function set_PTC_verdict_pass() runs on GeneralComp { + setverdict(pass); + } + + testcase TC_Sem_2401_GlobalVerdict_008() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_inconc()); + PTC2.start(set_PTC_verdict_pass()); + all component.done; + // Verdict pass can't overwrite inconc + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_008()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_009 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: fail can overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_009 Sem_2401_GlobalVerdict_009.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: fail can overwrite inconc. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_009 { + type component GeneralComp {} + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + testcase TC_Sem_2401_GlobalVerdict_009() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_inconc()); + PTC2.start(set_PTC_verdict_fail()); + all component.done; + // Verdict fail can overwrite inconc + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_009()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_010 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: none can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_010 Sem_2401_GlobalVerdict_010.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: none can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_010 { + type component GeneralComp {} + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + function set_PTC_verdict_none() runs on GeneralComp { + setverdict(none); + } + + testcase TC_Sem_2401_GlobalVerdict_010() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_fail()); + PTC2.start(set_PTC_verdict_none()); + all component.done; + // Verdict none can't overwrite fail + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_010()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_011 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: pass can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_011 Sem_2401_GlobalVerdict_011.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: pass can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_011 { + type component GeneralComp {} + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + function set_PTC_verdict_pass() runs on GeneralComp { + setverdict(pass); + } + + testcase TC_Sem_2401_GlobalVerdict_011() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_fail()); + PTC2.start(set_PTC_verdict_pass()); + all component.done; + // Verdict pass can't overwrite fail + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_011()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_GlobalVerdict_012 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for global verdict: inconc can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_GlobalVerdict_012 Sem_2401_GlobalVerdict_012.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for global verdict: inconc can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ + + +module Sem_2401_GlobalVerdict_012 { + type component GeneralComp {} + + function set_PTC_verdict_fail() runs on GeneralComp { + setverdict(fail); + } + + function set_PTC_verdict_inconc() runs on GeneralComp { + setverdict(inconc); + } + + testcase TC_Sem_2401_GlobalVerdict_012() runs on GeneralComp system GeneralComp { + var GeneralComp PTC1, PTC2; + + PTC1 := GeneralComp.create; + PTC2 := GeneralComp.create; + PTC1.start(set_PTC_verdict_fail()); + PTC2.start(set_PTC_verdict_inconc()); + all component.done; + // Verdict inconc can't overwrite fail + } + + control{ + execute(TC_Sem_2401_GlobalVerdict_012()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_002 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: inconc can overwrite none. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_002 Sem_2401_LocalVerdict_002.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: inconc can overwrite none. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_002 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_002() runs on GeneralComp { + setverdict(none); + setverdict(inconc); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_002()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_003 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: fail can overwrite none. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_003 Sem_2401_LocalVerdict_003.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: fail can overwrite none. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_003 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_003() runs on GeneralComp { + setverdict(none); + setverdict(fail); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_003()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_005 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: inconc can overwrite pass. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_005 Sem_2401_LocalVerdict_005.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: inconc can overwrite pass. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_005 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_005() runs on GeneralComp { + setverdict(pass); + setverdict(inconc); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_005()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_006 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: fail can overwrite pass. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_006 Sem_2401_LocalVerdict_006.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: fail can overwrite pass. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_006 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_006() runs on GeneralComp { + setverdict(pass); + setverdict(fail); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_006()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_007 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: none can't overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_007 Sem_2401_LocalVerdict_007.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: none can't overwrite inconc. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_007 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_007() runs on GeneralComp { + setverdict(inconc); + setverdict(none); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_007()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_008 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: pass can't overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_008 Sem_2401_LocalVerdict_008.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: pass can't overwrite inconc. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_008 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_008() runs on GeneralComp { + setverdict(inconc); + setverdict(pass); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_008()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_009 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: fail can overwrite inconc. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_009 Sem_2401_LocalVerdict_009.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: fail can overwrite inconc. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_009 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_009() runs on GeneralComp { + setverdict(inconc); + setverdict(fail); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_009()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_010 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: none can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_010 Sem_2401_LocalVerdict_010.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: none can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_010 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_010() runs on GeneralComp { + setverdict(fail); + setverdict(none); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_010()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_011 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: pass can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_011 Sem_2401_LocalVerdict_011.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: pass can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_011 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_011() runs on GeneralComp { + setverdict(fail); + setverdict(pass); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_011()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2401_LocalVerdict_012 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure overwriting rules for local verdict: inconc can't overwrite fail. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2401_LocalVerdict_012 Sem_2401_LocalVerdict_012.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.1, Ensure overwriting rules for local verdict: inconc can't overwrite fail. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.1 The Verdict mechanism/Overwriting rules for setverdict + **/ +/* + * #reqname /Requirements/24 Test verdict operations/24.2 The Setverdict operation/The value of the local verdict is changed with the setverdict operation. + **/ + + +module Sem_2401_LocalVerdict_012 { + type component GeneralComp {} + + testcase TC_Sem_2401_LocalVerdict_012() runs on GeneralComp { + setverdict(fail); + setverdict(inconc); + + // The verdict is evaluated by the validation tool according to @verdict header + } + + control{ + execute(TC_Sem_2401_LocalVerdict_012()); + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2403_getverdict_002 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure getverdict returns the actual verdict inconc > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2403_getverdict_002 Sem_2403_getverdict_002.ttcn > +/*************************************************** + ** @version 0.0.1 + ** @purpose 1:24.3, Ensure getverdict returns the actual verdict inconc + ** @verdict pass accept, ttcn3verdict:inconc + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.3 The Getverdict operation/Getverdict returns local verdict value + **/ + +module Sem_2403_getverdict_002 { + type component TComp {} + + testcase TC_Sem_2403_getverdict_002() runs on TComp { + var verdicttype v_verdict; + setverdict(inconc); + v_verdict := getverdict; + if (v_verdict != inconc) + { + setverdict(fail); + } + + } + + control { + execute(TC_Sem_2403_getverdict_002()) + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2403_getverdict_004 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure getverdict returns the actual verdict fail > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2403_getverdict_004 Sem_2403_getverdict_004.ttcn > +/*************************************************** + ** @version 0.0.2 + ** @purpose 1:24.3, Ensure getverdict returns the actual verdict fail + ** @verdict pass accept, ttcn3verdict:fail + ***************************************************/ +/* + * #reqname /Requirements/24 Test verdict operations/24.3 The Getverdict operation/Getverdict returns local verdict value + **/ + +module Sem_2403_getverdict_004 { + type component TComp {} + + testcase TC_Sem_2403_getverdict_004() runs on TComp { + var verdicttype v_verdict; + setverdict(fail); + v_verdict := getverdict; + if (v_verdict != fail) + { + // Set error verdict + testcase.stop; + } + } + + control { + execute(TC_Sem_2403_getverdict_004()) + } +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h2. 26_module_control folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. Sem_2601_ExecuteStatement_003 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the timeout specified with the execute statement is respected. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2601_ExecuteStatement_003 Sem_2601_ExecuteStatement_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that the timeout specified with the execute statement is respected. + ** @verdict pass accept, ttcn3verdict:error + *****************************************************************/ + +module Sem_2601_ExecuteStatement_003 { + + type component GeneralComp { } + + testcase TC_Sem_2601_ExecuteStatement_003() runs on GeneralComp { + alt { // this alt is intentionally blocking! + [] any port.receive { + repeat; + } + [else] + { repeat; } + } + setverdict(pass); + } + + control { + execute(TC_Sem_2601_ExecuteStatement_003(), 2.0); // let the testcase timeout after 2 seconds + } + +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: error +<END_RESULT> +<RESULT COUNT 1> +Dynamic test case error: Guard timer has expired. Execution of current test case will be interrupted. +<END_RESULT> + + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2601_ExecuteStatement_004 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the verdict none works correctly. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2601_ExecuteStatement_004 Sem_2601_ExecuteStatement_004.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that the verdict none works correctly. + ** @verdict pass accept, ttcn3verdict:pass + *****************************************************************/ + +module Sem_2601_ExecuteStatement_004 { + + type component GeneralComp { } + + testcase TC_Sem_2601_ExecuteStatement_004() runs on GeneralComp { + setverdict(none); + } + + testcase TC_Sem_2601_ExecuteStatement_004_second(verdicttype p_verdict) runs on GeneralComp { + if (p_verdict == none) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + var verdicttype v_result; + + v_result := execute(TC_Sem_2601_ExecuteStatement_004()); + execute(TC_Sem_2601_ExecuteStatement_004_second(v_result)); + } + +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: none +<END_RESULT> +<RESULT IF_PASS POSITIVE> +Verdict: pass +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2601_ExecuteStatement_006 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the verdict inconc works correctly. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2601_ExecuteStatement_006 Sem_2601_ExecuteStatement_006.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that the verdict inconc works correctly. + ** @verdict pass accept, ttcn3verdict:inconc + *****************************************************************/ + +module Sem_2601_ExecuteStatement_006 { + + type component GeneralComp { } + + testcase TC_Sem_2601_ExecuteStatement_006() runs on GeneralComp { + setverdict(inconc); + } + + testcase TC_Sem_2601_ExecuteStatement_006_second(verdicttype p_verdict) runs on GeneralComp { + if (p_verdict == inconc) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + var verdicttype v_result; + + v_result := execute(TC_Sem_2601_ExecuteStatement_006()); + execute(TC_Sem_2601_ExecuteStatement_006_second(v_result)); + } + +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: inconc +<END_RESULT> +<RESULT IF_PASS POSITIVE> +Verdict: pass +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2601_ExecuteStatement_008 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the user error sets the verdict error correctly. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2601_ExecuteStatement_008 Sem_2601_ExecuteStatement_008.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.1, Ensure that the user error sets the verdict error correctly. + ** @verdict pass accept, ttcn3verdict:error + *****************************************************************/ + +module Sem_2601_ExecuteStatement_008 { + + type component GeneralComp { } + + testcase TC_Sem_2601_ExecuteStatement_008() runs on GeneralComp { + testcase.stop("User error!"); + } + + control { + var verdicttype v_result; + + execute(TC_Sem_2601_ExecuteStatement_008()); + } + +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: error +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. Sem_2602_TheControlPart_003 positive test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that the selection of test cases can be achieven based on resulting verdict types. > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN Sem_2602_TheControlPart_003 Sem_2602_TheControlPart_003.ttcn > +/***************************************************************** + ** @version 0.0.1 + ** @purpose 1:26.2, Ensure that the selection of test cases can be achieven based on resulting verdict types. + ** @verdict pass accept, ttcn3verdict:fail + *****************************************************************/ + +module Sem_2602_TheControlPart_003 { + + type component GeneralComp { } + + testcase TC_Sem_2602_TheControlPart_003() runs on GeneralComp { + setverdict(pass); + } + + testcase TC_Sem_2602_TheControlPart_003_second() runs on GeneralComp { + setverdict(fail); + } + + control { + var verdicttype v_result; + v_result := execute(TC_Sem_2602_TheControlPart_003()); + + if (v_result == pass) { + execute(TC_Sem_2602_TheControlPart_003_second()); + } + } + +} +<END_MODULE> + +<RESULT IF_PASS POSITIVE> +Verdict: pass +<END_RESULT> +<RESULT IF_PASS POSITIVE> +Verdict: fail +<END_RESULT> + +<END_TC> +:exmp + +.*---------------------------------------------------------------------* +:h1.References +.*---------------------------------------------------------------------* +:list. +:li D='[1]'.1/174 02-CRL 113 200/5 Uen +:nl.Statement of Compliance for TITAN project +:li D='[2]'.ETSI ES 201 873-1, v4.7.1 Mockup v1 (2015-06): +:nl.Testing and Test Control Notation version 3., +:nl.Part 1: TTCN-3 Core Language +:elist. diff --git a/conformance_test/negative_tests/README.txt b/conformance_test/negative_tests/README.txt new file mode 100644 index 0000000000000000000000000000000000000000..180edd4b04b1d39b52a6c7e22057be5a9cfac913 --- /dev/null +++ b/conformance_test/negative_tests/README.txt @@ -0,0 +1,8 @@ +// README to negative conformance tests + +How to run: +The tests can be started all at once: + ./run_test_all + +How to run scripts individually: + ./SAtester.pl scriptname.script diff --git a/conformance_test/negative_tests/SAtester.pl b/conformance_test/negative_tests/SAtester.pl new file mode 100755 index 0000000000000000000000000000000000000000..858f10580ec7ab2209574aebbe19813c27237428 --- /dev/null +++ b/conformance_test/negative_tests/SAtester.pl @@ -0,0 +1,954 @@ +#!/usr/bin/perl -w +############################################################################### +# Copyright (c) 2000-2015 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 +############################################################################### +## +## File : SAtester.pl +## Description: Tester utility for Semantic Analyser, TITAN +## Written by : Endre Szalai (Endre.Szalai@ericsson.com) +## + +## TODO: exit status always 0, investigate why; workaround: catch the notify +## printout from the compiler + +require 5.6.1; + +use strict; +use Getopt::Long; + +############################################################################### +### Global Variables +############################################################################### +# Whether to stop on test case failures (1) or not (0) +my $sa_halt_on_errors = ''; +# Whether to list available test cases or not +my $sa_list_TCs = 0; +# Whether to show info or not +my $sa_info = 0; +# Whether to use matching in test case selection +my $sa_tc_select = ''; +# Name of the logfile +my $sa_logFile = ''; +my $sa_LOG; +# Elapsed time in this session +my $sessionTime; +# Whether to show command line info or not +my $sa_printHelp_cmd = 0; +# Whether to show detailed info or not +my $sa_printHelp_doc = 0; +# Use function-test runtime or not +my $sa_titanRuntime2 = 0; +# Enable coverage or not +my $sa_coverageEnabled = 0; +# Files existed before a test case execution +my %sa_existedFiles; +# Store input TD files from which TCs are collected +my @sa_scriptFiles; +# Store information about the TCs to execute +my @sa_tcList2Execute; +# Store test case data +my @sa_TCInfo; +# Timeout for system calls in seconds +my $sa_timeout = 30; +# Max time to wait for a license, in multiple of 10 minutes +my $max_cycles = 6; +# Execution statistics +# Number of TCs: PASSED, FAILED, ERROR verdicts, +# abnormally terminated, memory leaked +my @sa_executionStatistics = (0, 0, 0, 0, 0); +# Command to invoke the titan compiler +my $sa_compilerCmd; +# Command to invoke the titan Makefile generator +my $sa_mfgenCmd; +# Command to invoke the runtime execution +my $sa_runtimeCmd; +# commonly used regexps +my $sa_re_TCheader = "\\n\\s*<\\s*TC\\s*-\\s*(.+?)\\s*>\\s*\\n"; +my $sa_re_MODULEheader = "\\n\\s*<\\s*MODULE\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s*>"; +my $sa_re_MODULEbody = "${sa_re_MODULEheader}\\s*(.+?)\\n\\s*<\\s*END_MODULE\\s*>"; +my $sa_re_RESULTheader = "\\n\\s*<\\s*RESULT\\s*(IF_PASS|IF_FAIL)?\\s*(LTRT|FTRT)?\\s*(POSITIVE|NEGATIVE)?\\s*(?:COUNT\\s+(\\d+))?.*?>"; +my $sa_re_RESULTbody = "${sa_re_RESULTheader}\\s*(.*?)\\s*\\n\\s*<\\s*END_RESULT\\s*>"; +my $sa_re_EXPECTEDbody = "\\s*<\\s*VERDICT_LEAF\\s+(PASS|FAIL)\\s*>\\s*"; +my $sa_re_MemoryLeak = "(?:unallocated\\s+blocks\\s*:\\s*)|(?:Memory\\s+leakage\\s+detected)"; +# separator for printouts +my $sa_separator = "===============================================================\n"; + + +# Detailed info about the usage +my $sa_detailedInfo = ' +Purpose +------- +The tester program was written especially for testing the semantic analyser +functionality in TITAN. A generic test flow looks like: +- generate input sources (TTCN-3 and/or ASN.1) +- compile them with the TITAN compiler +- check that the error messages are as expected (negative testing) +- check that the modules are compiled both with TITAN and gcc + (positive testing) +Test cases and all information needed to execute them are stored in one file, in +the Test Description files (*.script) in EDML format. The tester program uses +this file to execute the test according to the flow described above in a fully +automatic way.. +Unlike in a simple test method, where a test may be passed or failed, in +regression test it might be important, why a test case is failed (e.g. due to a +not yet implemented feature). Therefore, each test case may have two separate +expected behaviour (called leaves later on). The first is the case when the test +purpose is expected to work in a specific way (IF_PASS leaf). The other, when +the test case is expected to fail, but why it fails is also interesting (IF_FAIL +leaf). Each test case may have both leaves and a specific selector points out +which leaf is expected to occur. This also means, that a test case passes, if +the selected leaf is passed (which may be the IF_FAIL leaf). Therefore, the +tester needs to check test cases that are failed, as only in those cases the +current result is not as expected. + +Features +-------- +The tester program has the following features: +1. Support for one-by-one and batched execution of test cases. +2. Support for unlimited number of input modules: ASN.1, +TTCN-3 and runtime config files for TITAN. +3. Support for compilation of the modules using TITAN and +GCC. It also supports single mode execution of the test suite. +Makefile and test port files generation is automatic. +5. Automatic cleanup after each test case. +6. Flexible pattern matching for the test case printout using +Perl regexps combined with different matching logic. +7. Support for regression testing process. + +Reference +--------- +For a list of command line options, execute the tester program with +SAtester.pl -help + +A test case structure in the EDML files looks like: +test case block: + <TC - test case name> +compile block: + [<COMPILE|COMPILEGCC|EXECUTE|EXECUTE_PARALLEL>] (default is COMPILE) +leaf selector block: + <VERDICT_LEAF (PASS|FAIL)> +module block(s): + <MODULE TTCN|ASN|CFG modulename filename> + ... text from here is written to the filename specified above ... + <END_MODULE> + ... several module sections may follow ... +result block(s): + <RESULT IF_PASS|IF_FAIL [POSITIVE|NEGATIVE|COUNT number]> (default is POSITIVE) + ... pattern in Perl regexp format ... + <END_RESULT> + ... several result sections may follow ... + + <END_TC> + +Each block header/footer must be single-line, i.e. newline is not allowed. + +The compile block instructs the SAtester to: + COMPILE compile the modules using TITAN only + COMPILEGCC compile the modules using TITAN and GCC afterwards + (the Makefile is automatically generated) + EXECUTE after compilation, execute the executable test suite + the first runtime configuration file is passed to TITAN + (single mode execution) + EXECUTE_PARALLEL after compilation, execute the executable test suite + (parallel mode execution) +If any of the actions fail, the test case result will be "ERROR". This block is +optional, the default value is COMPILE. + +The leaf selector block helps the regression testing process, where not only the +verdict itself, but the expected verdict is interesting. The value may be PASS +or FAIL. The leaf selector selects which RESULT blocks to use when matching the +printout from the compiler(s). + +A module block instructs the SAtester to produce a source module +or a runtime configuration file: + TTCN The module is treated as a TTCN-3 module + ASN The module is treated as an ASN.1 module + CFG The module is treated as a runtime configuration file + modulename Name of the module + filename Name of the file to be produced +The text within this section is written as is to "filename". You may specify as +many modules as you need. + +A result block instructs the SAtester how to check result as soon the actions in +the compile block is finished successfully. +Either: + POSITIVE Indicates a positive pattern match (i.e. =~ syntax in Perl) + with the supplied pattern is needed to continue + NEGATIVE Indicates a negative pattern match (i.e. !~ syntax in Perl) + with the supplied pattern is needed to continue +Or: + COUNT Indicates that instead of a direct pattern match, perform + a counting of the supplied pattern. If the number of pattern- + matches equals to the supplied number in COUNT section, the + execution continues + POSITIVE or NEGATIVE can be used for simple pattern match, i.e. whether the + pattern is present or not. + COUNT can be used to detect that a pattern how many times are present. +Result blocks are evaluated in the order of their appearence. If any of the +result block is failed, the verdict will be "FAILED" and execution continues +with the next test case (if any). Entries in the result header are optional, the +default value is "POSITIVE". + +Memory leak printouts are automatically detected. If one is found, the current +verdict will be "FAIL". + +Example +------- +//line comments are written for understanding only + +// Name of the test case +<TC - TTCN-3::Subtypes, list of values: Anytype> +// compile with TITAN only +<COMPILE> +// "anytype" is not supported, so use the FAIL-leaf +// in result matching +<VERDICT_LEAF FAIL> +// Specify one module +<MODULE TTCN ModuleA ModuleA.ttcn> +module ModuleA { + type anytype MyType ( 10, 11.0, Nonexi, false ); +} +<END_MODULE> +// PASS-leaf of the result matching +// used if VERDICT_LEAF is "PASS" +// expecting exactly 1 "no imported or local definition nonexi" +<RESULT IF_PASS COUNT 1> +(?im)\berror\b.+?no.+?definition.+?nonexi +<END_RESULT> +// expecting exactly 1 "error", so no other error shall +// occur than the previous error +<RESULT IF_PASS COUNT 1> +(?is)\berror\b +<END_RESULT> +// expecting a notification that no code is generated due +// to the error +<RESULT IF_PASS POSITIVE> +(?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b +<END_RESULT> +// FAIL-leaf of the result matching +// used if VERDICT_LEAF is "FAIL" +// expecting exactly 1 "parse error" +<RESULT IF_FAIL COUNT 1> +(?im)parse.+?error +<END_RESULT> +// expecting exactly 1 "error", so no other error shall +// occur than the parse error +<RESULT IF_FAIL COUNT 1> +(?is)\berror\b +<END_RESULT> +<END_TC> + +Information about Perl regular expressions can be found at: +www.perl.com + +Guides +------ +1. Use the IF_FAIL leaf only, if the test case is expected to fail because of a +missing functionality that will not be implemented in the current project. Using +IF_FAIL leaves for limitations that are expected to disappear within a project +is just an unnecessary overhead. + +2. Whenever a TR is issued, this should be mentioned in the test case, within +the source module where the error occured, e.g. +<MODULE TTCN ModuleA ModuleA.ttcn> +module ModuleA { + // TR 623: length restriction of charstrings + type record of charstring MyType7 length(0..666-Nonexi); +} +<END_MODULE> + +3. Always expect a specific error message, but be a bit flexible in pattern +matching. Always check that no other errors occured. E.g.: +<RESULT IF_PASS COUNT 1> +(?im)\berror\b.+?no.+?definition.+?nonexi +<END_RESULT> +<RESULT IF_PASS COUNT 1> +(?is)\berror\b +<END_RESULT> +<RESULT IF_PASS POSITIVE> +(?im)\bnotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b +<END_RESULT> +Note the non-case sensitive matching; that only 1 error is expected and that no +code is expected to be generated. + +Known issues +------------ +On cygwin, fork does not always work and Perl stops with an error like: +264 [main] perl 2216 fork_copy: linked dll data/bss pass 0 failed, +0x412000..0x412370, done 0, windows pid 1832, Win32 error 487 + +'; + + + + +# easterEgg +my $sa_egg = ' + \\\\\\\\|//// + \\\\ - - // + #( @ @ )# + \ o / + \ * / +---------------------oOOo--oOOo------------------------- + "Do or do not. There is no try." - Yoda +------------------------ooooO---Ooooo------------------- + ( ) ( ) + \ | | / + (_| |_) + -- This amazing code was created by McHalls -- + +'; + + +############################################################################### +## Subs +############################################################################### +sub sa_commandLineInfo(); +sub sa_log($); +sub sa_processArgs($); +sub sa_processCommandLine(); +sub sa_readFile($); +sub sa_writeFile($$); +sub sa_collectTCs(); +sub sa_isInList(\@$); +sub sa_getTCInfo(\@$$); +sub sa_parseTCs(); +sub sa_writeModulesOfTC(\@); +sub sa_deleteModulesOfTC(\@); +sub sa_fetchExecutableName(); +sub sa_executeCommand($); +sub sa_compileTC(\@); +sub sa_printResult($$); +sub sa_checkTCResult(\@$); +sub sa_executeTCs(); + +# Print command line information +sub sa_commandLineInfo () { + sa_log("\nPerl utility to execute test cases for Semantic Analyser\n"); + sa_log("Contact: Endre Szalai (Endre.Szalai\@ericsson.com)\n"); + sa_log("Usage: SA_tester.pl\n"); + sa_log(" [-halt] [-list] [-help] [-doc] [-rt2] [-coverage]\n"); + sa_log(" [-select <pattern>]\n"); + sa_log(" [-timeout <timeout>]\n"); + sa_log(" [<TDfile1.script>] ... [<TDfileN.script>]\n"); + sa_log(" [\"<test case name1>\"] ... [\"<test case nameM>\"]\n"); + sa_log(" [-log <logfilename>]\n"); + sa_log("Where\n"); + sa_log(" -halt halt on any errors\n"); + sa_log(" -list list available test cases\n"); + sa_log(" -help display command line parameters\n"); + sa_log(" -doc display complete documentation\n"); + sa_log(" -rt2 use function-test runtime\n"); + sa_log(" -coverage enable coverage"); + sa_log(" <pattern> select test cases if pattern is present in the\n"); + sa_log(" name of the test case\n"); + sa_log(" <timeout> maximum execution time of a system call\n"); + sa_log(" in seconds (default is $sa_timeout)\n"); + sa_log(" <logfilename> name of the logfile\n"); + sa_log(" NOTE: do NOT use the .log file extension !\n"); + sa_log(" <TDfile.script> name of the TD file(s) to collect test cases from\n"); + sa_log(" <test case name> name of the test case(s) to execute\n"); + sa_log("If no TDfile(s) are defined, all script files from the current\n"); + sa_log("directory are considered.\n"); + sa_log("If no test cases are defined, all test cases from the script files\n"); + sa_log("are executed.\n\n"); +} + +# Log entries +sub sa_log($) { + print $_[0]; + if (defined($sa_LOG)) { print $sa_LOG $_[0]; } +} + +# Process the command line +sub sa_processArgs($) { + if ($_[0] =~ /\.script$/m) { $sa_scriptFiles[scalar @sa_scriptFiles] = $_[0]; } + else { $sa_tcList2Execute[scalar @sa_tcList2Execute] = $_[0]; } +} +sub sa_processCommandLine() { + + die unless (GetOptions('halt' => \$sa_halt_on_errors, + 'list' => \$sa_list_TCs, + 'credit' => \$sa_info, + 'help' => \$sa_printHelp_cmd, + 'doc' => \$sa_printHelp_doc, + 'rt2' => \$sa_titanRuntime2, + 'coverage' => \$sa_coverageEnabled, + 'log=s' => \$sa_logFile, + 'timeout=s' => \$sa_timeout, + 'select=s' => \$sa_tc_select, + 'maxcycle=s'=> \$max_cycles, + "<>" => \&sa_processArgs)); + if ($sa_info) {print $sa_egg; exit(1);} + if ($sa_logFile ne '') { + die "Never use '.log' extension as TITAN's cleanup may remove it, specify a different name\n" + unless ($sa_logFile !~ /.*\.log$/is); + open ($sa_LOG, ">$sa_logFile") or die "Cannot open log file: '$sa_logFile': $!\n";} + if ($sa_printHelp_cmd) {sa_commandLineInfo(); exit(1);} + if ($sa_printHelp_doc) {sa_log ($sa_detailedInfo); exit(1);} +} + +# Read and return the content of a file +sub sa_readFile($) { + # $_[0] : name of the file + my $Buffer; + sa_log("Parsing file $_[0]...\n"); + open (TMP, "$_[0]") or die "Cannot open script file: '$_[0]': $!\n"; + read(TMP, $Buffer, -s "$_[0]"); + close (TMP); + # remove carriage returns + # Unix/windows: \n \r combo + if ($Buffer =~ /\n/s) {$Buffer =~ s/\r//g;} + # Mac: only \r + else {$Buffer =~ s/\r/\n/g;} + return $Buffer; +} + +# Write a file +sub sa_writeFile($$) { + # $_[0] : name of the file + # $_[1] : content of the file + sa_log("Flushing file $_[0]...\n"); + open (TMP, ">$_[0]") or die "Cannot open file: '$_[0]': $!\n"; + print(TMP $_[1]); + close (TMP); +} + +# Checks whether a TC is on the list +sub sa_isInList(\@$) { + my $poi = $_[0]; + foreach my $val (@{$poi}) { + if ($val eq $_[1]) {return 1;} + } + return 0; +} +# Collect test cases from command line and/or script files +sub sa_collectTCs() { + # No script files are defined, collect all script files from + # current directory + if (scalar @sa_scriptFiles == 0) { + my @list = split (/\s/, `ls *.script`); + foreach my $filename (@list) { $sa_scriptFiles[scalar @sa_scriptFiles] = $filename; } + } + # no test cases specified, collect from available script files + if (scalar @sa_tcList2Execute == 0) { + foreach my $filename (@sa_scriptFiles) { + my $Buffer = sa_readFile($filename); + while ($Buffer =~ s/^.*?${sa_re_TCheader}//s) { + my $tcName = $1; + if (sa_isInList(@sa_tcList2Execute,$tcName)) + {sa_log( "WARNING: Test case name is not unique: '$tcName'\n");} + # execute test case if match with pattern or no pattern available + if ((not $sa_tc_select) or + ($sa_tc_select and ($tcName =~ /$sa_tc_select/))) { + $sa_tcList2Execute[scalar @sa_tcList2Execute] = $tcName; + } + } + } + } + my $sa_nrOfTCs2Execute = scalar @sa_tcList2Execute; + my $nrOfScriptFiles = scalar @sa_scriptFiles; + sa_log( "$sa_nrOfTCs2Execute test cases from $nrOfScriptFiles script files to be executed\n"); + my $tmp = ($sa_halt_on_errors) ? "halting on errors\n" : "ignoring errors\n"; + sa_log( "Mode: $tmp"); +} + + +# Gather execution information according to: +# [N] Nth test case +# [0] test case name +# [1] "COMPILE", "COMPILEGCC" or "EXECUTE" +# [2][N] Nth module +# [0] module type ("ASN", "TTCN" or "CFG") +# [1] module name (if ASN or TTCN)/execution mode (if CFG) +# [2] filename to use for the module +# [3] content of the module +# [3]{'PASS'|'FAIL'}[N] Nth result for expected result leaf PASS|FAIL +# [0] result type ("POSITIVE" or "NEGATIVE") +# [1] match expression +# [2] number of coccurances (if "COUNT" used in RESULT) +# [4] name of the source script file +# [5] expected test case result leaf selector (PASS, FAIL) +# [6] verdict of the TC +# [7] flag whether memory leak is detected or not (defined/not defined) +# [8] flag whether abnormal termination is detected or not (defined/not defined) +sub sa_getTCInfo(\@$$) { + my ($poi, $Buffer, $filename) = @_; + my $tcidx = scalar @{$poi}; + if ($Buffer =~ s/${sa_re_TCheader}//s) { $poi->[$tcidx][0] = $1; } + else { die "ERROR: Cannot find test case name in current block\n"; } + if ($Buffer =~ s/<\s*EXECUTE\s*>//m) { $poi->[$tcidx][1] = 'EXECUTE'; } + elsif ($Buffer =~ s/<\s*EXECUTE_PARALLEL\s*>//m) { $poi->[$tcidx][1] = 'EXECUTE_PARALLEL'; } + elsif ($Buffer =~ s/<\s*COMPILEGCC\s*>//m) { $poi->[$tcidx][1] = 'COMPILEGCC'; } + else { $poi->[$tcidx][1] = 'COMPILE'; } + if ($Buffer =~ /${sa_re_EXPECTEDbody}/m) { $poi->[$tcidx][5] = $1; } + else { $poi->[$tcidx][5] = 'PASS'; } + my $idx = 0; + while ($Buffer =~ s/${sa_re_MODULEbody}//s) { + $poi->[$tcidx][2][$idx][0] = $1; + $poi->[$tcidx][2][$idx][1] = $2; + $poi->[$tcidx][2][$idx][2] = $3; + $poi->[$tcidx][2][$idx][3] = $4; + $idx++; + } + while ($Buffer =~ s/${sa_re_RESULTbody}//s) { + my $expectedVerdict; + if (defined($1)) { + $expectedVerdict = ($1 eq 'IF_FAIL') ? 'FAIL':'PASS'; + } else { $expectedVerdict = 'PASS'; } + my $idx = (defined($poi->[$tcidx][3]{$expectedVerdict})) + ? scalar @{$poi->[$tcidx][3]{$expectedVerdict}} : 0; + if (defined($2)) { + # Skip matching strings intended for the load-test run-time when + # "-rt2" is used. Vice versa. + if ($2 eq 'LTRT' and $sa_titanRuntime2 + or $2 eq 'FTRT' and not $sa_titanRuntime2) { next; } + } + if (defined($3)) { + $poi->[$tcidx][3]{$expectedVerdict}[$idx][0] = ($3 ne '') ? $3 : 'POSITIVE';} + else {$poi->[$tcidx][3]{$expectedVerdict}[$idx][0] = 'POSITIVE';} + if (defined($4)) { $poi->[$tcidx][3]{$expectedVerdict}[$idx][2] = $4; } + $poi->[$tcidx][3]{$expectedVerdict}[$idx][1] = $5; + eval { '' =~ /$poi->[$tcidx][3]{$expectedVerdict}[$idx][1]/ }; + if ($@) { + sa_log("In file $filename, test case '$poi->[$tcidx][0]'\n"); + sa_log " Syntax error in provided pattern:\n $poi->[$tcidx][3]{$expectedVerdict}[$idx][1]\n$@\n"; + exit(1); + } + } + $poi->[$tcidx][4] = $filename; + $poi->[$tcidx][6] = 'NONE'; +} +# Parse test case data +sub sa_parseTCs() { + # give only a list of the test cases + if ($sa_list_TCs) { + sa_log( "Collected test cases:\n"); + my $idx = 1; + # collect test case data from all specified script files + foreach my $filename (@sa_scriptFiles) { + my $Buffer = sa_readFile($filename); + while ($Buffer =~ s/^.*?(${sa_re_TCheader}.+?<END_TC>)//s) { + sa_getTCInfo(@sa_TCInfo, $1, $filename); + } + } + foreach my $poi (@sa_TCInfo) { + sa_log( "$idx. '$poi->[0]' \n"); + sa_log( " source:$poi->[4]; leaf:$poi->[5]\n"); + $idx++; + } + exit(1); + } + foreach my $filename (@sa_scriptFiles) { + my $Buffer = sa_readFile($filename); + while ($Buffer =~ s/^.*?(${sa_re_TCheader}.+?<END_TC>)//s) { + if (not sa_isInList(@sa_tcList2Execute,$2)) { next; } + sa_getTCInfo(@sa_TCInfo, $1, $filename); + } + } +} + +# Writes the modules of the TC +sub sa_writeModulesOfTC(\@) { + my $root = $_[0]; + foreach my $poi (@{$root->[2]}) { + open(TMP, "> $poi->[2]") or die "Can't create file '$poi->[2]': $!\n"; + sa_log("Module $poi->[1] (file $poi->[2]):\n"); + sa_log("$poi->[3]\n"); + print TMP $poi->[3] . "\n"; + close (TMP); + } +} +# Deletes the files(modules) of the TC +sub sa_deleteModulesOfTC(\@) { + my $root = $_[0]; + sa_log( "Cleanup... "); + if (-f 'Makefile') { + my $makefile; + `make clean 2>&1`; + $makefile = sa_readFile('Makefile'); + while ($makefile =~ s/^(\s*USER_SOURCES\s*=\s*)(\w+\.cc)/$1/im) { + if (not exists($sa_existedFiles{$2})) { + if (unlink $2) {sa_log( "$2 ");} + } + } + while ($makefile =~ s/^(\s*USER_HEADERS\s*=\s*)(\w+\.hh)/$1/im) { + if (not exists($sa_existedFiles{$2})) { + if (unlink $2) {sa_log( "$2 ");} + } + } + } + if (unlink "Makefile") {sa_log( "Makefile ");} + foreach my $poi (@{$root->[2]}) { + if (unlink $poi->[2]) {sa_log( "$poi->[2] ");} + # remove possible generated code + if ($poi->[0] eq 'TTCN') { + if (unlink "$poi->[1].cc") {sa_log( "$poi->[1].cc ");} + if (unlink "$poi->[1].hh") {sa_log( "$poi->[1].hh ");} + } else { + my $tmp = $poi->[1]; + $tmp =~ s/\-/_/g; + if (unlink "$tmp.cc") {sa_log( "$tmp.cc ");} + if (unlink "$tmp.hh") {sa_log( "$tmp.hh ");} + } + } + sa_log("\n"); +} + +# Fetch the executable name from Makefile +sub sa_fetchExecutableName() { + my $makefile = sa_readFile('Makefile'); + if ($makefile =~ /^\s*EXECUTABLE\s*=\s*(\w+)/im) { return $1; } + die "ERROR: Executable name is not found in generated Makefile\n"; +} + +# Perform a system call +# return value: (status, output) +# status = 0 on success +# status = 1 on command timeout +# status = 2 on abnormal termination +# output: collected printout from the process +sub sa_executeCommand($) { + # Silly Perl does not allow to capture STDERR, only STDOUT. + # As a workaround, ask the shell to redirect STDERR to STDOUT. + # It's OK until TITAN writes everything to STDERR (as it is today) + my $command = "$_[0] 2>&1"; + my $subRes = ""; + my $pid; + my $exitStatus = 0; + sa_log( "$_[0]\n"); + # run as a separate Perl program to be able to use timeout + eval { + local $SIG{ALRM} = sub { die "timeout\n" }; # NB: \n required + alarm $sa_timeout; # send an alarm signal in specified time + # call via exec to be able to catch the exit status + # (without exec, the shell always return with 0 exit status) + $pid = open(TMP, "exec $command |"); + die "ERROR: Cannot fork: $!\n" unless ($pid); + while (<TMP>) { $subRes .= $_; } + close(TMP); + $exitStatus = $? & 128; # whether core dump occured + alarm 0; + }; + sa_log("$subRes\n"); + if ($@) { # an error occured (thought, not only at timeout) + sa_log("\nSoftly killing forked process $pid\n"); + kill 1, $pid; + sa_log("ERROR: system call '$command' is not finished within $sa_timeout seconds\n"); + return (1, $subRes); + } + if ($exitStatus) { # core dump occured + sa_log("\nERROR: system call '$command' is terminated abnormally\n"); + return (2, $subRes); + } + return (0, $subRes); +} + +# Compile the stuff now +# return value: (status, output) +# status = 0 on success +# status = 1 on ERROR +# status = 2 on test case FAIL (compiler related ERROR) +sub sa_compileTC(\@) { + my $root = $_[0]; + my $modules2compile = ''; + my $configFile = ''; + my $subRes = ''; + my $res; + my $cycles = 0; + foreach my $poi (@{$root->[2]}) { + if ($poi->[0] eq "CFG") {$configFile = $poi->[2]; next;} + $modules2compile .= " $poi->[2]"; + } + if ($modules2compile eq '') { + sa_log( "WARNING: test case '$root->[0]' does not contain any modules, skipping\n"); + return (1, ''); + } + sa_log( "Compiling sources...\n"); + my $runtimeOption = ''; + if ($sa_titanRuntime2) { $runtimeOption = '-R'; } + do { + if ($cycles) { sleep(60 * 10); } + $cycles++; + ($res, $subRes) = sa_executeCommand("$sa_compilerCmd $runtimeOption $modules2compile"); + # Purify message, when no floating license available. Sleep for a while + # and retry. + # -continue-without-license=yes + } while (($subRes =~ /\-continue\-without\-license\=yes/mi) and ($cycles <= $max_cycles)); + if ($res) { return (2, $subRes); } + my $resultBuffer = $subRes; + if ($root->[1] eq "COMPILE") { return (0, $resultBuffer); } + + sa_log( "Generating test port skeletons...\n"); + ($res, $subRes) = sa_executeCommand("$sa_compilerCmd $runtimeOption -t -f $modules2compile"); + if ($res) { return (1, $subRes); } + $resultBuffer .= $subRes; + + sa_log( "Generating Makefile...\n"); + ($res, $subRes) = sa_executeCommand("$sa_mfgenCmd $runtimeOption -s -f $modules2compile *.cc*"); + if ($res) { return (1, $subRes); } + $resultBuffer .= $subRes; + if (not (-e 'Makefile')) { + sa_log( "ERROR: Makefile could not be generated\n"); + sa_log ($subRes); + return (1, $subRes); + } + if ($root->[1] eq "EXECUTE_PARALLEL") { + sa_log("Patching Makefile for parallel mode...\n"); + my $Buffer = sa_readFile('Makefile'); + $Buffer =~ s/^\s*TTCN3_LIB\s*=\s*(ttcn3\S*)\s*$/TTCN3_LIB = $1-parallel/im; + unlink 'Makefile'; + sa_writeFile('Makefile', $Buffer); + } + sa_log("Building...\n"); + my $coverage_args = $sa_coverageEnabled ? "CXXFLAGS=\"-fprofile-arcs -ftest-coverage -g\" LDFLAGS=\"-fprofile-arcs -ftest-coverage -g -lgcov\"" : ""; + ($res, $subRes) = sa_executeCommand("make " . $coverage_args); + if ($res) { return (1, $subRes); } + $resultBuffer .= $subRes; + my $exeName = sa_fetchExecutableName(); + if (not (-e $exeName)) { + sa_log( "ERROR: GCC compilation error, no executable produced ('$exeName')\n"); + if ($sa_halt_on_errors) { + sa_log( "\nTest execution interrupted (no cleanup).\n\n"); + exit(1); + } + + return (1, $subRes); + } + if ($root->[1] eq "COMPILEGCC") { return (0, $resultBuffer); } + + # go on with execution + sa_log("Fetched executable name: $exeName\n"); + if ($root->[1] eq "EXECUTE") { + sa_log( "Executing in single mode...\n"); + if ($configFile eq '') { + sa_log( "ERROR: No runtime config file is specified in the test case\n"); + return (1, $subRes); + } + ($res, $subRes) = sa_executeCommand("./$exeName $configFile"); + if ($res) { return (1, $subRes); } + $resultBuffer .= $subRes; + return (0, $resultBuffer); + } else { + sa_log( "Executing in parallel mode...\n"); + if ($configFile eq '') { + ($res, $subRes) = sa_executeCommand("$sa_runtimeCmd $exeName"); + } else { + ($res, $subRes) = sa_executeCommand("$sa_runtimeCmd $exeName $configFile"); + } + if ($res) { return (1, $subRes); } + $resultBuffer .= $subRes; + return (0, $resultBuffer); + } +} + + +# Print a test case result +# $_[0] name of the test case +# $_[1] verdict +sub sa_printResult($$) { + sa_log( "\nTest case '$_[0]' \n '$_[1]'\n".$sa_separator); +} + +# Check test case result based on RESULT lists +sub sa_checkTCResult(\@$) { + my ($root, $resultBuffer) = @_; + my $result = 'PASS'; + my $expectedResult = $root->[5]; + if (not defined($root->[3])) { + sa_log( "ERROR: No RESULT section in test case '$root->[0]'\n"); + sa_printResult($root->[0], 'ERROR'); + $root->[6] = 'ERROR'; + return; + } + foreach my $poi (@{$root->[3]{$expectedResult}}) { + # match with each result + if ($poi->[1] !~ /\S/) {next;} + if (($poi->[0] eq 'POSITIVE') and defined($poi->[2])) { # counter match + my $counter = 0; + my $tmpBuf = $resultBuffer; + while ($tmpBuf =~ s/$poi->[1]//) { $counter++; } + if ($counter != $poi->[2]) { + sa_log( "Failing at counting: pattern '$poi->[1]'\nexpected '$poi->[2]' times, found '$counter' times\n"); + $result = 'FAIL'; last; + } else { sa_log("Passed matching pattern (counting $counter times): '$poi->[1]'\n"); } + } else { # simple pattern match + if ($poi->[0] eq 'POSITIVE') { + if ($resultBuffer !~ /$poi->[1]/si) { + sa_log( "Failing at pattern (expected, not found):\n$poi->[1]\n"); + $result = 'FAIL'; last; + } else { sa_log("Passed matching pattern (expected): '$poi->[1]'\n"); } + } else { # NEGATIVE + if ($resultBuffer =~ /$poi->[1]/si) { + sa_log( "Failing at pattern (not expected but found):\n$poi->[1]\n"); + $result = 'FAIL'; last; + } else { sa_log("Passed matching pattern (not expected): '$poi->[1]'\n"); } + } + } + } + # Check if there is any memory leak in compiler + if ($resultBuffer =~ /${sa_re_MemoryLeak}/mi) { + sa_log( "WARNING: Memory leak detected in compiler, setting verdict to 'FAIL'\n"); + $root->[7] = 'memory leak detected'; + $result = 'FAIL'; + } + sa_printResult($root->[0], $result); + if ($sa_halt_on_errors and ($result ne 'PASS')) { + sa_log( "\nTest execution interrupted (no cleanup).\n\n"); + exit(1); + } + $root->[6] = $result; +} + +# Execute test cases +sub sa_executeTCs() { + my $flag; + # Log general info + sa_log($sa_separator); + sa_log("Date : " . `date`); + sa_log("User : " . `whoami`); + if (defined($ENV{HOST})) { + sa_log("Host : $ENV{HOST}\n"); + } else { + sa_log("Host : <unknown>\n"); + } + sa_log("Platform : " . `uname -a`); + sa_log("g++ : " . `which g++ | grep g++`); + sa_log("g++ vers.: " . `g++ -dumpversion`); + if (defined($ENV{TTCN3_DIR})) { + sa_log( "compiler : $sa_compilerCmd\n"); + sa_log( "TTCN3_DIR: $ENV{TTCN3_DIR}\n"); + } else { + sa_log( "compiler : " . `which compiler | grep compiler`); + sa_log( "TTCN3_DIR: <undefined>\n"); + } + sa_log("Location : $ENV{PWD}\n"); + sa_log( `$sa_compilerCmd -v 2>&1` . "\n"); + my $sa_nrOfTCs2Execute = scalar @sa_tcList2Execute; + my $sa_nrOfTCs2Executed = 1; + # test case execution + foreach my $poi (@sa_TCInfo) { + sa_log ("\n\n$sa_separator Executing test case: '$poi->[0]'\n"); + sa_log (" leaf: $poi->[5] ; mode: $poi->[1] ; source: $poi->[4] ;"); + sa_log (" index: $sa_nrOfTCs2Executed of $sa_nrOfTCs2Execute\n$sa_separator"); + opendir(DIR, '.') || die "can't opendir '.': $!"; + foreach my $f (readdir(DIR)) { $sa_existedFiles{$f} = $f; } + closedir DIR; + sa_writeModulesOfTC(@{$poi}); + my ($res, $resultBuffer) = sa_compileTC(@{$poi}); + if ($res == 1) { # error + sa_printResult($poi->[0], 'ERROR'); + $poi->[6] = 'ERROR'; + next; + } elsif ($res == 2) { # compiler hanged or terminated abnormally + sa_printResult($poi->[0], 'FAIL'); + $poi->[6] = 'FAIL'; + $poi->[8] = 'hanged or abnormal termination'; + next; + } + # Check result now + sa_checkTCResult(@{$poi}, $resultBuffer); + sa_deleteModulesOfTC(@{$poi}); + $sa_nrOfTCs2Executed++; + } + + sa_log("\n\n$sa_separator"); + + $flag = 0; + sa_log("The following test cases passed:\n"); + sa_log("================================\n"); + foreach my $poi (@sa_TCInfo) { + if ($poi->[6] eq 'PASS') { + sa_log(" [$poi->[4]]: '$poi->[0]' \n"); + $sa_executionStatistics[0]++; + $flag = 1; + } + } + if (not $flag) { sa_log(" None.\n"); } + + $flag = 0; + sa_log("The following test cases failed:\n"); + sa_log("================================\n"); + foreach my $poi (@sa_TCInfo) { + if ($poi->[6] eq 'FAIL') { + sa_log(" [$poi->[4]]: '$poi->[0]' \n"); + $sa_executionStatistics[1]++; + $flag = 1; + } + } + if (not $flag) { sa_log(" None.\n"); } + + $flag = 0; + sa_log("The following test cases are inconclusive:\n"); + sa_log("==========================================\n"); + foreach my $poi (@sa_TCInfo) { + if ($poi->[6] eq 'ERROR') { + sa_log(" [$poi->[4]]: '$poi->[0]' \n"); + $sa_executionStatistics[2]++; + $flag = 1; + } + } + if (not $flag) { sa_log(" None.\n"); } + + $flag = 0; + sa_log("\nMemory leak detected in the following test cases:\n"); + foreach my $poi (@sa_TCInfo) { + if (defined($poi->[7])) { + sa_log(" [$poi->[4]]: '$poi->[0]' \n"); + $sa_executionStatistics[4]++; + $flag = 1; + } + } + if (not $flag) { sa_log(" None.\n"); } + + $flag = 0; + sa_log("\nAbnormal termination occured during the following test cases:\n"); + foreach my $poi (@sa_TCInfo) { + if (defined($poi->[8])) { + sa_log(" [$poi->[4]]: '$poi->[0]' \n"); + $sa_executionStatistics[3]++; + $flag = 1; + } + } + if (not $flag) { sa_log(" None.\n"); } + + my $sa_nrOfTCs2Execute = scalar @sa_tcList2Execute; + my $nrOfScriptFiles = scalar @sa_scriptFiles; + sa_log("\n\n$sa_separator"); + sa_log("$sa_nrOfTCs2Execute test cases from $nrOfScriptFiles script files were executed\n"); + sa_log("Total number of executed test cases: $sa_nrOfTCs2Execute\n"); + sa_log(" PASSED test cases: $sa_executionStatistics[0]\n"); + sa_log(" FAILED test cases: $sa_executionStatistics[1]\n"); + sa_log(" INCONCLUSIVE test cases: $sa_executionStatistics[2]\n"); + sa_log(" Abnormally terminated test cases: $sa_executionStatistics[3]\n"); + sa_log(" Memory leaked test cases: $sa_executionStatistics[4]\n"); + if ($sa_nrOfTCs2Execute != $sa_executionStatistics[0] + $sa_executionStatistics[1] + + $sa_executionStatistics[2]) { sa_log( "INTERNAL ERROR: Statistics mismatch\n"); } + + if (defined($sa_LOG)) {sa_log("Session saved to log file '$sa_logFile'\n");} + return ($sa_nrOfTCs2Execute==$sa_executionStatistics[0]); +} + +############################################################################### +## M A I N +############################################################################### + +$sessionTime = time(); +$sa_compilerCmd = (defined $ENV{TTCN3_DIR}) ? + "$ENV{TTCN3_DIR}/bin/compiler" : 'compiler'; +$sa_mfgenCmd = (defined $ENV{TTCN3_DIR}) ? + "$ENV{TTCN3_DIR}/bin/ttcn3_makefilegen" : 'ttcn3_makefilegen'; +$sa_runtimeCmd = (defined $ENV{TTCN3_DIR}) ? + "$ENV{TTCN3_DIR}/bin/ttcn3_start" : 'ttcn3_start'; +sa_processCommandLine(); +sa_collectTCs(); +sa_parseTCs(); +my $isAllPassed = sa_executeTCs(); +$sessionTime = time() - $sessionTime; +sa_log("Elapsed time in this session: $sessionTime seconds\n"); +if (defined($sa_LOG)) { close $sa_LOG; } +exit($isAllPassed?0:1); diff --git a/conformance_test/negative_tests/Temp.ttcn b/conformance_test/negative_tests/Temp.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..edbb77fb72c7c7e1fe6291080a0b5e388e0aca7b --- /dev/null +++ b/conformance_test/negative_tests/Temp.ttcn @@ -0,0 +1,2 @@ +module Temp { +} diff --git a/conformance_test/negative_tests/run_test_all b/conformance_test/negative_tests/run_test_all new file mode 100755 index 0000000000000000000000000000000000000000..9d2e799ee18b3c7e0399f2b1dccc82d6b1ae9c3c --- /dev/null +++ b/conformance_test/negative_tests/run_test_all @@ -0,0 +1,16 @@ +#!/bin/bash + +SCRIPTFLAGS= +while [ $# -gt 0 ]; do +case $1 in +"-coverage") SCRIPTFLAGS+=" -coverage"; shift 1 ;; +"-rt2") SCRIPTFLAGS=" -rt2"; shift 1 ;; +*) echo "Usage: $0 [-rt2] [-coverage]"; exit 1 ;; +esac +done + +echo "Batch execution of SA tests: creating 1 report for each script file" +echo "You must have a symlink in this directory named perl and pointing to perl 5.6.0 or higher" + +echo "./perl ../Tools/SAtester.pl $SCRIPTFLAGS -log SA_log.report *.script" +./perl ../../function_test/Tools/SAtester.pl $SCRIPTFLAGS -log SA_log.report *.script