Commit 6d658030 authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

Merge github.com:eclipse/titan.core

parents 2bb9ca18 a1128524
......@@ -2364,98 +2364,2335 @@ error: Type mismatch: The type of the operand should be a component type instead
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when any from alive is applied to single component >
<COMPILE>
<MODULE TTCN NegSem_210305_alive_operation_001 NegSem_210305_alive_operation_001.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when any from alive is applied to single component
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction b
// The ComponentArrayRef shall be a reference to a component array variable identifier.
module NegSem_210305_alive_operation_001 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSem_210305_alive_operation_001() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
v_isAlive := any from v_ptc.alive;
if(v_isAlive){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSem_210305_alive_operation_001(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: The operand of operation `alive': Type mismatch: component array reference was expected instead of `@NegSem_210305_alive_operation_001.GeneralComp'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_003 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when any from alive is applied to 1D array and index target has wrong type >
<COMPILE>
<MODULE TTCN NegSem_210305_alive_operation_003 NegSem_210305_alive_operation_003.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 has wrong type
** @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_003 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_003() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
const integer c_size := 4;
var GeneralComp v_ptc[c_size];
var float v_index;
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].start(f_done()); } //quick done 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 == 1.0){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSem_210305_alive_operation_003(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Indices of component arrays can only be redirected to an integer, an integer array or a record of integers
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_004 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that any from alive index redirection for multi-D arrays requires arrays of correct size >
<COMPILE>
<MODULE TTCN NegSem_210305_alive_operation_004 NegSem_210305_alive_operation_004.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that any from alive index redirection for multi-D arrays requires arrays of correct size
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction e:
// If the index redirection is used for multi-dimensional component arrays, the size
// of the integer array or record of integer type shall exactly be the same as the dimension
// of the respective array, and its type shall allow storing the highest index (from all
// dimensions) of the array.
module NegSem_210305_alive_operation_004 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_004() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
const integer c_size := 3;
var GeneralComp v_ptc[c_size][c_size];
var integer v_index[1];
for (var integer i := 0; i < c_size; i := i + 1) {
for (var integer j := 0; j < c_size; j := j + 1) {
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
else { v_ptc[i][j].start(f());} // activate v_ptc
}
}
v_isAlive := any from v_ptc.alive -> @index value v_index;
if(v_index[0] == 1 and v_index[1] == 0){
setverdict(pass);
} else {
setverdict(fail, "Index incorrectly assigned");
}
}
control {
execute(TC_NegSem_210305_alive_operation_004(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Size of integer array is invalid: the component array has 2 dimensions, but the integer array has 1 element
<END_RESULT>
<RESULT COUNT 1>
error: Array index overflow: the index value must be at most `0' instead of `1'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210305_alive_operation_005 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that any from alive index redirection for multi-D arrays requires arrays >
<COMPILE>
<MODULE TTCN NegSem_210305_alive_operation_005 NegSem_210305_alive_operation_005.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that any from alive index redirection for multi-D arrays requires arrays
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction e:
// If the index redirection is used for multi-dimensional component arrays, the size
// of the integer array or record of integer type shall exactly be the same as the dimension
// of the respective array, and its type shall allow storing the highest index (from all
// dimensions) of the array.
module NegSem_210305_alive_operation_005 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
function f_done() runs on GeneralComp {}
testcase TC_NegSem_210305_alive_operation_005() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
const integer c_size := 3;
var GeneralComp v_ptc[c_size][c_size];
var integer v_index;
for (var integer i := 0; i < c_size; i := i + 1) {
for (var integer j := 0; j < c_size; j := j + 1) {
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
else { v_ptc[i][j].start(f());} // activate v_ptc
}
}
v_isAlive := any from v_ptc.alive -> @index value v_index;
if(v_index == 1){
setverdict(pass);
} else {
setverdict(fail, "Index incorrectly assigned");
}
}
control {
execute(TC_NegSem_210305_alive_operation_005(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: Indices of multi-dimensional component arrays can only be redirected to an integer array or a record of integers
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_210305_alive_operation_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when using index redirection in component.alive operation >
<COMPILE>
<MODULE TTCN NegSyn_210305_alive_operation_001 NegSyn_210305_alive_operation_001.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when using index redirection in component.alive operation
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction c
// The index redirection shall only be used when the operation is used on an any from
// component array construct.
module NegSyn_210305_alive_operation_001 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSyn_210305_alive_operation_001() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
var integer v_index;
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
v_isAlive := v_ptc.alive -> @index value v_index;
if(v_isAlive){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSyn_210305_alive_operation_001(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: at or before token `->': syntax error, unexpected ->
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_210305_alive_operation_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when using index redirection in any component.alive operation >
<COMPILE>
<MODULE TTCN NegSyn_210305_alive_operation_002 NegSyn_210305_alive_operation_002.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when using index redirection in any component.alive operation
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction c
// The index redirection shall only be used when the operation is used on an any from
// component array construct.
module NegSyn_210305_alive_operation_002 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSyn_210305_alive_operation_002() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
var integer v_index;
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
v_isAlive := any component.alive -> @index value v_index;
if(v_isAlive){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSyn_210305_alive_operation_002(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: at or before token `->': syntax error, unexpected ->
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_210305_alive_operation_003 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when using index redirection in all component.alive operation >
<COMPILE>
<MODULE TTCN NegSyn_210305_alive_operation_003 NegSyn_210305_alive_operation_003.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when using index redirection in all component.alive operation
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction c
// The index redirection shall only be used when the operation is used on an any from
// component array construct.
module NegSyn_210305_alive_operation_003 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSyn_210305_alive_operation_003() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
var integer v_index;
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
v_isAlive := all component.alive -> @index value v_index;
if(v_isAlive){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSyn_210305_alive_operation_003(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: at or before token `->': syntax error, unexpected ->
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSyn_210305_alive_operation_004 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when using index redirection in function instance.alive operation >
<COMPILE>
<MODULE TTCN NegSyn_210305_alive_operation_004 NegSyn_210305_alive_operation_004.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.5, Verify that error occurs when using index redirection in function instance.alive operation
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction c
// The index redirection shall only be used when the operation is used on an any from
// component array construct.
module NegSyn_210305_alive_operation_004 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
function initComp() return GeneralComp {
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
return v_ptc;
}
testcase TC_NegSyn_210305_alive_operation_004() runs on GeneralComp system GeneralComp {
var boolean v_isAlive;
var integer v_index;
v_isAlive := initComp().alive -> @index value v_index;
if(v_isAlive){
setverdict(pass);
} else {
setverdict(fail, "The any from alive operation didn't find alive components");
}
}
control {
execute(TC_NegSyn_210305_alive_operation_004(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: at or before token `->': syntax error, unexpected ->
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210306_running_operation_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when any from running is applied to single component >
<COMPILE>
<MODULE TTCN NegSem_210306_running_operation_001 NegSem_210306_running_operation_001.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.6, Verify that error occurs when any from running is applied to single component
** @verdict pass reject
*****************************************************************/
// The following requirements are tested:
// Restriction b
// The ComponentArrayRef shall be a reference to a component array variable identifier.
module NegSem_210306_running_operation_001 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSem_210306_running_operation_001() runs on GeneralComp system GeneralComp {
var boolean v_isRunning;
var GeneralComp v_ptc := GeneralComp.create;
v_ptc.start(f());
v_isRunning := any from v_ptc.running;
if(v_isRunning){
setverdict(pass);
} else {
setverdict(fail, "The any from running operation didn't find running components");
}
}
control {
execute(TC_NegSem_210306_running_operation_001(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>
error: The operand of operation `component running': Type mismatch: component array reference was expected instead of `@NegSem_210306_running_operation_001.GeneralComp'
<END_RESULT>
<END_TC>
:exmp
*---------------------------------------------------------------------*
:h3. NegSem_210306_running_operation_002 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - Verify that error occurs when any from running is applied to 1D array and index target is array >
<COMPILE>
<MODULE TTCN NegSem_210306_running_operation_002 NegSem_210306_running_operation_002.ttcn >
/******************************************************************************
** @version 0.0.1
** @purpose 1:21.3.6, Verify that error occurs when any from running 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_210306_running_operation_002 {
type component GeneralComp {}
function f() runs on GeneralComp {
timer t := 100.0;
t.start;
t.timeout;
}
testcase TC_NegSem_210306_running_operation_002() runs on GeneralComp system GeneralComp {
var boolean v_isRunning;
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_isRunning := any from v_ptc.running -> @index value v_index;
if(v_index[0] == 1){
setverdict(pass);
} else {
setverdict(fail, "The any from running operation didn't find running components");
}
}
control {
execute(TC_NegSem_210306_running_operation_002(), 5.0);
}
}
<END_MODULE>
<RESULT COUNT 1>