From 8930eefa15212ed2107f52cd56a83592be861e98 Mon Sep 17 00:00:00 2001 From: ethbaat Date: Tue, 12 Apr 2016 11:06:36 +0200 Subject: [PATCH] Added conformance_test/negative_tests Signed-off-by: ethbaat --- .../05_basic_language_elements.script | 8593 +++++++++++++++++ .../negative_tests/06_types_and_values.script | 8161 ++++++++++++++++ .../negative_tests/07-14_folder.script | 3105 ++++++ .../negative_tests/08_empty_modules.script | 288 + .../negative_tests/15_templates.script | 3854 ++++++++ .../negative_tests/16-20_folders.script | 4069 ++++++++ .../21_configuration_operations.script | 2478 +++++ .../22_communication_operations.script | 3726 +++++++ .../negative_tests/23-27-B_folders.script | 6279 ++++++++++++ .../negative_tests/24-26_misc_verdict.script | 1442 +++ conformance_test/negative_tests/README.txt | 8 + conformance_test/negative_tests/SAtester.pl | 954 ++ conformance_test/negative_tests/Temp.ttcn | 2 + conformance_test/negative_tests/run_test_all | 16 + 14 files changed, 42975 insertions(+) create mode 100644 conformance_test/negative_tests/05_basic_language_elements.script create mode 100644 conformance_test/negative_tests/06_types_and_values.script create mode 100644 conformance_test/negative_tests/07-14_folder.script create mode 100644 conformance_test/negative_tests/08_empty_modules.script create mode 100644 conformance_test/negative_tests/15_templates.script create mode 100644 conformance_test/negative_tests/16-20_folders.script create mode 100644 conformance_test/negative_tests/21_configuration_operations.script create mode 100644 conformance_test/negative_tests/22_communication_operations.script create mode 100644 conformance_test/negative_tests/23-27-B_folders.script create mode 100644 conformance_test/negative_tests/24-26_misc_verdict.script create mode 100644 conformance_test/negative_tests/README.txt create mode 100755 conformance_test/negative_tests/SAtester.pl create mode 100644 conformance_test/negative_tests/Temp.ttcn create mode 100755 conformance_test/negative_tests/run_test_all 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 000000000..b450c0848 --- /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. + + + + + + + +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 { + +} + + + +error: Cannot recognize file `NegSyn_05_TopLevel_001.ttcn' as an ASN.1 or TTCN-3 module. + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0501_identifiers_and_keywords folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } + +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0501_Identifier_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } + +} + + + +error: at or before token `component': syntax error, unexpected ComponentKeyword, expecting Identifier + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0502_scope_rules folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); +} + +} + + + +error: There is no local or imported definition with name `v_function' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); +} + +} + + + +error: There is no local or imported definition with name `v_control' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0502_Scope_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); +} + +} + + + +error: There is no local or imported definition with name `v_statement' + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0503_ordering_of_declarations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0503_Ordering_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: There is no local or imported definition with name `v_nested_statement' + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0504_parametrization folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0504_parametrization_incompatibility_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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)); +} + +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0504_forbidden_parametrization_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); +} + +} + + + +error: at or before token `timer': syntax error, unexpected TimerKeyword + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type mismatch: a value of type `@NegSem_050401_top_level_001.R2' was expected instead of `@NegSem_050401_top_level_001.R1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050401_top_level_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A template cannot have `out' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A template cannot have `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `out' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a static value was expected instead of variable `@NegSem_05040101_parameters_of_kind_value_008.GeneralComp.vc_int' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: There is no local or imported definition with name `p_int' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a static value was expected instead of the return value of function `@NegSem_05040101_parameters_of_kind_value_010.fx' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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)); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040101_parameters_of_kind_value_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; +} + + + +error: at or before token `\(': syntax error, unexpected '\(', expecting := or '\[' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); +} + + + +error: at or before token `integer': syntax error, unexpected IntegerKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); +} + + + +error: at or before token `integer': syntax error, unexpected IntegerKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 } +} + + + +error: at or before token `\(': syntax error, unexpected '\(', expecting '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + +error: at or before token `map': syntax error, unexpected MapKeyword, expecting InOutParKeyword or InParKeyword or OutParKeyword or '\}' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(', expecting ExtendsKeyword or '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); +} + + + +error: at or before token `integer': syntax error, unexpected IntegerKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; + } +} + + + +error: at or before token `\(': syntax error, unexpected '\(', expecting '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_05040101_parameters_of_kind_value_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; +} + + + +error: at or before token `\(': syntax error, unexpected '\(', expecting AllKeyword or '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Only modified templates are allowed to use the not used symbol \(`-'\) as the default parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A template cannot have `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A template cannot have `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Copying an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: There is no local or imported definition with name `p_int' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Unbound left operand of integer addition. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_05040102_parameters_of_kind_template_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `@lazy': syntax error, unexpected TitanSpecificLazyKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_001.m_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_006.m_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_011.m_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Reference to a value was expected instead of template `@NegSem_050402_actual_parameters_016.m_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Reference to a value was expected instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Reference to a value was expected instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + +error: Reference to a value was expected instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + +error: Reference to a value was expected instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of constant + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of function + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_028 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_032 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_033 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_034 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_035 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_036 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_037 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_038 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_039 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_040 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_041 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_042 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_043 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_044 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_045 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_046 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of module parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_047 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of constant + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_048 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_049 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_050 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_051 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `vm_msg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_052 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_053 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `out' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_054 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of `inout' template parameter `p_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_055 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template variable `v_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_056 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 }); + } +} + + + + error: Reference to a variable or value parameter was expected for an `inout' value parameter instead of template parameter `p_param' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_057 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_058 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of module parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_059 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_060 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of function + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_061 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_062 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_063 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_064 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of module parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_065 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_066 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of function + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_067 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_068 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_069 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_070 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_071 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter instead of constant + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_072 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_073 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a template variable or template parameter was expected for an `out' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_074 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_075 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_076 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_077 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_078 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_079 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_080 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_081 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_082 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_083 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_084 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_085 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_086 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_087 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_088 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_089 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_090 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_091 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + error: Reference to a template variable or template parameter was expected for an `inout' template parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_092 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + + 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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_093 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Using the value of an optional field containing omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_094 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to field `subfield1' of any or omit `@NegSem_050402_actual_parameters_094.mw_rec.field2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_095 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Matching with an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_096 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Matching with an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_097 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a string element of type `charstring' cannot be used in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_098 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a timer or timer parameter was expected for a timer parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_099 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a port or port parameter was expected for a port parameter instead of variable `v_val' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_100 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + +error: character string value was expected + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_101 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Too few parameters: 2 was expected instead of 1 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_102 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Not used symbol \(`-'\) cannot be used for parameter that does not have default value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_103 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `"': syntax error, unexpected Cstring + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_104 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `-': syntax error, unexpected '-' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_105 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `\)': syntax error, unexpected '\)' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_106 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Parameter not specified + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_107 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type mismatch: a value of type `@NegSem_050402_actual_parameters_107.R1' was expected instead of `@NegSem_050402_actual_parameters_107.R2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_108 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_109 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_111 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Restriction on template formal parameter does not allow usage of value range match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_112 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Restriction on template formal parameter does not allow usage of value list match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_113 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Restriction on template formal parameter does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_114 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to parameterized definition `mw_rec' without actual parameter list + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_115 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to parameterized definition `f_test' without actual parameter list + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_116 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + } +} + + + +error: at or before token `\)': syntax error, unexpected '\)', expecting '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_117 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + +error: at or before token `\{': syntax error, unexpected '\{' + + +error: at or before token `control': syntax error, unexpected ControlKeyword, expecting \$end + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_050402_actual_parameters_118 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + +error: The referenced template `@NegSem_050402_actual_parameters_118.mw_allInt' cannot have actual parameters + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0505_cyclic_definitions folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0505_cyclic_definitions_001 test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +error: Circular reference in constant definition `c_test1' + + +error: Circular reference in constant definition `c_test2' + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0505_cyclic_definitions_002 test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +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 +} + + + +error: Circular reference in constant definition `c_test1' + + +error: Circular reference in constant definition `c_test2' + + +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' + + + +: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 000000000..470ecac2e --- /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. + + + + + + +/*************************************************** + ** @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 +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: float value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: float value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: float value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0501_Identifier_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: verdict value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: Bitstring value contains invalid character + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: bitstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: bitstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: Invalid character `H' \(0x48\) in binary string + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: hexstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: hexstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: Octetstring value contains odd number of hexadecimal digits + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: octetstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: octetstring value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060101_TopLevel_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 +} + + + +error: Invalid character `H' \(0x48\) in binary string + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '00'B is not a valid value for type `bitstring' which has subtype length\(2\) except \('00'B\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '00'H is not a valid value for type `hexstring' which has subtype \('01'H,'10'H\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '00'O is not a valid value for type `octetstring' which has subtype \('01'O,'10'O\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "d" is not a valid value for type `charstring' which has subtype \("a","abc"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 2 is not a valid value for type `integer' which has subtype \(1,5\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010201_ListOfValues_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 2.0e0 is not a valid value for type `float' which has subtype \(1.0e0,5.0e0\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '11'B is not a valid value for type `bitstring' which has subtype length\(1..2\) except \('11'B\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '0014'O is not a valid value for type `octetstring' which has subtype \('0036'O,'0050'O,'0074'O,'0120'O\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "xyz" is not a valid value for type `charstring' which has subtype \("abc","def","ghi","jkl"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "\?" is not a valid value for type `universal charstring' which has subtype \(from\("0".."9","A".."Z"\) union from\("a".."z"\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 15 is not a valid value for type `integer' which has subtype \(0..9,20..30\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 1.55e1 is not a valid value for type `float' which has subtype \(1.0e0..9.0e0,2.0e1..3.0e1\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: true is not a valid value for type `boolean' which has subtype \(false\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010202_ListOfTypes_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: fail is not a valid value for type `verdicttype' which has subtype \(none,pass,inconc,error\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: -1 is not a valid value for type `integer' which has subtype \(0..255\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 1 is not a valid value for type `integer' which has subtype \(-infinity..0\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: upper boundary cannot be not_a_number in float subtype range + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: -3 is not a valid value for type `integer' which has subtype \(-2..0\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 0 is not a valid value for type `integer' which has subtype \(-infinity..-1\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Range subtyping is not allowed for type `boolean' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "a" is not a valid value for type `charstring' which has subtype from\("b".."e"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "f" is not a valid value for type `charstring' which has subtype from\("a".."e"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "g" is not a valid value for type `charstring' which has subtype from\("a".."f"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 1.0e0 is not a valid value for type `float' which has subtype \(-INF..0.0e0\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 1.0e1 is not a valid value for type `float' which has subtype \(-5.0e0..0.0e0\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 1.0e1 is not a valid value for type `float' which has subtype \(-1.0e0..!1.0e1\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abcgef" is not a valid value for type `charstring' which has subtype from\("a".."f"\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: upper boundary of a charstring subtype range cannot be infinity + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010203_Ranges_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: lower boundary of a charstring subtype range cannot be -infinity + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '111'B is not a valid value for type `bitstring' which has subtype length\(1..2\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '111'B is not a valid value for type `bitstring' which has subtype length\(2\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 'FE00'H is not a valid value for type `hexstring' which has subtype length\(3\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 'A'H is not a valid value for type `hexstring' which has subtype length\(2..infinity\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 'FE8001'O is not a valid value for type `octetstring' which has subtype length\(4\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 'FE'O is not a valid value for type `octetstring' which has subtype length\(2..infinity\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "a" is not a valid value for type `charstring' which has subtype length\(2..infinity\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010204_StringLengthRestrict_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abc" is not a valid value for type `charstring' which has subtype length\(2\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010204_StringLengthRestrict_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +error: The upper boundary of the length restriction \(1\) cannot be smaller than the lower boundary \(3\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010204_StringLengthRestrict_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +error: The upper boundary of the length restriction must be a non-negative integer value instead of -5 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06010205_StringPattern_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abcyz" is not a valid value for type `charstring' which has subtype pattern\(\?bc\*xyz\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06010205_StringPattern_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020601_MixingSubtype_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 4.0e0 is not a valid value for type `float' which has subtype \(-INF..3.142e0,NaN\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020601_MixingSubtype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 6 is not a valid value for type `integer' which has subtype \(1,5,10,100..infinity\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abcyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abc123xyz" is not a valid value for type `charstring' which has subtype \(pattern\(\?bc\*xyz\) intersection length\(5..8\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: "abc1xyz" is not a valid value for type `charstring' which has subtype \(from\("a".."z"\) intersection length\(3..8\)\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '111'B is not a valid value for type `bitstring' which has subtype \('101010'B,'111111'B\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: '1F1'H is not a valid value for type `hexstring' which has subtype \('103A10'H,'111111'H\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0601020602_StringMixing_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 'FF1111'O is not a valid value for type `octetstring' which has subtype \('101010A3'O\) + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 0602_structured_types_and_values folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: union value was expected for type `@NegSem_0602_TopLevel_001.MyUnion' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type `@NegSem_0602_TopLevel_002.MyRecord' cannot be indexed + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type `@NegSem_0602_TopLevel_003.MySet' cannot be indexed + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0602_TopLevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type `@NegSem_0602_TopLevel_004.MyUnion' cannot be indexed + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice1' -> `@NegSyn_0602_TopLevel_001.MyUnion' + + +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_001.MyUnion' -> `@NegSyn_0602_TopLevel_001.MyUnion.choice2' -> `@NegSyn_0602_TopLevel_001.MyUnion' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: While checking embedded recursions: Circular reference: `@NegSyn_0602_TopLevel_002.MyRecord' -> `@NegSyn_0602_TopLevel_002.MyRecord.field2' -> `@NegSyn_0602_TopLevel_002.MyRecord' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0602_TopLevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: at or before token `"': syntax error, unexpected Cstring + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060201_RecordTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060201_RecordTypeValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: While checking referenced type: Circular reference: `@NegSem_06020101_ReferencingRecordFields_002.R.field2' -> `@NegSem_06020101_ReferencingRecordFields_002.R.field2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Unbound left operand of integer comparison. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020101_ReferencingRecordFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Using the value of an optional field containing omit. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060202_SetTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060202_SetTypeValues_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060202_SetTypeValues_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +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\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_003.RoI' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_004.SoI' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_005.RoI' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A non-negative integer value was expected for indexing type `@NegSem_060203_records_and_sets_of_single_types_006.SoI' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +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. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +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. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Text encoder: Encoding an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060203_records_and_sets_of_single_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: at or before token `,': syntax error, unexpected ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: Duplicate enumeration identifier `Monday' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: Duplicate numeric value 2 for enumeration `Wednesday' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: enumerated value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type mismatch: a value of type `integer' was expected instead of `@NegSem_060204_enumerated_type_and_values_004.EDays' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060204_enumerated_type_and_values_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Cannot determine the type of the operands in operation `!=' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060204_enumerated_type_and_values_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: at or before token `c_int': syntax error, unexpected Identifier, expecting Number or '-' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060204_enumerated_type_and_values_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + }; +} + + + +error: at or before token `\+': syntax error, unexpected '\+', expecting '\)' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Only one field was expected in union value instead of 2 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to non-existent field `option3' in union value for type `@NegSem_060205_top_level_002.U' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: union value was expected for type `@NegSem_060205_top_level_005.U' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060205_top_level_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: Duplicate union field name `option1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_001.U' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to non-existent field `option3' in type `@NegSem_06020501_referencing_fields_of_union_type_002.U' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: 100 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Using non-selected field option2 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_006.U. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Using non-selected field option1 in a value of union type @NegSem_06020501_referencing_fields_of_union_type_007.U. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06020501_referencing_fields_of_union_type_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Using the value of an optional field containing omit. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_06020502_option_and_union_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + } +} + + + +error: at or before token `optional': syntax error, unexpected OptionalKeyword, expecting '\}' or ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/**************************************************** + ** @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" +} + + + +Dynamic test case error: Using non-selected field integer in a value of union type @NegSem_060206_anytype_001.anytype + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/**************************************************** + ** @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" +} + + + +error: Type `address' is not defined in this module + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060206_anytype_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/**************************************************** + ** @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" +} + + + +error: Port type `@NegSyn_060206_anytype_002.MyPort' cannot be embedded into another type + + +error: Reference to a value was expected instead of port `@NegSyn_060206_anytype_002.GeneralComp.PCO1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: 11 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Too many elements in the array value: 5 was expected instead of 7 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index underflow: the index value must be at least `0' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index underflow: the index value must be at least `0' instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index overflow: the index value must be at most `4' instead of `5' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index overflow: the index value must be at most `4' instead of `5' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: 0 is not a valid value for type `integer' which has subtype \(1..10\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_011.f' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to a constant value was expected instead of the return value of function `@NegSem_060207_arrays_012.f' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to a constant value was expected instead of variable `v_dimension' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to an \(evaluatable\) constant value was expected instead of module parameter `@NegSem_060207_arrays_014.PX_DIMENSION' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A positive integer value was expected as array size instead of `0' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A positive integer value was expected as array size instead of `-1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index underflow: the index value must be at least `2' instead of `0' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index underflow: the index value must be at least `2' instead of `0' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index overflow: the index value must be at most `5' instead of `6' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Array index overflow: the index value must be at most `5' instead of `6' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Assignment of an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Copying an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_028 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Using the value of an optional field containing omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: at or before token `,': syntax error, unexpected ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: at or before token `\]': syntax error, unexpected '\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: at or before token `\]': syntax error, unexpected '\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060207_arrays_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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]; + } +} + + + +error: A value or expression of type integer was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060209_CommunicationPortTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"} + +} + + + +error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060209_CommunicationPortTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"} + +} + + + +error: at or before token `\}': syntax error, unexpected '\}', expecting InOutParKeyword or InParKeyword or OutParKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_002.MyCompB + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_060210_ReuseofComponentTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Local definition `MyInt' collides with definition inherited from component type `@NegSyn_060210_ReuseofComponentTypes_003.MyCompA + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +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\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +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\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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); + +} + + + +error: at or before token `!': syntax error, unexpected '!' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021301_LengthSubtyping_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +error: at or before token `!': syntax error, unexpected '!' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021302_ListSubtyping_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +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" \}\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_06021302_ListSubtyping_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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 + +} + + + +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" \}\) + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 0603_type_compatibility folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_060301_non_structured_types_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `integer\[1\]' was expected instead of `integer\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060301_non_structured_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `float\[1\]' was expected instead of `float\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_001.EnumeratedRedefinition' was expected instead of `@NegSem_060302_structured_types_001.EnumeratedType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_002.RecordType2' was expected instead of `@NegSem_060302_structured_types_002.RecordType1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_003.RecordType' was expected instead of `@NegSem_060302_structured_types_003.ModifiedRecord' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_004.SetType' was expected instead of `@NegSem_060302_structured_types_004.ModifiedSet' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_005.SetType' was expected instead of `@NegSem_060302_structured_types_005.ModifiedSet' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_008.UnionType' was expected instead of `@NegSem_060302_structured_types_008.ModifiedUnion' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_009.UnionType' was expected instead of `@NegSem_060302_structured_types_009.ModifiedUnion' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); +} + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_010.UnionType' was expected instead of `@NegSem_060302_structured_types_010.ModifiedUnion' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +module NegSem_060302_structured_types_011_importA { + type integer I (0..2); + type anytype Atype; + } + + + +module NegSem_060302_structured_types_011_importB { + type integer I (0..2); + type integer F; + type anytype Atype; +} + + + +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' + + +error: The operands of operation `==' should be of compatible types + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.RecordType' was expected instead of `@NegSem_060302_structured_types_012.ShortIntegerList' + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_012.SetType' was expected instead of `@NegSem_060302_structured_types_012.ShortUnorderedIntegerList' + + +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_012.RecordType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.RecordType' was expected instead of `@NegSem_060302_structured_types_013.ShortIntegerList' + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_013.SetType' was expected instead of `@NegSem_060302_structured_types_013.ShortUnorderedIntegerList' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_014.RecordType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_015.IntegerList' was expected instead of `@NegSem_060302_structured_types_015.RecordType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `integer\[2\]' was expected instead of `@NegSem_060302_structured_types_016.SetType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_017.IntegerList' was expected instead of `@NegSem_060302_structured_types_017.SetType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `integer\[3\]' was expected instead of `@NegSem_060302_structured_types_018.SetType' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060302_structured_types_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.RecordType' was expected instead of `@NegSem_060302_structured_types_019.ShortIntegerList' + + +error: Type mismatch: a value of type `@NegSem_060302_structured_types_019.SetType' was expected instead of `@NegSem_060302_structured_types_019.ShortUnorderedIntegerList' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060303_component_types_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060303_component_types_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +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' + + + +: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 000000000..98053557d --- /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. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of a call of function `@NegSem_07_toplevel_001.f', which does not have return type + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_07_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of template variable `vm_num' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_07_toplevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Using the value of an optional field containing omit. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Second operand of operation `\*' should be integer or float value + + +error: The operands of operation `\*' should be of same type + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: The operands of operation `\*' should be of same type + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Left operand of operation `mod' should be integer value + + +error: Right operand of operation `mod' should be integer value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Left operand of operation `rem' should be integer value + + +error: Right operand of operation `rem' should be integer value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: The right operand of mod operator is zero. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Integer division by zero. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070101_ArithmeticOperators_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +Dynamic test case error: Integer division by zero. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Left operand of operation `&' should be a string, `record of' or `set of' value + + +error: Right operand of operation `&' should be a string, `record of' or `set of' value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Left operand of operation `&' should be a string, `record of' or `set of' value + + +error: Right operand of operation `&' should be a string, `record of' or `set of' value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_070103_RelationalOperators_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} + +} + + + +error: Left operand of operation `&' should be a string, `record of' or `set of' value + + +error: Right operand of operation `&' should be a string, `record of' or `set of' value + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 08_modules folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSyn_0801_DefinitionOfAModule_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error: at or before token `,': syntax error, unexpected ',', expecting '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 +} + + + +module NegSem_08020301_GeneralFormatOfImport_002_import { + type enumerated EnumType {enumX, enumY, enumZ}; + type enumerated EnumType2 {enumX, enumY, enumZ}; + +} + + + +error: Type mismatch: a value of type `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType' was expected instead of `@NegSem_08020301_GeneralFormatOfImport_002_import.EnumType2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} +} + + + + +module NegSem_08020301_GeneralFormatOfImport_003_import { + public import from NegSem_08020301_GeneralFormatOfImport_003_import_2 all; +} + + + + +module NegSem_08020301_GeneralFormatOfImport_003_import_2 { + const integer c_myconst := 43532; +} + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} +} + + + + +module NegSem_08020301_GeneralFormatOfImport_004_import { + import from NegSem_08020301_GeneralFormatOfImport_004_import_2 all; +} + + + + +module NegSem_08020301_GeneralFormatOfImport_004_import_2 { + const integer c_myconst := 43532; +} + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} +} + + + + + +module NegSem_08020301_GeneralFormatOfImport_005_import { + const integer c_test := 5; +} + + + + +error: There is no definition with name `c_test' in module `NegSem_08020301_GeneralFormatOfImport_005' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} +} + + + + +module NegSem_08020301_GeneralFormatOfImport_006_import { + control { + const integer c_test := 5; + } +} + + + + + +error: There is no local or imported definition with name `c_test' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020301_GeneralFormatOfImport_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); +} +} + + + + +module NegSem_08020301_GeneralFormatOfImport_007_import { + type port P message { + inout integer; + } +} + + + + + +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_08020301_GeneralFormatOfImport_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + + +module NegSyn_08020301_GeneralFormatOfImport_001_import { + const integer c_test := 5; +} + + + + +error: at or before token `import': syntax error, unexpected ImportKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_08020301_GeneralFormatOfImport_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + + +module NegSyn_08020301_GeneralFormatOfImport_002_import { + const integer c_test := 5; +} + + + + +error: at or before token `import': syntax error, unexpected ImportKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importA { + private import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB all; +} + + + + + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_001_importB { + const integer c_myconst := 43532; +} + + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + + +module Sem_08020307_ImportingOfImportStatementsFromT3Modules_002_importA { + // imports are private by default + import from NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB all; +} + + + + + +module NegSem_08020307_ImportingOfImportStatementsFromT3Modules_002_importB { + const integer c_myconst := 43532; +} + + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080204_DefinitionOfFriendModules_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_080204_DefinitionOfFriendModules_001_import { + friend const integer c_myconst := 32532; +} + + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080204_DefinitionOfFriendModules_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_080204_DefinitionOfFriendModules_002_import { + friend module NegSem_080204_DefinitionOfFriendModules_001; + + private const integer c_myconst := 32532; +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + + +module NegSem_080205_VisibilityOfDefinitions_001_import { + private const integer c_myconst := 32532; +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + + + +module NegSem_080205_VisibilityOfDefinitions_002_import { + friend module NegSem_080205_VisibilityOfDefinitions_002; + + private const integer c_myconst := 32532; +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_080205_VisibilityOfDefinitions_003_import { + group CONST_GROUP { + friend const integer c_myconst := 32532; + } +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_080205_VisibilityOfDefinitions_004_import { + group CONST_GROUP { + private const integer c_myconst := 32532; + } +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + + +module NegSem_080205_VisibilityOfDefinitions_005_import { + friend module NegSem_080205_VisibilityOfDefinitions_005; + + group CONST_GROUP { + private const integer c_myconst := 32532; + } +} + + + + +error: There is no local or imported definition with name `c_myconst' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_080205_VisibilityOfDefinitions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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; + } + +} + + + +error: at or before token `control': syntax error, unexpected ControlKeyword, expecting '\{' or '\}' + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 09_test_configurations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Both arguments of map operation refer to system ports. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Both endpoints of the mapping are system ports + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_0901_Communication_ports_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: The `system' component reference shall not be used in `connect' operation + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0902_Communication_ports_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Both endpoints of the mapping are system ports + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 10_constants folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: An evaluatable constant value was expected instead of operation `rnd \(seed\)' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a variable or template variable was expected instead of constant `@NegSem_10_Constants_002.c_i' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_10_Constants_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Constant cannot be defined for port type `@NegSem_10_Constants_003.MyMessagePortType' + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 11_variables folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1101_ValueVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: at or before token `\?': syntax error, unexpected '\?' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1101_ValueVars_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: The left operand of comparison is an unbound optional value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1101_ValueVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; +} + + + +error: at or before token `var': syntax error, unexpected VarKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1102_TemplateVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Copying an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1102_TemplateVars_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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; +} + + + +error: at or before token `var': syntax error, unexpected VarKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 12_timers folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + + + } +} + + + +error: A non-negative float value was expected as timer duration instead of `-1.0e0' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A non-negative float value was expected as timer duration instead of `-1.0e0' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: Missing duration: timer `@NegSem_12_toplevel_timer_003.TComp.t_timer' does not have default duration + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Missing duration: timer `@NegSem_12_toplevel_timer_004.TComp.t_timer' does not have default duration + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: Missing duration: timer `@NegSem_12_toplevel_timer_005.TComp.t_timer' does not have default duration + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: A value or expression of type float was expected + + +error: Reference to single timer `@NegSem_12_toplevel_timer_006.TComp.t_timer' cannot have field or array sub-references + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: Too few elements in the default duration of timer array: 4 was expected instead of 3 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_12_toplevel_timer_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: An array value \(with 4 elements\) was expected as default duration of timer array + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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)) + } + + } +} + + + +error: There is no local or imported definition with name `t_timer' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: at or before token `:=': syntax error, unexpected :=, expecting Identifier + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: at or before token `;': syntax error, unexpected ';' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: at or before token `0.0': syntax error, unexpected FloatValue + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: A value or expression of type float was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: at or before token `1.0': syntax error, unexpected FloatValue, expecting Identifier + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSyn_12_toplevel_timer_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()) + } +} + + + +error: at or before token `1.0': syntax error, unexpected FloatValue, expecting '\}' or ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 14_procedure_signatures folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. egSem_1400_procedure_signatures_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: A non-blocking signature cannot have `out' parameter + + + +:exmp + +*---------------------------------------------------------------------* +:h3. egSem_1400_procedure_signatures_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Response and exception handling part is missing from blocking call operation + + + +: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 000000000..fb0a09665 --- /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. + + + + + + +/***************************************************************** + ** @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 { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +:exmp + +*---------------------------------------------------------------------* +:h3. Syn_0801_DefinitionOfAModule_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" { + +} + + + +error + + + +: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 000000000..7c70914a0 --- /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. + + + + + + +/***************************************************************** + ** @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 + } +} + + + +error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_001.t' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } +} + + + +error: Reference to a variable or template variable was expected instead of template `t' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } +} + + + +error: Reference to a variable or template variable was expected instead of template `@NegSem_1503_GlobalAndLocalTemplates_003.t' + + +error: Reference to parameterized definition `t' without actual parameter list + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1503_GlobalAndLocalTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } +} + + + +error: Reference to a variable or template variable was expected instead of template `t' + + +error: Reference to parameterized definition `t' without actual parameter list + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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; +} + + + +error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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; + } +} + + + +error: at or before token `;': syntax error, unexpected ';', expecting ModifiesKeyword or := or '\(' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); +} + + + +error: at or before token `;': syntax error, unexpected ';', expecting := + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1503_GlobalAndLocalTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: at or before token `;': syntax error, unexpected ';', expecting := + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1505_modified_templates folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +error: While checking the chain of base templates: Circular reference: `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' -> `@NegSem_1505_ModifiedTemplates_001.m_myOtherTemplate' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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" + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +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' + + +error: integer value was expected + + +error: Not used symbol \(`-'\) doesn't have the corresponding default parameter in the base template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1505_ModifiedTemplates_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1505_ModifiedTemplates_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 + } + +} + + + +error: Duplicate definition with name `m_templateTwo' + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1506_referencing_elements_of_templates_or_template_fields folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_150601_ReferencingIndividualStringElements_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Reference to template variable `m_char1' can not be indexed + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_001.MyRecordTwo. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + + +} + + + +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_003.MyRecordTwo. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Copying an uninitialized/unsupported template of type @NegSem_150602_ReferencingRecordAndSetFields_004.MyRecordTwo. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Accessing field f1 of a non-specific template of type @NegSem_150602_ReferencingRecordAndSetFields_005.MyRecordOne. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_001.RoRoI. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific template of type @PreGenRecordOf.PREGEN_SET_OF_INTEGER. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Matching with an uninitialized/unsupported integer template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Copying an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Copying an uninitialized/unsupported integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Assignment of an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Accessing an element of a non-specific template for type @NegSem_150603_ReferencingRecordOfAndSetElements_014.SoSoI. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150602_ReferencingRecordAndSetFields_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150605_Referencing_union_alternatives_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_001.My_Union + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_150605_Referencing_union_alternatives_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Accessing field u1 in a non-specific template of union type @NegSem_150605_Referencing_union_alternatives_002.My_Union. + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1508_template_restrictions folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 := ?; + +} + + + +error: Restriction on template definition does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}); + +} + + + +error: Restriction on template definition does not allow usage of value list match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 := *; + +} + + + +error: Restriction on template definition does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of value range match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of superset match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of subset match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"}; + +} + + + +error: Restriction on template definition does not allow usage of character string pattern + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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, ?}; + +} + + + +error: Restriction on template definition does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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, *}; + +} + + + +error: Restriction on template definition does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"}; + +} + + + +error: Restriction on template definition does not allow usage of permutation match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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)}; + +} + + + +error: Restriction on template definition does not allow usage of length restriction + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of `ifpresent' + + +error: `ifpresent' is not allowed here + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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)}; + +} + + + +error: Restriction on template definition does not allow usage of complemented list match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 := ?; + +} + + + +error: Restriction on template definition does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}); + +} + + + +error: Restriction on template definition does not allow usage of value list match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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 := *; + +} + + + +error: Restriction on template definition does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of value range match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of superset match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of subset match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"}; + +} + + + +error: Restriction on template definition does not allow usage of character string pattern + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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, ?}; + + +} + + + +error: Restriction on template definition does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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"}; + +} + + + +error: Restriction on template definition does not allow usage of permutation match + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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)}; + +} + + + +error: Restriction on template definition does not allow usage of length restriction + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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}; + +} + + + +error: Restriction on template definition does not allow usage of `ifpresent' + + +error: `ifpresent' is not allowed here + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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; + +} + + + +error: Restriction on template definition does not allow usage of omit value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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; + +} + + + +error: Restriction on template definition does not allow usage of omit value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of omit value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_032 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_033 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_034 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of omit value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1508_TemplateRestrictions_035 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Restriction on template does not allow usage of omit value + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1509_match_operation folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1509_MatchOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Reference to a value was expected instead of template `@NegSem_1509_MatchOperation_001.m_second' + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1510_valueof_operation folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: A specific value was expected instead of any value + + +error: A specific value was expected instead of any or omit + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1510_ValueOfOperation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +Dynamic test case error: Performing a valueof or send operation on a non-specific integer template + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 1511_concatenating_templates_of_string_and_list_types folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Octetstring match contains half octet\(s\) + + +error: at or before token `'O': syntax error, unexpected OctetStringMatch + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Octetstring value contains odd number of hexadecimal digits + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `\*': syntax error, unexpected '\*' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `\*': syntax error, unexpected '\*', expecting Identifier or Cstring or CharKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1511_ConcatenatingTemplatesOfStringAndListTypes_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `\?': syntax error, unexpected '\?' + + +error: at or before token `else': syntax error, unexpected ElseKeyword + + + +: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 000000000..d639dcab1 --- /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. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The operands of operation `==' should be of compatible types + + +error: Incompatible value: `float' value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to a value was expected instead of template parameter `p_ostring' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The function has return type, but control might leave it without reaching a return statement + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There is no local or imported definition with name `v_comp' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: The operand of operation `int2char\(\)' should be in range 0..127 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: The operand of operation `int2char\(\)' should be in range 0..127 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The operand of operation `int2char\(\)' should be in range 0..127 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Value 256 does not fit in length 2 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The operand of operation `char2int\(\)' should be of length 1 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: Performing lengthof\(\) operation on a hexstring template with no exact length. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There are fewer \(1\) elements in the string than it is allowed by the length restriction \(3\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: Performing lengthof\(\) operation on a bitstring template with no exact length. + + + +:exmp + + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There are more \(at least 3\) elements in the template than it is allowed by the length restriction \(at most 2\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Third operand of operation `regexp\(\)' should not be negative + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: at or before token `\)': syntax error, unexpected '\)', expecting ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Second operand of operation `substr\(\)' should not be negative + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Third operand of operation `substr\(\)' should not be negative + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The sum of second operand `index' \(3\) and third operand `returncount' \(14\) is greater than the length of the first operand \(8\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_024 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Second operand of operation `replace\(\)' should not be negative + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_025 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Third operand of operation `replace\(\)' should not be negative + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_026 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The sum of second operand `index' \(1\) and third operand `len' \(13\) is greater than the length of the first operand \(8\) + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_027 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Fourth operand of operation `replace\(\)' is of type `hexstring', but a value of type `bitstring' was expected here + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_029 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: Reference to a value was expected instead of type `@NegSem_160102_predefined_functions_029.EnumeratedTypeWithLabels1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_030 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: Assigning invalid numeric value 4 to a variable of enumerated type @NegSem_160102_predefined_functions_030.EnumeratedTypeWithLabels1. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_031 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: The operand of operation `rnd \(seed\)' cannot be INF, it must be a numeric value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_036 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: The first argument of function substr\(\) is a template with non-specific value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160102_predefined_functions_037 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: The first argument of function substr\(\) is a template with non-specific value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1602_toplevel_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There is no local or imported definition with name `messagePort' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1602_toplevel_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1602_toplevel_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: at or before token `var': syntax error, unexpected VarKeyword, expecting '\}' or '\[' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_160201_invoking_altsteps_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. 1603_testcases folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1603_testcases_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: A definition that has `runs on' clause cannot execute testcases + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1603_testcases_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Reference to a function or altstep was expected instead of testcase `@NegSem_1603_testcases_002.TC_fail', which cannot be invoked + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 19_basic_program_statements folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +Dynamic test case error: Assignment of an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: integer value was expected + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: A template body with matching symbols cannot be assigned to a variable + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1901_assignments_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: `omit' value is not allowed in this context + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1901_assignments_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: at or before token `:=': syntax error, unexpected :=, expecting ',' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1902_if_else_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: at or before token `setverdict': syntax error, unexpected SetVerdictKeyword, expecting '\{' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1904_for_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There is no local or imported definition with name `v_i' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1905_while_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There is no local or imported definition with name `v_j' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1906_do_while_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +error: There is no local or imported definition with name `v_j' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1907_label_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Duplicate label `L1' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1907_label_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `label': syntax error, unexpected LabelKeyword, expecting '\}' or '\[ + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_1907_label_statement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `label': syntax error, unexpected LabelKeyword + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Label `L2' is used, but not defined + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + + } + +} + + + +error: Label `L1' is used, but not defined + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1908_goto_statement_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + + } + +} + + + +error: Label `L1' is used, but not defined + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1910_return_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + + } + +} + + + +error: Return statement cannot be used in a testcase. It is allowed only in functions and altsteps + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1911_log_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + + } + +} + + + +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 + + + +:exmp + +.*---------------------------------------------------------------------* +:h2. 20_statement_and_operations_for_alt folder +.*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_2002_TheAltStatement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: None of the branches can be chosen in the alt statement in file NegSem_2002_TheAltStatement_001.ttcn + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2003_the_repeat_statement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Repeat statement cannot be used outside alt statements, altsteps or response and exception handling part of call operations + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Goto statement is not allowed within an interleave statement + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Repeat statement is not allowed within an interleave statement + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Return statement is not allowed within an interleave statement + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_2004_InterleaveStatement_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Invocation of an altstep is not allowed within an interleave statement + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2004_InterleaveStatement_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: at or before token `else': syntax error, unexpected ElseKeyword, expecting '\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSyn_2004_InterleaveStatement_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: at or before token `v': syntax error, unexpected Identifier, expecting '\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200501_the_default_mechanism_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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); + } +} + + + +Dynamic test case error: None of the branches can be chosen in the alt statement in file NegSem_200501_the_default_mechanism_001.ttcn + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to an altstep was expected in the argument instead of function `@NegSem_200502_the_activate_operation_005.f' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200502_the_activate_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200503_the_deactivate_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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); + } +} + + + +Dynamic test case error: Performing a deactivate operation on an unbound default reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_200503_the_deactivate_operation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: A value or expression of type default was expected + + + +: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 000000000..f213b10ef --- /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. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: The `system' component reference shall not be used in `connect' operation + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_1601_toplevel_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Both arguments of map operation refer to test component ports. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210101_connect_and_map_operations_008.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210101_connect_and_map_operations_010.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_and_map_operations_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210101_connect_and_map_operations_013.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + +error: The connection between port types `@NegSem_210101_connect_operation_001.myport' and `@NegSem_210101_connect_operation_001.myport' is not consistent + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210101_connect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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 + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + + +Dynamic test case error: Both arguments of unmap operation refer to test component ports. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_008.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_010.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_and_unmap_operations_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Component type `@NegSem_210102_disconnect_and_unmap_operations_013.GeneralComp' does not have port with name `p2' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210102_disconnect_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + + + error: The `system' component reference shall not be used in `disconnect' operation + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 2102_test_case_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_2102_testcase_stop_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +Dynamic test case error: testcase.stop + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 2103_test_component_operations folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: First operand of operation `create\(\)' should be charstring value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: First operand of operation `create\(\)' should be charstring value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210301_CreateOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Second operand of operation `create\(\)' should be charstring value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210302_Start_test_component_002.Rectype' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Reference to a function was expected in the argument instead of altstep `@NegSem_210302_Start_test_component_003.a_test' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210302_Start_test_component_006.R' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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'' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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'' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210302_Start_test_component_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } +} + + + +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'' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Error message was received from MC: PTC with component reference 3 cannot be started because it is not alive anymore. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Operation 'all component.stop' can only be performed on the MTC. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210303_Stop_test_component_003.GeneralComp\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210303_Stop_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210303_Stop_test_component_004.GeneralComp\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: PTC with component reference 3 is not alive anymore. Start operation cannot be performed on it. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +Dynamic test case error: Operation 'all component.kill' can only be performed on the MTC. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210304_kill_test_component_004.GeneralComp\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210304_kill_test_component_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Type mismatch: The type of the operand should be a component type instead of `@NegSem_210304_kill_test_component_005.GeneralComp\[2\]' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210307_done_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: Reference to a value was expected instead of type `@NegSem_210307_done_operation_001.GeneralComp' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_210308_killed_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } +} + + + +error: at or before token `killed': syntax error, unexpected DotKilledKeyword, expecting DotKillKeyword + + + +: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 000000000..8879176af --- /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. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A specific value was expected instead of any or omit + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: A specific value was expected instead of any value + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Incompatible explicit type specification: `integer' was expected instead of `float' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Message-based operation `send' is not applicable to a procedure-based port of type `@NegSem_220201_SendOperation_004.remotePort' + + +error: The type of send parameter is signature `@NegSem_220201_SendOperation_004.p_NegSem_220201_SendOperation_004', which cannot be a message type + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: Port p has more than one active connections. Message can be sent on it only with explicit addressing. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: Text encoder: Encoding an unbound integer value. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Cannot determine the type of the outgoing message + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220201_SendOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: Port p has neither connections nor mappings. Message cannot be sent on it. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Message-based operation `receive' is not applicable to a procedure-based port of type `@NegSem_220202_ReceiveOperation_001.remotePort' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Cannot determine the type of the incoming message + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Type mismatch in value redirect: A variable of type `integer' was expected instead of `charstring' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Value redirect cannot be used without receive parameter + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220202_ReceiveOperation_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `integer' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Message-based operation `trigger' is not applicable to a procedure-based port of type `@NegSem_220203_TriggerOperation_001.remotePort' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Cannot determine the type of the incoming message + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Type mismatch in value redirect: A variable of type `integer' was expected instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_010 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_011 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Incompatible explicit type specification: `integer' was expected instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_012 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Value redirect cannot be used without receive parameter + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_014 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `charstring' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_015 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220203_TriggerOperation_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: The type of the variable should be a component type instead of `integer' + + + + +:exmp + +*---------------------------------------------------------------------* +:h2. 2203_procedure_based_communication folder +.*---------------------------------------------------------------------* + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Procedure-based operation `call' is not applicable to a message-based port of type `@NegSem_220301_CallOperation_001.loopbackPort' + + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: A call with `nowait' keyword cannot have response and exception handling part + + +error: Catching of `timeout' exception is not allowed because the previous `call' operation does not have timer + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220301_CallOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + + +/***************************************************************** + ** @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); + } + +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Procedure-based operation `getcall' is not applicable to a message-based port of type `@NegSem_220302_GetcallOperation_001.loopbackPort' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: at or before token `value': syntax error, unexpected ValueKeyword, expecting ParamKeyword or SenderKeyword + + +error: at or before token `testcase': syntax error, unexpected TestcaseKeyword, expecting \$end + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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()); + } + +} + + + +error: Parameter redirect cannot be used without signature template + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220302_GetcallOperation_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220303_ReplyOperation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/*************************************************** + ** @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()); + } + +} + + + +error: Procedure-based operation `reply' is not applicable to a message-based port of type `@NegSem_220303_ReplyOperation_001.loopbackPort' + + +error: The type of parameter is `integer', which is not a signature + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220303_ReplyOperation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/*************************************************** + ** @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); + } + +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220304_getreply_operation_013 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +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' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_001 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Type `integer' is not present on the exception list of signature `@NegSem_220305_raise_operation_001.S' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Signature `@NegSem_220305_raise_operation_002.S' does not have exceptions + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_003 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Type of the exception is ambiguous: `integer' is compatible with more than one exception types of signature `@NegSem_220305_raise_operation_003.S' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: Port p has more than one active connections. Message can be sent on it only with explicit addressing. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_005 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Procedure-based operation `raise' is not applicable to a message-based port of type `@NegSem_220305_raise_operation_005.PMsg' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: Signature `@NegSem_220305_raise_operation_006.S2' is not present on the incoming list of port type `@NegSem_220305_raise_operation_006.P' + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + +/***************************************************************** + ** @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); + } +} + + + +error: A component reference was expected as operand + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_008 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220305_raise_operation_009 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: Port p has neither connections nor mappings. Message cannot be sent on it. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220306_catch_operation_006 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + + + + + + + +/***************************************************************** + ** @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); + } +} + + + +Dynamic test case error: The second argument of connect operation contains the null component reference. + + + +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_220306_catch_operation_007 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +