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

OOP: added tests for class of-reference


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 131281ab
......@@ -95,6 +95,15 @@ testcase tc_basicSyntax() runs on CT {
var charstring vl_int4 := vl_gsc.vl_d; // incorrect : nonexisting member
var charstring vl_int5 := vl_gsc.vl_a; // incorrect : type mismatch
var OuterClass vl_outer := OuterClass.create;
var OuterClass vl_outer2;
if (vl_outer of OuterClass) {
vl_outer := vl_outer2;
}
var integer vl_integer := vl_outer of OuterClass; // type mismatch
var boolean vl_boolean := vl_outer of BaseFunctionClass; // semanticall correct
}
}
\ No newline at end of file
......@@ -104,6 +104,7 @@ type class @trait AbstractMembersClass {
// nested classes
type class OuterClass {
private var integer m_int := 0;
public var charstring m_string := "abc";
private class NestedClass {
private function f_dummy(in integer pl_param) return integer {
......@@ -190,6 +191,12 @@ testcase tc_basicSyntax() runs on CT {
// class method call
vl_sub4.f_get_all_sum();
// class of-operator
var OuterClass vl_outerClass := OuterClass.create;
if (vl_outerClass of OuterClass) {
vl_outerClass.m_string := "xyz";
}
}
control {
......
......@@ -41,7 +41,7 @@ public class OOP_Semantic_tests {
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
//oopNegativeSemanticTest.ttcn
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(8);
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(9);
int lineNum = 28;
markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 15;
......@@ -57,6 +57,8 @@ public class OOP_Semantic_tests {
lineNum += 17;
markersToCheck.add(new MarkerToCheck("There is no visible definition with name `vl_gsc' in module `classesNegativeSemantic'", 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 += 8;
markersToCheck.add(new MarkerToCheck("integer value was expected", lineNum, IMarker.SEVERITY_ERROR));
return markersToCheck;
}
......
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