Commit bc3b6fc5 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: added 50101_top_level positive conf tests


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 02517dde
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class declare variables as its members.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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 vl_a := t_class_var_fields.create();
if (vl_a.get_v_i() == 1 and vl_a.get_v_f() == 0.55 and vl_a.get_v_bs() == '1101'B and vl_a.get_v_hs() == '1CD5'H and vl_a.get_v_os() == '00FFCD58'O and vl_a.get_v_cs() == "abc" and vl_a.get_v_ucs() == char(0,0,0,97) and vl_a.get_v_b()) {
setverdict(pass)
} else {
setverdict(fail)
}
}
control {
execute(tc_Sem_50101_top_level_001());
}
}
\ No newline at end of file
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class declare a subtype variable as its field member.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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;
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 vl_a := t_class_subt_var_field.create();
if (vl_a.get_v_mytype() == 345) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(tc_Sem_50101_top_level_002());
}
}
\ No newline at end of file
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class declare constants as its members.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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 vl_a := t_class_const_field.create();
if (vl_a.get_cons_verid() == "1.0v12") {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(tc_Sem_50101_top_level_003());
}
}
\ No newline at end of file
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class declare templates as its members.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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 vl_cs := "b";
var t_class_template_field vl_a := t_class_template_field.create();
if (match(vl_cs, vl_a.get_vtcs())) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(tc_Sem_50101_top_level_004());
}
}
\ No newline at end of file
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class extend an other class.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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 vl_a := t_class_subclass.create();
if (vl_a.get_ci() == 15) {
setverdict(pass);
} else {
setverdict(fail);
}
}
control {
execute(tc_Sem_50101_top_level_007());
}
}
\ No newline at end of file
/*****************************************************************
** @author STF 572
** @version 0.0.1
** @purpose 5.1.1.0, Ensure that a class have an optional "runs on", "mtc", or "system" clause.
** @verdict pass accept
**
** modified by Miklos Magyari
*****************************************************************/
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_PT;
}
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 vl_a := t_class_with_runs_on.create();
if (vl_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_PT,system:p1_PT);
timer TL_1 := 5.0;
var t_class_with_runs_on_with_system vl_a := t_class_with_runs_on_with_system.create();
p1_PT.send(vl_a.get_ccstr());
alt {
[] p1_PT.receive("Finally") { TL_1.stop; setverdict(pass); }
[] p1_PT.receive { TL_1.stop; setverdict(fail); }
[] TL_1.timeout { setverdict(fail); }
}
unmap(self:p1_PT,system:p1_PT);
}
control {
execute(tc_Sem_50101_top_level_008_01());
execute(tc_Sem_50101_top_level_008_02());
}
}
\ No newline at end of file
......@@ -9,6 +9,8 @@
package org.eclipse.titan.regressiontests.designer.statictests.Basic_tests;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IMarker;
import org.eclipse.titan.designer.Activator;
......@@ -25,6 +27,7 @@ import org.junit.Test;
public class OOP_Semantic_tests {
private static final String DIR_PATH = "src/Basic_tests/";
private static final String OOP_NEGATIVE_BASIC_SEMANTIC = "/OopNegativeSemanticTest.ttcn";
private List<String> testFilesPositive = OOP_Syntax_tests.testFilesPositive;
private static boolean parseOOP;
......@@ -39,8 +42,9 @@ public class OOP_Semantic_tests {
@Test
public void OOPNegativeSemantic_Test() throws Exception {
if (parseOOP)
if (parseOOP) {
Designer_plugin_tests.checkSemanticMarkersOnFile(oopNegative_ttcn_initializer(), DIR_PATH + OOP_NEGATIVE_BASIC_SEMANTIC);
}
}
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
......
......@@ -9,6 +9,8 @@
package org.eclipse.titan.regressiontests.designer.statictests.Basic_tests;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IMarker;
import org.eclipse.titan.designer.Activator;
......@@ -22,7 +24,18 @@ public class OOP_Syntax_tests {
private static final String DIR_PATH = "src/Basic_tests/";
private static final String OOP_POSITIVE_BASIC_SYNTAX = "/OopPositiveBasicSyntax.ttcn";
private static final String OOP_NEGATIVE_BASIC_SYNTAX = "/OopNegativeBasicSyntax.ttcn";
public static final String OOP_DIR_PATH = "src/OOP_conf_tests/";
public static List<String> testFilesPositive = Arrays.asList(
"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"
);
private static boolean parseOOP;
@BeforeClass
......@@ -33,12 +46,19 @@ public class OOP_Syntax_tests {
Designer_plugin_tests.ignoreMarkersOnFile(DIR_PATH + OOP_POSITIVE_BASIC_SYNTAX);
Designer_plugin_tests.ignoreMarkersOnFile(DIR_PATH + OOP_NEGATIVE_BASIC_SYNTAX);
for (String testFile : testFilesPositive) {
Designer_plugin_tests.ignoreMarkersOnFile(OOP_DIR_PATH + "positive/" + testFile);
}
}
@Test
public void OOPPositiveSyntax_Test() throws Exception {
if (parseOOP)
if (parseOOP) {
checkZeroMarkersOnFile(OOP_POSITIVE_BASIC_SYNTAX);
for (String testFile : testFilesPositive) {
Designer_plugin_tests.checkRealZeroSemanticMarkersOnFile(OOP_DIR_PATH + "positive/" + testFile);
}
}
}
@Test
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment