Skip to content
Snippets Groups Projects
Commit d4e9a25e authored by Adrien Kirjak's avatar Adrien Kirjak
Browse files

Added new tests from etsi and updated SoC document


Signed-off-by: default avatarAdrien Kirjak <adrien.kirjak@ericsson.com>
parent d2f16dfb
No related branches found
No related tags found
1 merge request!119Added new tests from etsi and updated SoC document
Showing
with 9160 additions and 3145 deletions
...@@ -746,6 +746,287 @@ error: Right operand of operation `&' should be a string, `record of' or `set of ...@@ -746,6 +746,287 @@ error: Right operand of operation `&' should be a string, `record of' or `set of
:h2. 08_modules folder :h2. 08_modules folder
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
:h3. NegSem_080201_ModuleParameters_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_001 Ensure that a port, default or component types cannot be module parameters. >
<COMPILE>
<MODULE TTCN NegSem_080201_ModuleParameters_001 NegSem_080201_ModuleParameters_001.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that a port, default or component types cannot be module parameters.
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
/* Restriction B: Module parameters shall not be of port type,
* default type or component type and shall not be of a structured type that contains a sub-element of
* port type at any level of nesting.*/
module NegSem_080201_ModuleParameters_001 {
type port MyMessagePortType message {
inout integer
} with {extension "internal"}
modulepar MyMessagePortType MY_PORT; // not allowed
type component GeneralComp {
}
testcase TC_NegSem_080201_ModuleParameters_001() runs on GeneralComp {
if (MY_PORT.checkstate("Started")) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_080201_ModuleParameters_001());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Type of module parameter cannot be or embed port type `@NegSem_080201_ModuleParameters_001.MyMessagePortType'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_080201_ModuleParameters_004 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_004 Ensure that module parameters remain constant. >
<COMPILE>
<MODULE TTCN NegSem_080201_ModuleParameters_004 NegSem_080201_ModuleParameters_004.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that module parameters remain constant.
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
/* Restriction B: Module parameters shall not be of port type,
* default type or component type and shall not be of a structured type that contains a sub-element of
* port type at any level of nesting.*/
module NegSem_080201_ModuleParameters_004 {
modulepar integer MY_INT := 2;
type component GeneralComp {
}
testcase TC_NegSem_080201_ModuleParameters_004() runs on GeneralComp {
MY_INT := 3; // not allowed to change module parameter
if (MY_INT == 2) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_080201_ModuleParameters_004());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Reference to a variable or template variable was expected instead of module parameter `@NegSem_080201_ModuleParameters_004.MY_INT'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_080201_ModuleParameters_005 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_005 Ensure that a reference to plain module parameter with a default value delivers the default value unless it is overwritten. >
<COMPILE>
<MODULE TTCN NegSem_080201_ModuleParameters_005 NegSem_080201_ModuleParameters_005.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that a reference to plain module parameter with a default value delivers the default value unless it is overwritten.
** @verdict pass reject
*****************************************************************/
// A module parameter shall only be of type address if the address type is explicitly defined within the associated module
module NegSem_080201_ModuleParameters_005 {
modulepar address MY_ADDRESS_MODULE_PARAMETER := 2; // error: address type not defined
type component GeneralComp {
}
testcase TC_NegSem_080201_ModuleParameters_005() runs on GeneralComp {
if (MY_ADDRESS_MODULE_PARAMETER == 2) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_080201_ModuleParameters_005());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Type `address' is not defined in this module
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_080201_ModuleParameters_006 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_006 Ensure that a module parameter is not allowed to be used in arrays >
<COMPILE>
<MODULE TTCN NegSem_080201_ModuleParameters_006 NegSem_080201_ModuleParameters_006.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that a module parameter is not allowed to be used in arrays
** @verdict pass reject
*****************************************************************/
//Module parameters shall not be used in type or array definitions.
module NegSem_080201_ModuleParameters_006 {
modulepar integer MY_INT_MODULE_PARAMETER := 2;
type component GeneralComp {
}
type integer MyArrayType[MY_INT_MODULE_PARAMETER];
// error: Module parameters shall not be used in type or array definitions.
testcase TC_NegSem_080201_ModuleParameters_006() runs on GeneralComp {
var MyArrayType v_arr := {2,3};
if (v_arr[0] == 2) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_080201_ModuleParameters_006());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Reference to an \(evaluable\) constant value was expected instead of module parameter `@NegSem_080201_ModuleParameters_006.MY_INT_MODULE_PARAMETER'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_080201_ModuleParameters_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_001 Ensure that module parameter can be declared within the module definition part only. >
<COMPILE>
<MODULE TTCN NegSyn_080201_ModuleParameters_001 NegSyn_080201_ModuleParameters_001.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that module parameter can be declared within the module definition part only.
** @verdict pass reject, noexecution
*****************************************************************/
module NegSyn_080201_ModuleParameters_001 {
type component GeneralComp {
}
testcase TC_NegSyn_080201_ModuleParameters_001() runs on GeneralComp {
modulepar integer MY_MODULE_PAR := 1; // not allowed to declared here
setverdict(fail);
}
control {
execute(TC_NegSyn_080201_ModuleParameters_001());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: at or before token `modulepar': syntax error, unexpected ModuleParKeyword
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_080201_ModuleParameters_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 080201_002 Ensure that module parameter can be declared within the module definition part only. >
<COMPILE>
<MODULE TTCN NegSyn_080201_ModuleParameters_002 NegSyn_080201_ModuleParameters_002.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.2.1, Ensure that module parameter can be declared within the module definition part only.
** @verdict pass reject, noexecution
*****************************************************************/
module NegSyn_080201_ModuleParameters_002 {
modulepar integer MY_MODULE_PAR := 1;
modulepar integer MY_MODULE_PAR := 2; //error: not allowed to redeclare
type component GeneralComp {
}
testcase TC_NegSyn_080201_ModuleParameters_002() runs on GeneralComp {
setverdict(fail);
}
control {
execute(TC_NegSyn_080201_ModuleParameters_002());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Duplicate definition with name `MY_MODULE_PAR'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_08020301_GeneralFormatOfImport_002 negative test :h3. NegSem_08020301_GeneralFormatOfImport_002 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
...@@ -2274,6 +2555,49 @@ error: any value is not allowed in this context ...@@ -2274,6 +2555,49 @@ error: any value is not allowed in this context
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSem_1101_ValueVars_005 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 1101_005 Variables should be assigned only by initialized variables >
<COMPILE>
<EXECUTE_PARALLEL>
<MODULE TTCN NegSem_1101_ValueVars_005 NegSem_1101_ValueVars_005.ttcn >
/***************************************************
** @version 0.0.1
** @purpose 1:11.1, Variables should be assigned only by initialized variables
** @verdict pass reject
***************************************************/
// The expression shall evaluate to a value, which is at least partially initialized.
module NegSem_1101_ValueVars_005 {
type component GeneralComp {}
testcase TC_NegSem_1101_ValueVars_005() runs on GeneralComp {
var integer v_i;
var integer v_j := v_i + 2; // error: v_i is uninitialized
setverdict(pass);
}
control {
execute(TC_NegSem_1101_ValueVars_005());
}
}
<END_MODULE>
<RESULT COUNT 1>
Dynamic test case error: Unbound left operand of integer addition.
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSyn_1101_ValueVars_001 negative test :h3. NegSyn_1101_ValueVars_001 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
...@@ -2367,6 +2691,49 @@ error: at or before token `var': syntax error, unexpected VarKeyword ...@@ -2367,6 +2691,49 @@ error: at or before token `var': syntax error, unexpected VarKeyword
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSyn_1102_TemplateVars_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 1102_002 Template variables should be assigned with unitialized variables >
<COMPILE>
<MODULE TTCN NegSyn_1102_TemplateVars_002 NegSyn_1102_TemplateVars_002.ttcn >
/***************************************************
** @version 0.0.1
** @purpose 1:11.2, Template variables should be assigned with unitialized variables
** @verdict pass reject
***************************************************/
/* The following requirements are tested:
Restriction l) The template body at the right-hand side of the assignment symbol shall evaluate to a value or template, which is type compatible with the variable being declared.
*/
module NegSyn_1102_TemplateVars_002 {
type component GeneralComp {}
testcase TC_NegSyn_1102_TemplateVars_002() runs on GeneralComp {
var integer v_i1 := 1;
var template float v_i2 := v_i1; // error: v_i1 is integer, meanwhile template type is float
setverdict(pass);
}
control {
execute(TC_NegSyn_1102_TemplateVars_002());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Type mismatch: a value or template of type `float' was expected instead of `integer'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h2. 12_timers folder :h2. 12_timers folder
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
......
...@@ -282,6 +282,34 @@ error ...@@ -282,6 +282,34 @@ error
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. Syn_0801_DefinitionOfAModule_010 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 0801_010 Ensure that a module definition with ed4.8.1 language and package is accepted. >
<COMPILE>
<MODULE TTCN Syn_0801_DefinitionOfAModule_010 Syn_0801_DefinitionOfAModule_010.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:8.1, Ensure that a module definition with ed4.8.1 language and package is accepted.
** @verdict pass accept, noexecution
*****************************************************************/
module Syn_0801_DefinitionOfAModule_010 language "TTCN-3:2016" {
}
<END_MODULE>
<RESULT IF_PASS NEGATIVE>
error
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. Syn_0803_ModuleControlPart_003 negative test :h3. Syn_0803_ModuleControlPart_003 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
......
...@@ -56,6 +56,47 @@ This TD contains negative tests from ETSI TTCN3 Conformance Test's 15_templates ...@@ -56,6 +56,47 @@ This TD contains negative tests from ETSI TTCN3 Conformance Test's 15_templates
:h1.REQUIREMENT-BASED TESTS :h1.REQUIREMENT-BASED TESTS
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
:h2. 15_top_level folder
.*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
:h3. NegSyn_15_TopLevel_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 15_001 Ensure that the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared. >
<COMPILE>
<MODULE TTCN NegSyn_15_TopLevel_001 NegSyn_15_TopLevel_001.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:15, Ensure that the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared.
** @verdict pass reject, noexecution
*****************************************************************/
// The following requirement is tested:
//Restriction C: the expression or template body initializing a template shall evaluate to a value or template, which is type compatible with the template being declared.
module NegSyn_15_TopLevel_001 {
type record MyRecord {
integer myInt
}
template MyRecord mw_myRecord := {
myInt := 2.1 // error: incompatible type (int req., float is given)
}
}
<END_MODULE>
<RESULT COUNT 1>
error: integer value was expected
<END_RESULT>
<END_TC>
:exmp
.*---------------------------------------------------------------------*
:h2. 1503_global_and_local_templates folder :h2. 1503_global_and_local_templates folder
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
...@@ -3589,7 +3630,7 @@ error: Formal parameter with template restriction `present' not allowed here ...@@ -3589,7 +3630,7 @@ error: Formal parameter with template restriction `present' not allowed here
<MODULE TTCN NegSem_1508_TemplateRestrictions_043 NegSem_1508_TemplateRestrictions_043.ttcn > <MODULE TTCN NegSem_1508_TemplateRestrictions_043 NegSem_1508_TemplateRestrictions_043.ttcn >
/****************************************************************************** /******************************************************************************
** @version 0.0.1 ** @version 0.0.1
** @purpose 1:15.8, Ensure that template(present) can be parameter to template(omit) ** @purpose 1:15.8, Ensure that template cannot be parameter to template(omit)
** @verdict pass reject ** @verdict pass reject
*****************************************************************/ *****************************************************************/
...@@ -4202,6 +4243,55 @@ error: Reference to a value was expected instead of template `@NegSem_1509_Match ...@@ -4202,6 +4243,55 @@ error: Reference to a value was expected instead of template `@NegSem_1509_Match
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSem_1509_MatchOperation_003 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 1509_003 Ensure that the match operation works correctly with enums. >
<COMPILE>
<MODULE TTCN NegSem_1509_MatchOperation_003 NegSem_1509_MatchOperation_003.ttcn >
/*****************************************************************
** @version 0.0.1
** @purpose 1:15.9, Ensure that the match operation works correctly with enums.
** @verdict pass reject
*****************************************************************/
module NegSem_1509_MatchOperation_003 {
type component GeneralComp { }
type enumerated A_enum { A, B, C, D, E };
type enumerated B_enum { A, F, G };
testcase TC_NegSem_1509_MatchOperation_003() runs on GeneralComp {
var A_enum v_value := A;
if (match(v_value, B_enum:G)) { // error: different enum type
setverdict(pass);
} else {
setverdict(fail);
}
}
control{
execute(TC_NegSem_1509_MatchOperation_003());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Type mismatch: a value of type `@NegSem_1509_MatchOperation_003.B_enum' was expected instead of `@NegSem_1509_MatchOperation_003.A_enum'
<END_RESULT>
<END_TC>
:exmp
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
:h2. 1510_valueof_operation folder :h2. 1510_valueof_operation folder
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
......
...@@ -2802,6 +2802,68 @@ error: The 'intOption' is already present in the 1. branch of select union ...@@ -2802,6 +2802,68 @@ error: The 'intOption' is already present in the 1. branch of select union
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSem_190302_select_union_statement_006 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 190302_006 verify that it is possible to use a select union statement with several branches >
<COMPILE>
<MODULE TTCN NegSem_190302_select_union_statement_006 NegSem_190302_select_union_statement_006.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:19.3.2, verify that it is possible to use a select union statement with several branches
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
// The following requirement is tested:
// c) No two cases in a select union statement shall have the same caseIdentifier or TypeIdentifier.
module NegSem_190302_select_union_statement_006 {
type component GeneralComp {
}
testcase TC_NegSem_190302_select_union_statement_006() runs on GeneralComp {
var anytype v_any;
v_any.integer := 2;
v_any.charstring := "abc";
v_any.float := 1.2;
select union (v_any) {
case (charstring) {
if(match(v_any.charstring,"abc"))
{setverdict(pass, v_any.charstring);}
} case (integer) {
if(match(v_any.integer,2))
{setverdict(pass, v_any.integer);}
} case (charstring) { // error
if(match(v_any.charstring,"abc"))
{setverdict(fail, v_any.charstring);}
}
case else {
setverdict(fail);
}
}
}
control {
execute(TC_NegSem_190302_select_union_statement_006());
}
}
with {
extension "anytype integer, charstring, float"
}
<END_MODULE>
<RESULT COUNT 1>
error: The 'charstring' is already present in the 1. branch of select union
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_1904_for_statement_001 negative test :h3. NegSem_1904_for_statement_001 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
......
...@@ -2481,6 +2481,67 @@ error: The operand of operation `alive': Type mismatch: component array referenc ...@@ -2481,6 +2481,67 @@ error: The operand of operation `alive': Type mismatch: component array referenc
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - 210305_002 Verify that error occurs when any from alive is applied to 1D array and index target is array >
<COMPILE>
<MODULE TTCN NegSem_210305_alive_operation_002 NegSem_210305_alive_operation_002.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when any from alive is applied to 1D array and index target is array
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction d
// If the index redirection is used for single-dimensional component arrays, the type
// of the integer variable shall allow storing the highest index of the respective array.
module NegSem_210305_alive_operation_002 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSem_210305_alive_operation_002() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
const integer c_size := 4;
var GeneralComp v_ptc[c_size];
var integer v_index[1];
for (var integer i := 0; i < c_size; i := i + 1) {
v_ptc[i] := GeneralComp.create; // created components are inactive
if (i mod 2 == 0) { v_ptc[i].kill; } //kill components on even indices
else { v_ptc[i].start(f());} // activate v_ptc
}
v_isAlive := any from v_ptc.alive -> @index value v_index;
if(v_index[0] == 1){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSem_210305_alive_operation_002(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Indices of one-dimensional component arrays can only be redirected to an integer
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_003 negative test :h3. NegSem_210305_alive_operation_003 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
...@@ -2510,8 +2571,6 @@ module NegSem_210305_alive_operation_003 { ...@@ -2510,8 +2571,6 @@ module NegSem_210305_alive_operation_003 {
t.timeout; t.timeout;
} }
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_003() runs on GeneralComp system GeneralComp { testcase TC_NegSem_210305_alive_operation_003() runs on GeneralComp system GeneralComp {
var boolean v_isAlive; var boolean v_isAlive;
const integer c_size := 4; const integer c_size := 4;
...@@ -2519,7 +2578,7 @@ module NegSem_210305_alive_operation_003 { ...@@ -2519,7 +2578,7 @@ module NegSem_210305_alive_operation_003 {
var float v_index; var float v_index;
for (var integer i := 0; i < c_size; i := i + 1) { for (var integer i := 0; i < c_size; i := i + 1) {
v_ptc[i] := GeneralComp.create; // created components are inactive v_ptc[i] := GeneralComp.create; // created components are inactive
if (i mod 2 == 0) { v_ptc[i].start(f_done()); } //quick done components on even indices if (i mod 2 == 0) { v_ptc[i].kill; } //kill components on even indices
else { v_ptc[i].start(f());} // activate v_ptc else { v_ptc[i].start(f());} // activate v_ptc
} }
v_isAlive := any from v_ptc.alive -> @index value v_index; v_isAlive := any from v_ptc.alive -> @index value v_index;
...@@ -2574,8 +2633,6 @@ module NegSem_210305_alive_operation_004 { ...@@ -2574,8 +2633,6 @@ module NegSem_210305_alive_operation_004 {
t.timeout; t.timeout;
} }
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_004() runs on GeneralComp system GeneralComp { testcase TC_NegSem_210305_alive_operation_004() runs on GeneralComp system GeneralComp {
var boolean v_isAlive; var boolean v_isAlive;
const integer c_size := 3; const integer c_size := 3;
...@@ -2584,7 +2641,7 @@ module NegSem_210305_alive_operation_004 { ...@@ -2584,7 +2641,7 @@ module NegSem_210305_alive_operation_004 {
for (var integer i := 0; i < c_size; i := i + 1) { for (var integer i := 0; i < c_size; i := i + 1) {
for (var integer j := 0; j < c_size; j := j + 1) { for (var integer j := 0; j < c_size; j := j + 1) {
v_ptc[i][j] := GeneralComp.create; // created components are inactive v_ptc[i][j] := GeneralComp.create; // created components are inactive
if (i mod 2 == 0 or j mod 2 == 1) { v_ptc[i][j].start(f_done()); } //quick done components on even i or odd j if (i mod 2 == 0 or j mod 2 == 1) { v_ptc[i].kill; } //kill components on even i or odd j
else { v_ptc[i][j].start(f());} // activate v_ptc else { v_ptc[i][j].start(f());} // activate v_ptc
} }
} }
...@@ -2643,8 +2700,6 @@ module NegSem_210305_alive_operation_005 { ...@@ -2643,8 +2700,6 @@ module NegSem_210305_alive_operation_005 {
t.timeout; t.timeout;
} }
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_005() runs on GeneralComp system GeneralComp { testcase TC_NegSem_210305_alive_operation_005() runs on GeneralComp system GeneralComp {
var boolean v_isAlive; var boolean v_isAlive;
const integer c_size := 3; const integer c_size := 3;
...@@ -2653,7 +2708,7 @@ module NegSem_210305_alive_operation_005 { ...@@ -2653,7 +2708,7 @@ module NegSem_210305_alive_operation_005 {
for (var integer i := 0; i < c_size; i := i + 1) { for (var integer i := 0; i < c_size; i := i + 1) {
for (var integer j := 0; j < c_size; j := j + 1) { for (var integer j := 0; j < c_size; j := j + 1) {
v_ptc[i][j] := GeneralComp.create; // created components are inactive v_ptc[i][j] := GeneralComp.create; // created components are inactive
if (i mod 2 == 0 or j mod 2 == 1) { v_ptc[i][j].start(f_done()); } //quick done components on even i or odd j if (i mod 2 == 0 or j mod 2 == 1) { v_ptc[i].kill; } //kill components on even i or odd j
else { v_ptc[i][j].start(f());} // activate v_ptc else { v_ptc[i][j].start(f());} // activate v_ptc
} }
} }
......
...@@ -4281,6 +4281,280 @@ error: `omit' value is not allowed in this context ...@@ -4281,6 +4281,280 @@ error: `omit' value is not allowed in this context
<END_TC> <END_TC>
:exmp :exmp
*---------------------------------------------------------------------*
:h3. NegSem_B010201_value_list_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - B010201_001 Ensure that the IUT correctly handles template matching with all from clause >
<COMPILE>
<MODULE TTCN NegSem_B010201_value_list_001 NegSem_B010201_value_list_001.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:B.1.2.1, Ensure that the IUT correctly handles template matching with all from clause
** @verdict pass reject
***************************************************/
// The following requirements are tested:
//The type of the template list and the member type of the template in the all from clause shall be compatible.
// Restriction B
module NegSem_B010201_value_list_001 {
type set of integer SoI;
template SoI m_SoI := {1,2,3,4};
template float mw_SoI := (all from m_SoI); //error: m_SoI is integer, mw_SoI is float
type port loopbackPort message {
inout float
} with {extension "internal"}
type component GeneralComp {
port loopbackPort messagePort
}
testcase TC_NegSem_B010201_value_list_001() runs on GeneralComp {
var float v_testMessage := 2.0;
connect(self:messagePort, self:messagePort);
messagePort.send(v_testMessage);
alt {
[] messagePort.receive(mw_SoI) {
setverdict(pass);
}
[] messagePort.receive {
setverdict(fail);
}
}
}
control{
execute(TC_NegSem_B010201_value_list_001());
}
}
<END_MODULE>
<RESULT COUNT 4>
error: float value was expected
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_B010201_value_list_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - B010201_002 Ensure that the IUT correctly handles template matching with all from clause >
<COMPILE>
<MODULE TTCN NegSem_B010201_value_list_002 NegSem_B010201_value_list_002.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:B.1.2.1, Ensure that the IUT correctly handles template matching with all from clause
** @verdict pass reject
***************************************************/
// The following requirements are tested:
// Restriction D,E: Individual members of the template in the all from clause shall not resolve to any of the following matching mechanisms: AnyElementsOrNone, permutation.
module NegSem_B010201_value_list_002 {
type set of integer SoI;
template SoI m_SoI := {1,*,4};
template integer mw_SoI := (all from m_SoI); //error: m_SoI contains AnyElementsOrNone
type port loopbackPort message {
inout integer
} with {extension "internal"}
type component GeneralComp {
port loopbackPort messagePort
}
testcase TC_NegSem_B010201_value_list_002() runs on GeneralComp {
var integer v_testMessage;
v_testMessage:= 2;
connect(self:messagePort, self:messagePort);
messagePort.send(v_testMessage);
alt {
[] messagePort.receive(mw_SoI) {
setverdict(pass);
}
[] messagePort.receive {
setverdict(fail);
}
}
}
control{
execute(TC_NegSem_B010201_value_list_002());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: 'all from' can not refer to permutation or AnyElementsOrNone
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_B010201_value_list_003 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - B010201_003 Ensure that the IUT correctly handles template matching with all from clause >
<COMPILE>
<MODULE TTCN NegSem_B010201_value_list_003 NegSem_B010201_value_list_003.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:B.1.2.1, Ensure that the IUT correctly handles template matching with all from clause
** @verdict pass reject
***************************************************/
// The following requirements are tested:
// Restriction D,E: Individual members of the template in the all from clause shall not resolve to any of the following matching mechanisms: AnyElementsOrNone, permutation.
module NegSem_B010201_value_list_003 {
type record of integer RoI;
template RoI m_RoI := {permutation(0,1,3,*),2};
template integer mw_RoI := (all from m_RoI); //error: m_RoI contains permutation
type port loopbackPort message {
inout integer
} with {extension "internal"}
type component GeneralComp {
port loopbackPort messagePort
}
testcase TC_NegSem_B010201_value_list_003() runs on GeneralComp {
var integer v_testMessage;
v_testMessage:= 2;
connect(self:messagePort, self:messagePort);
messagePort.send(v_testMessage);
alt {
[] messagePort.receive(mw_RoI) {
setverdict(pass);
}
[] messagePort.receive {
setverdict(fail);
}
}
}
control{
execute(TC_NegSem_B010201_value_list_003());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: 'all from' can not refer to permutation or AnyElementsOrNone
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_B010201_value_list_004 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - B010201_004 Ensure that the IUT correctly handles template matching with all from clause >
<COMPILE>
<MODULE TTCN NegSem_B010201_value_list_004 NegSem_B010201_value_list_004.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:B.1.2.1, Ensure that the IUT correctly handles template list corretly
** @verdict pass accept reject
***************************************************/
// The following requirements are tested:
// e) Templates in the template list shall obey the template (present) restriction
module NegSem_B010201_value_list_004 {
type record MessageType {
integer field1,
charstring field2
}
template integer t_omit := omit;
template MessageType t_mes := {
field1 := (1, 2, t_omit), // present restriction does not allow omit
field2 := ("abc", "bc")
}
type port loopbackPort message {
inout MessageType
} with {extension "internal"}
type component GeneralComp {
port loopbackPort messagePort
}
testcase TC_NegSem_B010201_value_list_004() runs on GeneralComp {
var MessageType v_testMessage := {
field1:= 1,
field2:= "abc"
}
connect(self:messagePort, self:messagePort);
messagePort.send(v_testMessage);
alt {
[] messagePort.receive(t_mes) {
setverdict(pass);
}
[] messagePort.receive {
setverdict(fail);
}
}
}
control{
execute(TC_NegSem_B010201_value_list_004());
}
}
<END_MODULE>
<RESULT COUNT 1>
error: `omit' value is not allowed in this context
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_B010204_any_value_or_none_001 negative test :h3. NegSem_B010204_any_value_or_none_001 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
...@@ -6228,22 +6502,22 @@ error: permutation match cannot be used for type `integer' ...@@ -6228,22 +6502,22 @@ error: permutation match cannot be used for type `integer'
:exmp :exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_B010401_length_restrictions_002 negative test :h3. NegSem_B010401_length_restrictions_001 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
:xmp tab=0. :xmp tab=0.
<TC - B010401_002 Ensure that the IUT correctly handles template matching of value length definitions > <TC - B010401_001 Ensure that the IUT correctly handles template matching of value length definitions >
<COMPILE> <COMPILE>
<MODULE TTCN NegSem_B010401_length_restrictions_002 NegSem_B010401_length_restrictions_002.ttcn > <MODULE TTCN NegSem_B010401_length_restrictions_001 NegSem_B010401_length_restrictions_001.ttcn >
/*************************************************** /***************************************************
** @version 0.0.1 ** @version 0.0.1
** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions ** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions
** @verdict pass reject ** @verdict pass reject
***************************************************/ ***************************************************/
module NegSem_B010401_length_restrictions_002 { module NegSem_B010401_length_restrictions_001 {
type record MessageType { type record MessageType {
...@@ -6264,7 +6538,7 @@ module NegSem_B010401_length_restrictions_002 { ...@@ -6264,7 +6538,7 @@ module NegSem_B010401_length_restrictions_002 {
port loopbackPort messagePort port loopbackPort messagePort
} }
testcase TC_NegSem_B010401_length_restrictions_002() runs on GeneralComp { testcase TC_NegSem_B010401_length_restrictions_001() runs on GeneralComp {
var MessageType v_testMessage; var MessageType v_testMessage;
...@@ -6300,7 +6574,7 @@ module NegSem_B010401_length_restrictions_002 { ...@@ -6300,7 +6574,7 @@ module NegSem_B010401_length_restrictions_002 {
} }
control{ control{
execute(TC_NegSem_B010401_length_restrictions_002()); execute(TC_NegSem_B010401_length_restrictions_001());
} }
} }
...@@ -6315,7 +6589,7 @@ error: There are fewer \(5\) elements in the string than it is allowed by the le ...@@ -6315,7 +6589,7 @@ error: There are fewer \(5\) elements in the string than it is allowed by the le
:exmp :exmp
*---------------------------------------------------------------------* *---------------------------------------------------------------------*
:h3. NegSem_B010401_length_restrictions_004 negative test :h3. NegSem_B010401_length_restrictions_002 negative test
.*---------------------------------------------------------------------* .*---------------------------------------------------------------------*
:xmp tab=0. :xmp tab=0.
...@@ -6323,14 +6597,14 @@ error: There are fewer \(5\) elements in the string than it is allowed by the le ...@@ -6323,14 +6597,14 @@ error: There are fewer \(5\) elements in the string than it is allowed by the le
<COMPILE> <COMPILE>
<MODULE TTCN NegSem_B010401_length_restrictions_004 NegSem_B010401_length_restrictions_004.ttcn > <MODULE TTCN NegSem_B010401_length_restrictions_002 NegSem_B010401_length_restrictions_002.ttcn >
/*************************************************** /***************************************************
** @version 0.0.1 ** @version 0.0.1
** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions ** @purpose 1:B.1.4.1, Ensure that the IUT correctly handles template matching of value length definitions
** @verdict pass reject ** @verdict pass reject
***************************************************/ ***************************************************/
module NegSem_B010401_length_restrictions_004 { module NegSem_B010401_length_restrictions_002 {
type record MessageType { type record MessageType {
...@@ -6350,7 +6624,7 @@ module NegSem_B010401_length_restrictions_004 { ...@@ -6350,7 +6624,7 @@ module NegSem_B010401_length_restrictions_004 {
port loopbackPort messagePort port loopbackPort messagePort
} }
testcase TC_NegSem_B010401_length_restrictions_004() runs on GeneralComp { testcase TC_NegSem_B010401_length_restrictions_002() runs on GeneralComp {
var MessageType v_testMessage; var MessageType v_testMessage;
...@@ -6382,7 +6656,7 @@ module NegSem_B010401_length_restrictions_004 { ...@@ -6382,7 +6656,7 @@ module NegSem_B010401_length_restrictions_004 {
} }
control{ control{
execute(TC_NegSem_B010401_length_restrictions_004()); execute(TC_NegSem_B010401_length_restrictions_002());
} }
} }
......
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.2.2, Ensure that identifiers for fields of structured types, enumerated values and groups do not have to be globally unique.
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the same module,they shall only be reused for enumerated values within other enumerated types or as identifiers for fields of structured types. In addition, enumeration values shall not be used as names of value or
* template definitions of imported enumeration types, defining the given enumeration value
*/
module Sem_050202_Uniqueness_004 {
type component GeneralComp {
}
type enumerated MyFirstEnumType {MyFirstEnumValue, MySecondEnumValue}
type enumerated MySecondEnumType {MyFirstEnumValue, MySecondEnumValue}
//enumerated values within other enumerated types or as identifiers for fields of structured types
testcase TC_Sem_050202_Uniqueness_004() runs on GeneralComp {
var MyFirstEnumType v_enum := MySecondEnumValue;
var MySecondEnumType v_enum_2 := MySecondEnumValue;
if (match(v_enum, MyFirstEnumType:MySecondEnumValue) and match(v_enum_2, MySecondEnumType:MySecondEnumValue)) { // local value
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_050202_Uniqueness_004());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.2.2, Ensure that identifiers for fields of structured types, enumerated values and groups do not have to be globally unique.
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the same module,they shall only be reused for enumerated values within other enumerated types or as identifiers for fields of structured types. In addition, enumeration values shall not be used as names of value or
* template definitions of imported enumeration types, defining the given enumeration value
*/
module Sem_050202_Uniqueness_005 {
type component GeneralComp {
}
type enumerated MyFirstEnumType {MyInt,MySecondEnumValue};
type record MyRec {
integer Myint
}
testcase TC_Sem_050202_Uniqueness_005() runs on GeneralComp {
var MyFirstEnumType v_enum := MySecondEnumValue;
var MyRec v_rec;
v_rec.Myint := 1;
if (match(v_enum, MyFirstEnumType:MySecondEnumValue) and match(v_rec.Myint,1)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_050202_Uniqueness_005());
}
}
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
// Restriction e) // Restriction e)
// The template instance shall not refer to elements of the component type in a runs on clause. // 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 { module NegSem_05040102_parameters_of_kind_template_008 language "TTCN-3:2016" {
type component GeneralComp { type component GeneralComp {
var template integer vc_int := ?; var template integer vc_int := ?;
} }
......
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.2, Verify that template parameter of an activated altstep cannot be an out parameter
** @verdict pass reject
*****************************************************************/
module NegSem_05040102_parameters_of_kind_template_018 {
type component C {
var template integer v_int := ?;
}
altstep a_test(out template integer p_par) runs on C {
[] any timer.timeout {
p_par := ?;
}
}
testcase TC_NegSem_05040102_parameters_of_kind_template_018() runs on C {
//var integer v_int := ?; //original line
activate(a_test(v_int));
setverdict(pass);
}
control {
execute(TC_NegSem_05040102_parameters_of_kind_template_018());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.2, Verify that template parameter of an activated altstep cannot be an inout parameter
** @verdict pass reject
*****************************************************************/
module NegSem_05040102_parameters_of_kind_template_019 {
type component C {
var template integer v_int := ?;
}
altstep a_test(inout template integer p_par) runs on C {
[] any timer.timeout {
p_par := ?;
}
}
testcase TC_NegSem_05040102_parameters_of_kind_template_019() runs on C {
//var integer v_int := ?; //original line
activate(a_test(v_int));
setverdict(pass);
}
control {
execute(TC_NegSem_05040102_parameters_of_kind_template_019());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that functions with timer parameters cannot be used in component.start operation
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Only function and altstep definitions may have formal timer parameters, with the exception of functions or
// altsteps started as test component behaviour (see clause 21.3.2).
module NegSem_05040103_parameters_of_kind_timer_001 {
type component C {
}
function f_test(inout timer p_tmr) runs on C {
p_tmr.timeout;
setverdict(pass);
}
testcase TC_NegSem_05040103_parameters_of_kind_timer_001() runs on C system C {
timer t_tmr := 0.1;
var C v_ptc := C.create;
t_tmr.start;
v_ptc.start(f_test(t_tmr));
v_ptc.done;
}
control {
execute(TC_NegSem_05040103_parameters_of_kind_timer_001());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that altsteps with timer parameters cannot be used in component.start operation
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Only function and altstep definitions may have formal timer parameters, with the exception of functions or
// altsteps started as test component behaviour (see clause 21.3.2).
module NegSem_05040103_parameters_of_kind_timer_002 {
type component C {
}
altstep f_test(inout timer p_tmr) runs on C {
[] p_tmr.timeout {
setverdict(pass);
}
}
testcase TC_NegSem_05040103_parameters_of_kind_timer_002() runs on C system C {
timer t_tmr := 0.1;
var C v_ptc := C.create;
t_tmr.start;
v_ptc.start(f_test(t_tmr));
v_ptc.done;
}
control {
execute(TC_NegSem_05040103_parameters_of_kind_timer_002());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that test cases cannot have timer parameters
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Only function and altstep definitions may have formal timer parameters, with the exception of functions or
// altsteps started as test component behaviour (see clause 21.3.2).
module NegSem_05040103_parameters_of_kind_timer_003 {
type component C {
}
testcase TC_NegSem_05040103_parameters_of_kind_timer_003(timer p_tmr) runs on C {
p_tmr.timeout;
setverdict(pass);
}
control {
timer t_tmr := 0.1;
t_tmr.start;
execute(TC_NegSem_05040103_parameters_of_kind_timer_003(t_tmr));
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that templates cannot have timer parameters
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Only function and altstep definitions may have formal timer parameters, with the exception of functions or
// altsteps started as test component behaviour (see clause 21.3.2).
module NegSem_05040103_parameters_of_kind_timer_004 {
type component C {
}
template boolean m_msg (timer p_tmr) := p_tmr.running;
testcase TC_NegSem_05040103_parameters_of_kind_timer_004() runs on C system C {
timer t_tmr := 0.1;
t_tmr.start;
log(m_msg(t_tmr));
setverdict(pass);
}
control {
execute(TC_NegSem_05040103_parameters_of_kind_timer_004());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that in timer parameters are not allowed
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Formal timer parameters shall be inout parameters, which can optionally be indicated by the keyword inout.
module NegSyn_05040103_parameters_of_kind_timer_001 {
type component C {
}
function f_test(in timer p_tmr) {
p_tmr.timeout;
}
testcase TC_NegSyn_05040103_parameters_of_kind_timer_001() runs on C {
timer t_tmr := 1.0;
t_tmr.start;
f_test(t_tmr);
setverdict(pass);
}
control {
execute(TC_NegSyn_05040103_parameters_of_kind_timer_001());
}
}
/******************************************************************************
* Copyright (c) ETSI 2017.
*
* This file is subject to copyrights owned by ETSI. Non-exclusive permission
* is hereby granted, free of charge, to copy, reproduce and amend this file
* under the following conditions: It is provided "as is", without warranty of any
* kind, expressed or implied.
*
* ETSI shall never be liable for any claim, damages, or other liability arising
* from its use or inability of use.This permission does not apply to any documentation
* associated with this file for which ETSI keeps all rights reserved. The present
* copyright notice shall be included in all copies of whole or part of this
* file and shall not imply any sub-license right.
*
* Modified by: Adrien Kirjak
*
** @version 0.0.1
** @purpose 1:5.4.1.3, Verify that out timer parameters are not allowed
** @verdict pass reject
*****************************************************************/
// The following requirement is tested:
// Formal timer parameters shall be inout parameters, which can optionally be indicated by the keyword inout.
module NegSyn_05040103_parameters_of_kind_timer_002 {
type component C {
}
function f_test(out timer p_tmr) {
p_tmr.start(1.0);
}
testcase TC_NegSyn_05040103_parameters_of_kind_timer_002() runs on C{
timer t_tmr;
f_test(t_tmr);
t_tmr.timeout;
setverdict(pass);
}
control {
execute(TC_NegSyn_05040103_parameters_of_kind_timer_002());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment