Commit 64350679 authored by kovacsa's avatar kovacsa
Browse files

AK update

parent f0252994
/***************************************************
** @author STF 521
** @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,MySecondEnumValue) and match(v_enum_2,MySecondEnumValue)) { // local value
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_050202_Uniqueness_004());
}
}
/***************************************************
** @author STF 521
** @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 integer MyInt;
testcase TC_Sem_050202_Uniqueness_005() runs on GeneralComp {
var MyFirstEnumType v_enum := MySecondEnumValue;
var MyInt v_int := 1; // local scope
if (match(v_enum,MySecondEnumValue) and match(v_int,1)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_050202_Uniqueness_005());
}
}
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1.1, Access bitstring elements
** @verdict pass reject
***************************************************/
/* The following requirements are tested:
* Only single elements of the string may be accessed.
* Trying to assign strings with length 0 or more than 1
* to a string element using the array-like syntax shall
* cause an error.
*/
module NegSem_06010101_AccessStringElements_001 {
type component GeneralComp {}
testcase TC_NegSem_06010101_AccessStringElements_001() runs on GeneralComp {
var octetstring v_b := '100010'O;
v_b[1] := '01'O; //error: only individual elements can be accessed
if (v_b == '100001'O){
setverdict(pass);
}
else {
setverdict(fail, "v_b:",v_b);
}
}
control{
execute(TC_NegSem_06010101_AccessStringElements_001());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1.1, Access bitstring elements
** @verdict pass reject
***************************************************/
/* The following requirements are tested:
* The index shall be between zero and the
* length of the string minus one for retrieving
* an element from a string. Trying to retrieve outside
* this range shall cause an error.
*/
module NegSem_06010101_AccessStringElements_002 {
type component GeneralComp {}
testcase TC_NegSem_06010101_AccessStringElements_002() runs on GeneralComp {
var octetstring v_b := '100010'O;
v_b[6] := '01'O; //error: index outside of range
if (v_b == '100001'O){
setverdict(pass);
}
else {
setverdict(fail, "v_b:",v_b);
}
}
control{
execute(TC_NegSem_06010101_AccessStringElements_002());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1.1, Access universal charstring elements
** @verdict pass reject
***************************************************/
/* The following requirements are tested:
* For assigning an element to the end of a string, the length of the string should be used as
* index. Trying to assign an element to the end of a string with an index larger than the
* length of the string shall cause an error.
*/
module NegSyn_06010101_AccessStringElements_001 {
type component GeneralComp {}
testcase TC_NegSyn_06010101_AccessStringElements_001() runs on GeneralComp {
var universal charstring v_b := "AbCdE";
v_b[1] := "FF"; // incorrect legth
}
control{
execute(TC_NegSyn_06010101_AccessStringElements_001());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1.1, Access bitstring elements
** @verdict pass reject
***************************************************/
/* The following requirements are tested:
* For initializing an uninitialized string with a single element,
* the index value zero (0) can be used as index. Trying to assign a
* single element to an uninitialized string with an index which is
* not zero (0) shall cause an error.
*/
module NegSyn_06010101_AccessStringElements_002 {
type component GeneralComp {}
testcase TC_NegSyn_06010101_AccessStringElements_002() runs on GeneralComp {
var universal charstring v_b := "";
v_b[2] := "AB"; //error: incorrect index
}
control{
execute(TC_NegSyn_06010101_AccessStringElements_002());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1.1, Ensure that For initializing an uninitialized string with a single element, the index value zero (0) can be used as index.
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
module Sem_06010101_AccessStringElements_010 {
type component GeneralComp {}
testcase TC_Sem_06010101_AccessStringElements_010() runs on GeneralComp {
var universal charstring v_b :="";
v_b[0] := "a";
if (v_b == "a"){
setverdict(pass);
}
else {
setverdict(fail);
}
}
control{
execute(TC_Sem_06010101_AccessStringElements_010());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Assign and read bitstring with newline character
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_008 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_008() runs on GeneralComp {
var bitstring v_a := '0101\
1010'B;
if (match(v_a,'01011010'B))
{
setverdict(pass,"v_a:",v_a);
}
else {
setverdict(fail,"v_a:",v_a);
}
}
control{
execute(TC_Sem_060101_TopLevel_008());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Ensure that whitespaces, control characters and backslash will be ignored for the bitstring length calculation
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_009 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_009() runs on GeneralComp {
var bitstring v_a := '0101\
1010'B;
if (match(lengthof(v_a), 8))
{
setverdict(pass,"Size of v_a is:",lengthof(v_a));
}
else {
setverdict(fail,"Size of v_a is:",lengthof(v_a));
}
}
control{
execute(TC_Sem_060101_TopLevel_009());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Assign and read hexstring with newline character
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_010 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_010() runs on GeneralComp {
var hexstring v_a := 'Ab\
cD'H;
if (match(v_a,'AbcD'H))
{
setverdict(pass,"v_a:",v_a);
}
else {
setverdict(fail,"v_a:",v_a);
}
}
control{
execute(TC_Sem_060101_TopLevel_010());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Ensure that whitespaces, control characters and backslash will be ignored for the hexstring length calculation
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_011 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_011() runs on GeneralComp {
var hexstring v_a := '12\
34\
Ab\
Cd'H;
if (match(lengthof(v_a), 8))
{
setverdict(pass,"Size of v_a is:",lengthof(v_a));
}
else {
setverdict(fail,"Size of v_a is:",lengthof(v_a));
}
}
control{
execute(TC_Sem_060101_TopLevel_011());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Assign and read octetstring with newline character
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_012 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_012() runs on GeneralComp {
var octetstring v_a := '1234\
567'O;
if (match(v_a,'1234567'O))
{
setverdict(pass,"v_a:",v_a);
}
else {
setverdict(fail,"v_a:",v_a);
}
}
control{
execute(TC_Sem_060101_TopLevel_012());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Ensure that whitespaces, control characters and backslash will be ignored for the octetstring length calculation
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
/* The following requirements are tested:
* Within the quotes any number of whitespaces or any sequence of the following C0 control characters:
* LF(10), VT(11), FF(12), CR(13) which constitutes a newline may be included. The newline shall be preceded by a backslash ("\").
* Such whitespaces, control characters and backslash will be ignored for the value and length calculation.
*/
module Sem_060101_TopLevel_013 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_013() runs on GeneralComp {
var octetstring v_a := '12\
34\
56\
7'O;
if (match(lengthof(v_a), 7))
{
setverdict(pass,"Size of v_a is:",lengthof(v_a));
}
else {
setverdict(fail,"Size of v_a is:",lengthof(v_a));
}
}
control{
execute(TC_Sem_060101_TopLevel_013());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1, Ensure that whitespaces and backslash character is allowed in a universal charstring
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
module Sem_060101_TopLevel_014 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_014() runs on GeneralComp {
var universal charstring v_a := "ABC\ DEF";
if (match(v_a,"ABC\ DEF"))
{
setverdict(pass,"v_a:",v_a);
}
else {
setverdict(fail,"v_a:",v_a);
}
}
control{
execute(TC_Sem_060101_TopLevel_014());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.1.1,Ensure that whitespaces, control characters and backslash will be included for the universal charstring length calculation
** @verdict pass accept, ttcn3verdict:pass
***************************************************/
module Sem_060101_TopLevel_015 {
type component GeneralComp {}
testcase TC_Sem_060101_TopLevel_015() runs on GeneralComp {
var universal charstring v_a := "ABC\ DEF"; //lengthof(v_a) is 11
if (match(lengthof(v_a), 11))
{
setverdict(pass,"Size of v_a is:",lengthof(v_a));
}
else {
setverdict(fail,"Size of v_a is:",lengthof(v_a));
}
}
control{
execute(TC_Sem_060101_TopLevel_015());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.2.4, using enumerated value number integer conversion
** @verdict pass reject
***************************************************/
// The following requirement is tested:
// enumerated values with a specific integer value assigned shall not use the associated integer
module NegSem_060204_enumerated_type_and_values_013 {
type component GeneralComp {
}
type enumerated EDays {
Monday(-1), Tuesday(1), Wednesday(2), Thursday(3), Friday(5)
};
testcase TC_NegSem_060204_enumerated_type_and_values_013() runs on GeneralComp {
var EDays v_enum := Friday(5); // error: shall not use the associated integer
if (match(enum2int(v_enum),5)) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_NegSem_060204_enumerated_type_and_values_013());
}
}
\ No newline at end of file
/***************************************************
** @author STF 521
** @version 0.0.1
** @purpose 1:6.2.4, expression as user-assigned enumerated value
** @verdict pass reject, noexecutino
***************************************************/