Skip to content
Snippets Groups Projects
Commit da61a41a authored by Elemer Lelik's avatar Elemer Lelik
Browse files

OOP conformance tests added


Signed-off-by: default avatarElemer Lelik <elemer.lelik@ericsson.com>
parent 3e004dcb
No related branches found
No related tags found
1 merge request!149OOP conformance tests added
Showing
with 3879 additions and 0 deletions
##############################################################################
# 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
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
This diff is collapsed.
.******************************************************************************
.* 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.
// 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
This diff is collapsed.
module Temp {
}
#!/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
/******************************************************************************
* 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());
}
}
/******************************************************************************
* 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());
}
}
/******************************************************************************
* 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.
** @verdict pass accept
*****************************************************************/
module Sem_5010102_abstractClasses_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
public type class @abstract t_class_abstract {
//public function doSomethingSpecial(integer v_arg) return integer; FIXME!!!!
public function @abstract doSomethingSpecial(integer v_arg) return integer;
}
public type class t_class_subclass extends t_class_abstract {
public function doSomethingSpecial(integer v_arg) return integer {
return v_arg + 1;
}
}
testcase TC_Sem_5010102_abstractClasses_001() runs on GeneralComp {
var t_class_subclass v_a := t_class_subclass.create();
if (v_a.doSomethingSpecial(64) == 65) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010102_abstractClasses_001());
}
}
// This external class skeleton source file was generated by the
// TTCN-3 Compiler of the TTCN-3 Test Executor version 7/CAX 105 7730 R2A
// for (ethlel@HU-00001378) on Thu Dec 3 19:59:19 2020
// Copyright (c) 2000-2020 Ericsson Telecom AB
// You may modify this file. Complete the bodies of empty functions and
// add your member functions here.
#include <TTCN3.hh>
namespace Sem__5010103__externalClasses__001 {
#include "Int_List.hh"
void Int__List::add(const INTEGER& v)
{
}
INTEGER Int__List::get(const INTEGER& index)
{
}
Int__List::Int__List()
: OBJECT()
{
}
Int__List::~Int__List()
{
try {
} catch (...) {
fprintf(stderr, "Unhandled exception or dynamic test case error in destructor of class `Int__List'");
exit(EXIT_FAILURE);
}
}
void Int__List::log() const
{
TTCN_Logger::log_event_str("Int_List: { ");
TTCN_Logger::log_event_str(" }");
}
} /* end of namespace */
// This external class skeleton header file was generated by the
// TTCN-3 Compiler of the TTCN-3 Test Executor version 7/CAX 105 7730 R2A
// for (ethlel@HU-00001378) on Thu Dec 3 19:59:19 2020
// Copyright (c) 2000-2020 Ericsson Telecom AB
// You may modify this file. Add your attributes and prototypes of your
// member functions here.
#ifndef Int__List_HH
#define Int__List_HH
class Int__List : public OBJECT {
public:
static const char* class_name() { return "Int_List"; }
protected:
virtual void add(const INTEGER& v);
protected:
virtual INTEGER get(const INTEGER& index);
public:
/* default constructor */
Int__List();
public:
virtual ~Int__List();
public:
virtual void log() const;
};
#endif
/******************************************************************************
* 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.3, Ensure that external classes are used correctly.
** @verdict pass accept
*****************************************************************/
module Sem_5010103_externalClasses_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type external class /*Java_*/Int_List {
function add(integer v);
function get(integer index) return integer;
}
testcase TC_Sem_5010103_externalClasses_001() runs on GeneralComp {
//empty testcase
setverdict(pass);
}
control {
execute(TC_Sem_5010103_externalClasses_001());
}
}
/******************************************************************************
* 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.3, Ensure that If an internal class defines an external function, it shall be derived from an external class either directly or indirectly.
** @verdict pass accept
*****************************************************************/
module Sem_5010103_externalClasses_002 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type external class /*Java_*/Int2_List {
function add(integer v);
function get(integer index) return integer;
}
type class t_internal_class extends /*Java_*/Int2_List {
external function add(integer v);
}
testcase TC_Sem_5010103_externalClasses_002() runs on GeneralComp {
//empty testcase
setverdict(pass);
}
control {
execute(TC_Sem_5010103_externalClasses_002());
}
}
/******************************************************************************
* 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.4, Ensure that final classes are used correctly.
** @verdict pass accept
*****************************************************************/
module Sem_5010104_finalClasses_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class @final FinalClass {
//function doSomething() return charstring { FIXME!!! without visibility qualifier, protected is assumed
public function doSomething() return charstring {
return "something";
}
}
testcase TC_Sem_5010104_finalClasses_001() runs on GeneralComp {
var FinalClass v_a := FinalClass.create();
if (v_a.doSomething() == "something") {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010104_finalClasses_001());
}
}
/******************************************************************************
* 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.5, Ensure that class constructor can be used with formal parameter.
** @verdict pass accept
*****************************************************************/
module Sem_5010105_Constructors_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MyClass {
var integer v_i;
var charstring v_id;
create(integer v_i, charstring v_id) {
this.v_i := v_i;
this.v_id := v_id;
}
public function get_vi() return integer {
return this.v_i;
}
public function get_vid() return charstring {
return this.v_id;
}
}
testcase TC_Sem_5010105_Constructors_001() runs on GeneralComp {
var MyClass v_a := MyClass.create(5, "abc");
if (v_a.get_vi() == 5 and v_a.get_vid() == "abc") {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010105_Constructors_001());
}
}
/******************************************************************************
* 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.5, Ensure that the constructor of the superclass is executed
** before the constructor body of the subclass.
** @verdict pass accept
*****************************************************************/
module Sem_5010105_Constructors_002 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
/* public*/ var octetstring v_o;
create(octetstring v_o) {
this.v_o := v_o;
}
public function get_vo() return octetstring {
return this.v_o;
}
}
type class MySubClass extends MySuperClass {
/*public*/ var template charstring vt_cstr;
create(template charstring vt_cstr) : MySuperClass('AA5600'O) {
this.vt_cstr := vt_cstr;
}
}
testcase TC_Sem_5010105_Constructors_002() runs on GeneralComp {
var MySubClass v_a := MySubClass.create( pattern "?abc*");
if (v_a.get_vo() == 'AA5600'O) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010105_Constructors_002());
}
}
// This Test Port skeleton source file was generated by the
// TTCN-3 Compiler of the TTCN-3 Test Executor version 7/CAX 105 7730 R2A
// for Global Warning (james00@GlobalWarning1) on Tue Nov 10 10:16:29 2020
// Copyright (c) 2000-2020 Ericsson Telecom AB
// You may modify this file. Complete the body of empty functions and
// add your member functions here.
#include "MyPort.hh"
namespace Sem__5010106__Destructors__001 {
MyPort::MyPort(const char *par_port_name)
: MyPort_BASE(par_port_name)
{
}
MyPort::~MyPort()
{
}
void MyPort::set_parameter(const char * /*parameter_name*/,
const char * /*parameter_value*/)
{
}
/*void MyPort::Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error) {}*/
void MyPort::Handle_Fd_Event_Error(int /*fd*/)
{
}
void MyPort::Handle_Fd_Event_Writable(int /*fd*/)
{
}
void MyPort::Handle_Fd_Event_Readable(int /*fd*/)
{
}
/*void MyPort::Handle_Timeout(double time_since_last_call) {}*/
void MyPort::user_map(const char * /*system_port*/, Map_Params& /*params*/)
{
}
void MyPort::user_unmap(const char * /*system_port*/, Map_Params& /*params*/)
{
}
void MyPort::user_start()
{
}
void MyPort::user_stop()
{
}
void MyPort::outgoing_send(const INTEGER& /*send_par*/)
{
}
} /* end of namespace */
// This Test Port skeleton header file was generated by the
// TTCN-3 Compiler of the TTCN-3 Test Executor version 7/CAX 105 7730 R2A
// for Global Warning (james00@GlobalWarning1) on Tue Nov 10 10:16:29 2020
// Copyright (c) 2000-2020 Ericsson Telecom AB
// You may modify this file. Add your attributes and prototypes of your
// member functions here.
#ifndef MyPort_HH
#define MyPort_HH
#include "Sem_5010106_Destructors_001.hh"
namespace Sem__5010106__Destructors__001 {
class MyPort : public MyPort_BASE {
public:
MyPort(const char *par_port_name = NULL);
~MyPort();
void set_parameter(const char *parameter_name,
const char *parameter_value);
private:
/* void Handle_Fd_Event(int fd, boolean is_readable,
boolean is_writable, boolean is_error); */
void Handle_Fd_Event_Error(int fd);
void Handle_Fd_Event_Writable(int fd);
void Handle_Fd_Event_Readable(int fd);
/* void Handle_Timeout(double time_since_last_call); */
protected:
void user_map(const char *system_port, Map_Params& params);
void user_unmap(const char *system_port, Map_Params& params);
void user_start();
void user_stop();
void outgoing_send(const INTEGER& send_par);
};
} /* end of namespace */
#endif
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