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 1133 additions and 0 deletions
/******************************************************************************
* 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.6, Ensure that class destructors can be used.
** @verdict pass accept
*****************************************************************/
module Sem_5010106_Destructors_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
port MyPort p1;
}
type port MyPort message {
inout integer;
}
type class MyClass {
var integer v_i;
create(integer v_i) {
this.v_i := v_i;
}
public function get_vi() return integer {
return this.v_i;
}
} finally {
this.v_i := 0;
}
testcase TC_Sem_5010106_Destructors_001() runs on GeneralComp {
var MyClass v_a := MyClass.create(7);
timer T1 := 5.0;
connect(self:p1, self:p1);
p1.send(v_a.get_vi()); //test port with loopback
alt {
[] p1.receive(7) { T1.stop; setverdict(pass); }
[] p1.receive { T1.stop; setverdict(fail); }
[] T1.timeout { setverdict(fail); }
}
disconnect(self:p1, self:p1);
}
control {
execute(TC_Sem_5010106_Destructors_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.7, Ensure that The return type of an overriding function shall be the same as the return type of the overridden function with the same template restrictions and modifiers.
** @verdict pass reject
*****************************************************************/
module NegSem_5010107_Methods_003 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type integer Mytype1;
type Mytype1 Mytype2;
type class MySuperClass {
var octetstring v_o;
function doSomething() return Mytype1 {
return oct2int(this.v_o);
}
}
type class MySubClass extends MySuperClass {
// / * protected */ function doSomething() return Mytype2 { //allowed
public function doSomething() return Mytype2 { //allowed
return 1;
}
}
testcase TC_NegSem_5010107_Methods_003() runs on GeneralComp {
var MySubClass v_a := MySubClass.create('AAFF'O) //: MySuperClass(); FIXME!!!
if (v_a.doSomething() == 1) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_NegSem_5010107_Methods_003());
}
}
/******************************************************************************
* 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.7, Ensure that class methods can be used. .
** @verdict pass accept
*****************************************************************/
module Sem_5010107_Methods_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MyClass {
var integer v_i;
create(integer v_i) {
this.v_i := v_i;
}
public function doSomething() return integer {
return this.v_i + 1;
}
}
testcase TC_Sem_5010107_Methods_001() runs on GeneralComp {
var MyClass v_a := MyClass.create(126);
if (v_a.doSomething() == 127) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010107_Methods_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.7, Ensure that a method inherited from a superclass can be overridden by the subclass.
** @verdict pass accept
*****************************************************************/
module Sem_5010107_Methods_002 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
var octetstring v_o;
public function doSomething() return integer {
return oct2int(this.v_o);
}
}
type class MySubClass extends MySuperClass {
public function doSomething() return integer {
return 1;
}
}
testcase TC_Sem_5010107_Methods_002() runs on GeneralComp {
var MySubClass v_a := MySubClass.create('AAFF'O) //: MySuperClass(); FIXME!!!
if (v_a.doSomething() == 1) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010107_Methods_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.7, Ensure that if a method shall not be overridden by any subclass, it can be declared as @final.
** @verdict pass accept
*****************************************************************/
module Sem_5010107_Methods_003 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
var octetstring v_o;
public function @final doSomething() return integer {
return oct2int(this.v_o);
}
}
type class MySubClass extends MySuperClass {
}
testcase TC_Sem_5010107_Methods_003() runs on GeneralComp {
var MySubClass v_a := MySubClass.create('AAFF'O) //: MySuperClass(); FIXME!!!
if (v_a.doSomething() == 43775) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010107_Methods_003());
}
}
/******************************************************************************
* 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.8, Ensure that use method invocation.
** @verdict pass accept
*****************************************************************/
module Sem_5010108_MethodInvocation_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MyClass {
var hexstring v_h;
public function f_hex() return bitstring {
return hex2bit(this.v_h);
}
}
testcase TC_Sem_5010108_MethodInvocation_001() runs on GeneralComp {
var MyClass v_a := MyClass.create('FA1'H);
if (v_a.f_hex() == '111110100001'B) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010108_MethodInvocation_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.9, Ensure that private member functions are not visible and can be present in multiple classes of the same hierarchy with different parameter lists and return values.
** @verdict pass accept
*****************************************************************/
module Sem_5010109_Visibility_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
var integer v_i;
private function f_do(integer v_i) return integer {
return this.v_i + v_i;
}
}
type class MySubClass extends MySuperClass {
private function f_do() {
log("Do nothing!!! (Visibility)");
}
}
testcase TC_Sem_5010109_Visibility_001() runs on GeneralComp {
var MySubClass v_a := MySubClass.create(32) //: MySuperClass(); FIXME!!!
setverdict(pass);
}
control {
execute(TC_Sem_5010109_Visibility_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.9, Ensure that public member functions can be called from any behaviour running on the object's owner component.
** @verdict pass accept
*****************************************************************/
module Sem_5010109_Visibility_002 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
const hexstring general_vh := 'A'H;
}
type class MyClass runs on GeneralComp {
var integer v_i;
public function f_add(hexstring vh) return hexstring {
return int2hex((hex2int(vh) + this.v_i), 1);
}
}
testcase TC_Sem_5010109_Visibility_002() runs on GeneralComp {
var MyClass v_a := MyClass.create(5);
if (v_a.f_add(general_vh) == 'F'H) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010109_Visibility_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.9, Ensure that a public member function can only be overridden by another public member function.
** @verdict pass accept
*****************************************************************/
module Sem_5010109_Visibility_003 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type class MySuperClass {
var integer v_i;
public function f_add(integer inint) return integer {
return this.v_i + inint;
}
}
type class MySubClass extends MySuperClass {
public function f_add(integer inint) return integer {
return this.v_i + 1;
}
}
testcase TC_Sem_5010109_Visibility_003() runs on GeneralComp {
var MySubClass v_a := MySubClass.create(1);
if (v_a.f_add(2) == 2) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_5010109_Visibility_003());
}
}
// 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:57:42 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__50101__top__level__008 {
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 CHARSTRING& send_par /*send_par*/)
{
incoming_message(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:57:42 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_50101_top_level_008.hh"
namespace Sem__50101__top__level__008 {
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 CHARSTRING& send_par);
};
} /* end of namespace */
#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.0, Ensure that a class can declare variables as its members.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_001 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
public type class t_class_var_fields {
private var integer v_i := 1;
private var float v_f := 0.55;
private var bitstring v_bs := '1101'B;
private var hexstring v_hs := '1CD5'H;
private var octetstring v_os := '00FFCD58'O;
private var charstring v_cs := "abc";
private var universal charstring v_ucs := char(0, 0, 0, 97);
private var boolean v_b := true;
public function get_v_os() return octetstring {
return this.v_os;
}
public function get_v_b() return boolean {
return this.v_b;
}
public function get_v_i() return integer {
return this.v_i;
}
public function get_v_f() return float {
return this.v_f;
}
public function get_v_bs() return bitstring {
return this.v_bs;
}
public function get_v_hs() return hexstring {
return this.v_hs;
}
public function get_v_cs() return charstring {
return this.v_cs;
}
public function get_v_ucs() return universal charstring {
return this.v_ucs;
}
}
testcase TC_Sem_50101_top_level_001() runs on GeneralComp {
//var t_class_var_fields v_a := t_class_var_fields.create(); FIXME!!!
var t_class_var_fields v_a := t_class_var_fields.create(1,0.55,'1101'B,'1CD5'H,'00FFCD58'O,"abc",char(0, 0, 0, 97),true);
if (v_a.get_v_i() == 1 and v_a.get_v_f() == 0.55 and v_a.get_v_bs() == '1101'B and v_a.get_v_hs() == '1CD5'H and v_a.get_v_os() == '00FFCD58'O and v_a.get_v_cs() == "abc" and v_a.get_v_ucs() == char(0,0,0,97) and v_a.get_v_b()) {
setverdict(pass)
} else {
setverdict(fail)
}
}
control {
execute(TC_Sem_50101_top_level_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.0, Ensure that a class can declare a subtype variable as its field member.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_002 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type integer MyType;
public type class t_class_subt_var_field {
var MyType v_mytype := 345;
// /* protected */ function get_v_mytype() return MyType { //FIXME!!! without visibility qualifier, protected is assumed
public function get_v_mytype() return MyType {
return this.v_mytype;
}
}
testcase TC_Sem_50101_top_level_002() runs on GeneralComp {
//var t_class_subt_var_field v_a := t_class_subt_var_field.create(); FIXME!!!
var t_class_subt_var_field v_a := t_class_subt_var_field.create(345);
if (v_a.get_v_mytype() == 345) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_50101_top_level_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.0, Ensure that a class can declare constants as its members.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_003 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
public type class t_class_const_field {
private const charstring cons_ver_id := "1.0v12";
public function get_cons_verid() return charstring {
return this.cons_ver_id;
}
}
testcase TC_Sem_50101_top_level_003() runs on GeneralComp {
//var t_class_const_field v_a := t_class_const_field.create(); FIXME!!!!
var t_class_const_field v_a := t_class_const_field.create("1.0v12");
if (v_a.get_cons_verid() == "1.0v12") {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_50101_top_level_003());
}
}
/******************************************************************************
* 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.0, Ensure that a class can declare templates as its members.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_004 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
public type class t_class_template_field {
var template charstring vt_cs := pattern "[abc]";
public function get_vtcs() return template charstring {
return this.vt_cs;
}
}
testcase TC_Sem_50101_top_level_004() runs on GeneralComp {
var charstring v_cs := "b";
//var t_class_template_field v_a := t_class_template_field.create(); FIXME!!!
var t_class_template_field v_a := t_class_template_field.create(pattern "[abc]");
if (match(v_cs, v_a.get_vtcs())) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_50101_top_level_004());
}
}
/******************************************************************************
* 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.0, Ensure that a class can declare a port as its member.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_005 "TTCN-3:2018 Object-Oriented" {
type port PortType message {
inout integer;
}
type component TestComp {
}
/* type component TestComp1 {
port PortType p1;
}
*/
type component TestComp2 {
var t_class_port_field tc := t_class_port_field.create();
}
public type class t_class_port_field {
port PortType p1;
}
//TODO: if port members in classes are not allowed this testcase is unnecessary.
//testcase TC_Sem_50101_top_level_005 runs on TestComp { //FIXME!!! typo
testcase TC_Sem_50101_top_level_005() runs on TestComp {
}
}
/******************************************************************************
* 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.0, Ensure that a class can declare a timer as its member.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_006 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
public type class t_class_timer_field {
timer t_timer := 5.0;
public function getTimer() return timer {
return this.t_timer;
}
}
testcase TC_Sem_50101_top_level_006() runs on GeneralComp {
var t_class_timer_field v_a := t_class_timer_field.create();
v_a.getTimer().start;
alt {
[] v_a.getTimer().timeout { setverdict(pass); }
};
}
control {
execute(TC_Sem_50101_top_level_006());
}
}
/******************************************************************************
* 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.0, Ensure that a class can extend an other class.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_007 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp{
}
public type class t_class_superclass {
const integer c_i := 15;
public function get_ci() return integer {
return this.c_i;
}
}
public type class t_class_subclass extends t_class_superclass {
}
testcase TC_Sem_50101_top_level_007() runs on GeneralComp {
//var t_class_subclass v_a := t_class_subclass.create(); FIXME!!!
var t_class_subclass v_a := t_class_subclass.create(15)
if (v_a.get_ci() == 15) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(TC_Sem_50101_top_level_007());
}
}
/******************************************************************************
* 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.0, Ensure that a class can have an optional "runs on", "mtc", or "system" clause.
** @verdict pass accept
*****************************************************************/
module Sem_50101_top_level_008 "TTCN-3:2018 Object-Oriented" {
type component GeneralComp {
}
type port Myport message {
inout charstring;
}
type component TestComp {
port Myport p1;
}
public type class t_class_with_runs_on runs on GeneralComp {
var octetstring v_o := '11AD0000'O;
public function get_vo() return octetstring{
return this.v_o;
}
}
public type class t_class_with_runs_on_with_system runs on TestComp system TestComp {
const charstring c_cstr := "Finally";
public function get_ccstr() return charstring{
return this.c_cstr;
}
}
testcase TC_Sem_50101_top_level_008_01() runs on GeneralComp {
//var t_class_with_runs_on v_a := t_class_with_runs_on.create(); FIXME!!!
var t_class_with_runs_on v_a := t_class_with_runs_on.create('11AD0000'O);
if (v_a.get_vo() == '11AD0000'O) {
setverdict(pass)
} else {
setverdict(fail);
}
}
testcase TC_Sem_50101_top_level_008_02() runs on TestComp system TestComp {
map(self:p1,system:p1);
timer T1 := 5.0;
//var t_class_with_runs_on_with_system v_a := t_class_with_runs_on_with_system.create(); FIXME!!!
var t_class_with_runs_on_with_system v_a := t_class_with_runs_on_with_system.create("Finally");
p1.send(v_a.get_ccstr());
alt {
[] p1.receive("Finally") { T1.stop; setverdict(pass); }
[] p1.receive { T1.stop; setverdict(fail); }
[] T1.timeout { setverdict(fail); }
}
unmap(self:p1,system:p1);
}
control {
execute(TC_Sem_50101_top_level_008_01());
execute(TC_Sem_50101_top_level_008_02());
}
}
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