Commit 71aa3a98 authored by Miklos Magyari's avatar Miklos Magyari
Browse files

OOP: added some more semantic test


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 11e9ea58
......@@ -33,7 +33,7 @@ type class SuperClass {
var integer vl_a;
template MyUnion t_union := { a := 10 }
}
type class SubClass extends SuperClass {
public var integer vl_b;
}
......@@ -153,6 +153,16 @@ type class FuncClass extends BaseFunctionClass {
var integer vl_int := f_get_one();
var charstring vl_cs:= super.f_get_one();
}
public function f_dummy(in integer pl_int) return float {
return 0.1;
}
}
// function with class parameter
function f_class_param(FuncClass pl_fun) {
var integer vl_int := pl_fun.f_dummy(1); // type mismatch
var charstring vl_chr := pl_fun.f_get_one(); // correct
}
testcase tc_basicSyntax() runs on CT {
......
......@@ -97,8 +97,8 @@ type class VariousMembers {
type class @trait AbstractMembersClass {
function @abstract f();
function @abstract f2(in integer p_int);
function @abstract f3(in integer p_int) return charstring;
function @abstract f2(in integer pl_int);
function @abstract f3(in integer pl_int) return charstring;
}
// nested classes
......
......@@ -45,7 +45,7 @@ public class OOP_Semantic_tests {
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
//oopNegativeSemanticTest.ttcn
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(18);
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(19);
int lineNum = 28;
markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 15;
......@@ -71,6 +71,8 @@ public class OOP_Semantic_tests {
lineNum += 10;
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `integer' was expected instead of `charstring'", lineNum, IMarker.SEVERITY_ERROR));
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `charstring' was expected instead of `integer'", ++lineNum, IMarker.SEVERITY_ERROR));
lineNum += 10;
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `integer' was expected instead of `float'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 11;
markersToCheck.add(new MarkerToCheck("Unknown field reference", lineNum, IMarker.SEVERITY_ERROR));
markersToCheck.add(new MarkerToCheck("Type mismatch: a value of type `charstring' was expected instead of `integer'", ++lineNum, IMarker.SEVERITY_ERROR));
......
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