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

OOP: added tests for template members


Signed-off-by: Miklos Magyari's avatarMiklos Magyari <miklos.magyari@sigmatechnology.se>
parent 12f8e3a8
......@@ -31,14 +31,16 @@ type class BadInheritance extends MyUnion {
type class SuperClass {
var integer vl_a;
template MyUnion t_union := { a := 10 }
}
type class SubClass extends SuperClass {
var integer vl_b;
public var integer vl_b;
}
type class GrandSubClass extends SubClass {
var integer vl_c;
template MyUnion t_union2 := { nonexist := 10 } // non-existing template member
}
type class GrandSubClass2 extends SubClass {
......
......@@ -87,6 +87,7 @@ type class VariousMembers {
private const octetstring m_var_octet := 'ABCD'O;
public var charstring m_var1 := "abc";
public template MyUnion t_union := { choice1 := 12 }
template MyUnion t_union2;
private type class NestedClass {
private function f_dummy(in integer x) return integer {
......@@ -96,6 +97,7 @@ type class VariousMembers {
create (charstring p1, charstring p2) {
m_var1 := p2;
t_union := { choice2 := "abc" };
}
}
......
......@@ -41,10 +41,12 @@ public class OOP_Semantic_tests {
private ArrayList<MarkerToCheck> oopNegative_ttcn_initializer() {
//oopNegativeSemanticTest.ttcn
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(5);
ArrayList<MarkerToCheck> markersToCheck = new ArrayList<MarkerToCheck>(6);
int lineNum = 28;
markersToCheck.add(new MarkerToCheck("class type expected", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 17;
lineNum += 15;
markersToCheck.add(new MarkerToCheck("Reference to non-existent field `nonexist' in union template for type `@classesNegativeSemantic.MyUnion'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 4;
markersToCheck.add(new MarkerToCheck("Local Definiton `vl_b' collides with definition inherited from class type `@classesNegativeSemantic.SubClass'", lineNum, IMarker.SEVERITY_ERROR));
lineNum += 9;
markersToCheck.add(new MarkerToCheck("Constant must be initialized", 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