Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.core
Commits
da61a41a
Commit
da61a41a
authored
Dec 03, 2020
by
Elemer Lelik
Browse files
OOP conformance tests added
Signed-off-by:
Elemer Lelik
<
elemer.lelik@ericsson.com
>
parent
3e004dcb
Changes
50
Expand all
Hide whitespace changes
Inline
Side-by-side
conformance_test/OOP_tests/Makefile
0 → 100644
View file @
da61a41a
##############################################################################
# Copyright (c) 2000-2020 Ericsson Telecom AB
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v2.0
# which accompanies this distribution, and is available at
# https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
#
# Contributors:
# Kirjak, Adrien
#
# not ready
##############################################################################
#TOPDIR := ..
#include $(TOPDIR)/Makefile.regression
#ifdef LCOV
#COVERAGE_FLAG := -C
#endif
MAKE
:=
make
#DIRS := negative_tests positive_tests
DIRS
:=
positive_tests
WORKING_DIR
:=
$(
shell
pwd
)
# It can be built manually.
run clean
:
echo
"hello"
@
for
dir
in
$(DIRS)
;
do
make
$@
-C
$$
dir
||
exit
;
done
.PHONY
:
all clean run
conformance_test/OOP_tests/NOTES.txt
0 → 100644
View file @
da61a41a
Positive tests
+ included
- excluded
tree -P *.ttcn
.
├── 50101_classes
│ ├── 5010101_scope_rules
│ │ ├── Sem_5010101_scopeRules_001.ttcn +
│ │ └── Sem_5010101_scopeRules_002.ttcn +
│ ├── 5010102_abstract_classes
│ │ └── Sem_5010102_abstractClasses_001.ttcn +
│ ├── 5010103_external_classes
│ │ ├── Sem_5010103_externalClasses_001.ttcn +
│ │ └── Sem_5010103_externalClasses_002.ttcn -
│ ├── 5010104_final_classes
│ │ └── Sem_5010104_finalClasses_001.ttcn +
│ ├── 5010105_constructors
│ │ ├── Sem_5010105_Constructors_001.ttcn +
│ │ └── Sem_5010105_Constructors_002.ttcn +
│ ├── 5010106_destructors
│ │ └── Sem_5010106_Destructors_001.ttcn +
│ ├── 5010107_methods
│ │ ├── NegSem_5010107_Methods_003.ttcn !!!
│ │ ├── Sem_5010107_Methods_001.ttcn +
│ │ ├── Sem_5010107_Methods_002.ttcn +
│ │ └── Sem_5010107_Methods_003.ttcn +
│ ├── 5010108_method_invocation
│ │ └── Sem_5010108_MethodInvocation_001.ttcn +
│ ├── 5010109_visibility
│ │ ├── Sem_5010109_Visibility_001.ttcn -
│ │ ├── Sem_5010109_Visibility_002.ttcn +
│ │ └── Sem_5010109_Visibility_003.ttcn +
│ └── 50101_top_level
│ ├── Sem_50101_top_level_001.ttcn +
│ ├── Sem_50101_top_level_002.ttcn +
│ ├── Sem_50101_top_level_003.ttcn +
│ ├── Sem_50101_top_level_004.ttcn +
│ ├── Sem_50101_top_level_005.ttcn -
│ ├── Sem_50101_top_level_006.ttcn -
│ ├── Sem_50101_top_level_007.ttcn +
│ └── Sem_50101_top_level_008.ttcn +
└── 50102_objects
├── 5010202_object_references
│ └── Sem_5010202_ObjectReferences_001.ttcn +
├── 5010203_null_reference
│ ├── NegSem_5010203_NullReference_001.ttcn !!!
│ └── Sem_5010203_NullReference_001.ttcn +
├── 5010204_select_class-statement
│ └── Sem_5010204_SelectClassStatement_001.ttcn +
├── 5010205_of_operator
│ └── Sem_5010205_OfOperator_001.ttcn +
└── 5010206_casting
└── Sem_5010206_Casting_001.ttcn +
Sem_5010101_scopeRules_001.ttcn
Sem_5010101_scopeRules_002.ttcn
Sem_5010102_abstractClasses_001.ttcn
Sem_5010103_externalClasses_001.ttcn
#Sem_5010103_externalClasses_002.ttcn
Sem_5010104_finalClasses_001.ttcn
Sem_5010105_Constructors_001.ttcn
Sem_5010105_Constructors_002.ttcn
Sem_5010106_Destructors_001.ttcn
Sem_5010107_Methods_001.ttcn
Sem_5010107_Methods_002.ttcn
Sem_5010107_Methods_003.ttcn
NegSem_5010107_Methods_003.ttcn
Sem_5010108_MethodInvocation_001.ttcn
#Sem_5010109_Visibility_001.ttcn
Sem_5010109_Visibility_002.ttcn
Sem_5010109_Visibility_003.ttcn
Sem_50101_top_level_001.ttcn
Sem_50101_top_level_002.ttcn
Sem_50101_top_level_003.ttcn
Sem_50101_top_level_004.ttcn
#Sem_50101_top_level_005.ttcn
#Sem_50101_top_level_006.ttcn
Sem_50101_top_level_007.ttcn
Sem_50101_top_level_008.ttcn
Sem_5010202_ObjectReferences_001.ttcn
Sem_5010203_NullReference_001.ttcn
NegSem_5010203_NullReference_001.ttcn
Sem_5010204_SelectClassStatement_001.ttcn
Sem_5010205_OfOperator_001.ttcn
Sem_5010206_Casting_001.ttcn
#Sem_50201_Functions_001.ttcn
#Sem_50202_ExternalFunctions_001.ttcn
#Sem_50203_invoking_functions_001.ttcn
#Sem_50204_altsteps_001.ttcn
#Sem_50205_test_cases_001.ttcn
Negative tests
├── 50101_classes
│ ├── 5010101_scope_rules
│ │ └── NegSem_5010101_scopeRules_001.ttcn +
│ ├── 5010102_abstract_classes
│ │ └── NegSem_5010102_abstractClasses_001.ttcn +
│ ├── 5010103_external_classes
│ │ ├── NegSem_5010103_externalClasses_001.ttcn +
│ │ └── NegSem_5010103_externalClasses_002.ttcn +
│ ├── 5010104_final_classes
│ │ └── NegSem_5010104_finalClasses_001.ttcn +
│ ├── 5010105_constructors
│ ├── 5010106_destructors
│ ├── 5010107_methods
│ │ ├── NegSem_5010107_Methods_001.ttcn +
│ │ ├── NegSem_5010107_Methods_002.ttcn +
│ │ ├── NegSem_5010107_Methods_003a.ttcn + (NegSem_5010107_Methods_003.ttcn --> @ positive test cases)
│ │ └── NegSem_5010107_Methods_004.ttcn +
│ ├── 5010108_method_invocation
│ ├── 5010109_visibility
│ │ ├── NegSem_5010109_Visibility_001.ttcn +
│ │ ├── NegSem_5010109_Visibility_002.ttcn +
│ │ ├── NegSem_5010109_Visibility_003.ttcn +
│ │ └── NegSem_5010109_Visibility_004.ttcn +
│ └── 50101_top_level
│ ├── NegSem_50101_top_level_001.ttcn +
│ ├── NegSem_50101_top_level_002.ttcn +
│ ├── NegSem_50101_top_level_003.ttcn +
│ ├── NegSem_50101_top_level_004a.ttcn +
│ ├── NegSem_50101_top_level_004.ttcn +
│ ├── NegSem_50101_top_level_005.ttcn +
│ ├── NegSem_50101_top_level_006a.ttcn +
│ ├── NegSem_50101_top_level_006.ttcn +
│ ├── NegSem_50101_top_level_007.ttcn +
│ ├── NegSem_50101_top_level_008.ttcn +
│ ├── NegSem_50101_top_level_009.ttcn +
│ ├── NegSem_50101_top_level_010.ttcn +
│ └── NegSem_50101_top_level_011.ttcn +
└── 50102_objects
├── 5010202_object_references
│ ├── NegSem_5010202_ObjectReferences_001.ttcn +
│ └── NegSem_5010202_ObjectReferences_002.ttcn -
├── 5010203_null_reference
│ └── NegSem_5010203_NullReference_001.ttcn --> @positive tet cases
├── 5010204_select_class-statement
│ └── NegSem_5010204_SelectClassStatement_001.ttcn -
├── 5010205_of_operator
└── 5010206_casting
└── NegSem_5010206_Casting_001.ttcn -
===============================================================
The following test cases passed:
================================
[50101_classes.script]: 'NegSem_5010101_scopeRules_001'
[50101_classes.script]: 'NegSem_5010102_abstractClasses_001'
[50101_classes.script]: 'NegSem_5010103_externalClasses_001a'
[50101_classes.script]: 'NegSem_5010103_externalClasses_001b'
[50101_classes.script]: 'NegSem_5010103_externalClasses_002'
[50101_classes.script]: 'NegSem_5010104_finalClasses_001'
[50101_classes.script]: 'NegSem_5010107_Methods_003a'
[50101_classes.script]: 'NegSem_5010107_Methods_004'
[50101_classes.script]: 'NegSem_5010109_Visibility_001'
[50101_classes.script]: 'NegSem_5010109_Visibility_002'
[50101_classes.script]: 'NegSem_5010109_Visibility_004'
[50101_classes.script]: 'NegSem_50101_top_level_001'
[50101_classes.script]: 'NegSem_50101_top_level_002'
[50101_classes.script]: 'NegSem_50101_top_level_003'
[50101_classes.script]: 'NegSem_50101_top_level_004'
[50101_classes.script]: 'NegSem_50101_top_level_006'
[50101_classes.script]: 'NegSem_50101_top_level_006a'
[50101_classes.script]: 'NegSem_50101_top_level_007'
[50101_classes.script]: 'NegSem_50101_top_level_008'
[50101_classes.script]: 'NegSem_50101_top_level_008a'
[50101_classes.script]: 'NegSem_50101_top_level_008b'
[50101_classes.script]: 'NegSem_50101_top_level_009'
[50101_classes.script]: 'NegSem_50101_top_level_010'
[50101_classes.script]: 'NegSem_50101_top_level_011'
[50101_classes.script]: 'NegSem_50101_top_level_011a'
[50101_objects.script]: 'NegSem_5010206_Casting_001'
The following test cases failed:
================================
[50101_classes.script]: 'NegSem_5010107_Methods_001'
[50101_classes.script]: 'NegSem_5010107_Methods_002'
[50101_classes.script]: 'NegSem_5010109_Visibility_003'
[50101_classes.script]: 'NegSem_50101_top_level_004a'
[50101_classes.script]: 'NegSem_50101_top_level_005'
[50101_objects.script]: 'NegSem_5010202_ObjectReferences_001'
The following test cases are inconclusive:
==========================================
None.
Memory leak detected in the following test cases:
None.
Abnormal termination occured during the following test cases:
None.
===============================================================
32 test cases from 2 script files were executed
Total number of executed test cases: 32
PASSED test cases: 26
FAILED test cases: 6
INCONCLUSIVE test cases: 0
Abnormally terminated test cases: 0
Memory leaked test cases: 0
Session saved to log file 'SA_log.report'
Elapsed time in this session: 1 seconds
conformance_test/OOP_tests/negative_tests/50101_classes.script
0 → 100644
View file @
da61a41a
This diff is collapsed.
Click to expand it.
conformance_test/OOP_tests/negative_tests/50101_objects.script
0 → 100644
View file @
da61a41a
.******************************************************************************
.* Copyright (c) ETSI 2020.
.*
.* 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: Elemer Lelik
.*
.******************************************************************************/
text.
:lang eng.
.*
:docname.Test Description
:docno.
:rev.
:date.2020-11-11
.*
:prep. Elemer Lelik
:subresp.
:appr.
: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 OOP test modules from ETSI TTCN3 Conformance Test's 50101_modules folders.
:exmp.
.*---------------------------------------------------------------------*
:h2.Test Tools
.*---------------------------------------------------------------------*
:p.:us.Software Tools:eus.
:xmp tab=2 nokeep.
SAtester_OOP.pl
:exmp.
:np.
.*---------------------------------------------------------------------*
:h1.REQUIREMENT-BASED TESTS
.*---------------------------------------------------------------------*
.*---------------------------------------------------------------------*
:h2. 5010202_object_references folder
.*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
:h3. NegSem_5010202_ObjectReferences_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - NegSem_5010202_ObjectReferences_001 >
<COMPILE>
<MODULE TTCN NegSem_5010202_ObjectReferences_001 NegSem_5010202_ObjectReferences_001.ttcn >
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.2.2, Ensure that Object References shall not be passed as actual parameter or part of an actual parameter.
** @verdict pass reject
*****************************************************************/
module NegSem_5010202_ObjectReferences_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MyClass {
var integer x;
public function setX(integer x) {
this.x := x;
}
public function getX() return integer {
return this.x;
}
}
function f_something(MyClass my) runs on GeneralComp {
my.setX(1);
}
testcase TC_NegSem_5010202_ObjectReferences_001() runs on GeneralComp {
var MyClass v_a := MyClass.create(7);
var GeneralComp v_MyGeneralComp := GeneralComp.create;
v_MyGeneralComp.start(f_something(v_a)); //not allowed // C++ error is thrown
if (v_a.getX() == 7) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_NegSem_5010202_ObjectReferences_001());
}
}
<END_MODULE>
<RESULT COUNT>
error: TBD
<END_RESULT>
<END_TC>
:exmp
.*---------------------------------------------------------------------*
:h2. 5010206_casting folder
.*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
:h3. NegSem_5010206_Casting_001 negative test
.*---------------------------------------------------------------------*
:xmp tab=0.
<TC - NegSem_5010206_Casting_001 >
<COMPILE>
<MODULE TTCN NegSem_5010206_Casting_001 NegSem_5010206_Casting_001.ttcn >
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.2.6, Ensure that if the class the object is being cast to is not in the set of superclasses or the concrete class of the object, the cast operation shall result in an error.
** @verdict pass reject
*****************************************************************/
module NegSem_5010206_Casting_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
//empty class
}
type class MySubClass extends MySuperClass {
//empty class
}
type class MyOtherClass {
const integer x:= 111;
}
testcase TC_NegSem_5010206_Casting_001 () runs on GeneralComp {
//FIXME !!! var MyOtherClass v_a := MyOtherClass.create();
var MyOtherClass v_a := MyOtherClass.create(111);
var MySubClass v_b := v_a => MySubClass; //not allowed
if (v_b of MySubClass) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_NegSem_5010206_Casting_001());
}
}
<END_MODULE>
<RESULT COUNT>
error: Cannot cast an object of class type
<END_RESULT>
<END_TC>
:exmp
.*---------------------------------------------------------------------*
:h1.References
.*---------------------------------------------------------------------*
:list.
:li D='[1]'.1/1/174 02-CRL 113 200/5 Uen
:nl.Statement of Compliance for TITAN project
:li D='[2]'.ETSI ES 203 790 V1.1.1
:nl.Testing and Test Control Notation version 3.,
:nl.TTCN-3 Language Extensions: Object-Oriented Features
:elist.
conformance_test/OOP_tests/negative_tests/README.txt
0 → 100644
View file @
da61a41a
// README to negative conformance tests
How to run:
The tests can be started all at once:
./run_test_all
How to run scripts individually:
./SAtester_OOP.pl scriptname.script
conformance_test/OOP_tests/negative_tests/SAtester_OOP.pl
0 → 100755
View file @
da61a41a
This diff is collapsed.
Click to expand it.
conformance_test/OOP_tests/negative_tests/Temp.ttcn
0 → 100644
View file @
da61a41a
module
Temp
{
}
conformance_test/OOP_tests/negative_tests/run_test_all
0 → 100755
View file @
da61a41a
#!/bin/bash
SCRIPTFLAGS
=
while
[
$#
-gt
0
]
;
do
case
$1
in
"-coverage"
)
SCRIPTFLAGS+
=
" -coverage"
;
shift
1
;;
"-rt2"
)
SCRIPTFLAGS
=
" -rt2"
;
shift
1
;;
*
)
echo
"Usage:
$0
[-rt2] [-coverage]"
;
exit
1
;;
esac
done
echo
"Batch execution of SA tests: creating 1 report for each script file"
echo
"You must have a symlink in this directory named perl and pointing to perl 5.6.0 or higher"
echo
"./SAtester_OOP.pl
$SCRIPTFLAGS
-log SA_log.report *.script"
./SAtester_OOP.pl
$SCRIPTFLAGS
-log
SA_log.report
*
.script
conformance_test/OOP_tests/positive_tests/501_classes_and_objects/50101_classes/5010101_scope_rules/Sem_5010101_scopeRules_001.ttcn
0 → 100644
View file @
da61a41a
/******************************************************************************
* Copyright (c) ETSI 2020.
*
* 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: Elemer Lelik
*
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.1, Ensure that identifiers from the higher(module) scope can be reused.
** @verdict pass accept
*****************************************************************/
module
Sem_5010101_scopeRules_001
"TTCN-3:2018 Object-Oriented"
{
const
float
c_f
:=
5.551
;
type
component
GeneralComp
{
}
public
type
class
t_class_scope
{
const
float
c_f
:=
2.5
;
public
function
get_cf
()
return
float
{
return
this
.
c_f
;
}
}
testcase
TC_Sem_5010101_scopeRules_001
()
runs
on
GeneralComp
{
// var t_class_scope v_a := t_class_scope.create(); FIXME!!!
var
t_class_scope
v_a
:=
t_class_scope
.
create
(
2.5
);
if
(
v_a
.
get_cf
()
==
2.5
and
Sem_5010101_scopeRules_001
.
c_f
==
5.551
)
{
setverdict
(
pass
);
}
else
{
setverdict
(
fail
);
}
if
(
v_a
.
get_cf
()
!=
Sem_5010101_scopeRules_001
.
c_f
)
{
setverdict
(
pass
);
}
else
{
setverdict
(
fail
);
}
}
control
{
execute
(
TC_Sem_5010101_scopeRules_001
());
}
}
conformance_test/OOP_tests/positive_tests/501_classes_and_objects/50101_classes/5010101_scope_rules/Sem_5010101_scopeRules_002.ttcn
0 → 100644
View file @
da61a41a
/******************************************************************************
* Copyright (c) ETSI 2020.
*
* 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: Elemer Lelik
*
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.1, Ensure that identifiers of member declarations can be reused inside methods for formal parameter and local declarations.
** @verdict pass accept
*****************************************************************/
module
Sem_5010101_scopeRules_002
"TTCN-3:2018 Object-Oriented"
{
type
component
GeneralComp
{
}
public
type
class
t_class_scope
{
const
integer
a
:=
88
;
public
function
formalParameterScope
(
integer
a
:=
87
)
return
boolean
{
return
this
.
a
!=
a
;
}
}
testcase
TC_Sem_5010101_scopeRules_002
()
runs
on
GeneralComp
{
//var t_class_scope v_a := t_class_scope.create(); FIXME!!!
var
t_class_scope
v_a
:=
t_class_scope
.
create
(
88
);
if
(
v_a
.
formalParameterScope
())
{
setverdict
(
pass
);
}
else
{
setverdict
(
fail
);
}
}
control
{
execute
(
TC_Sem_5010101_scopeRules_002
());
}
}
conformance_test/OOP_tests/positive_tests/501_classes_and_objects/50101_classes/5010102_abstract_classes/Sem_5010102_abstractClasses_001.ttcn
0 → 100644
View file @
da61a41a
/******************************************************************************
* Copyright (c) ETSI 2020.
*
* 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: Elemer Lelik
*
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.2, Ensure that abstract classes are used correctly.