Skip to content

Commit

Permalink
Added and reactivated new inst test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Nov 23, 2016
1 parent ef666ab commit dcfd6aa
Show file tree
Hide file tree
Showing 7 changed files with 127 additions and 5 deletions.
14 changes: 9 additions & 5 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -20,10 +20,12 @@ DuplicateMod3.mo \
DuplicateMod4.mo \
DuplicateMod5.mo \
eq1.mo \
extends3.mo \
ImportNamed1.mo \
ImportNamed2.mo \
ImportNested1.mo \
ImportQualified1.mo \
loop2.mo \
mod10.mo \
mod11.mo \
mod1.mo \
Expand All @@ -32,13 +34,19 @@ mod5.mo \
mod6.mo \
mod8.mo \
mod9.mo \
NonexistentRedeclareModifier1.mo \
NonexistentRedeclareModifier2.mo \
ParameterBug.mos \
redeclare13.mo \
redeclare2.mo \
redeclare6.mo \
type2.mo \
usertype1.mo \
usertype2.mo \
loop2.mo \
usertype3.mo \
usertype4.mo \
usertype5.mo \
usertype6.mo \

# test that currently fail. Move up when fixed.
# Run make testfailing
Expand Down Expand Up @@ -137,8 +145,6 @@ mod12.mo \
mod13.mo \
mod7.mo \
MultiInheritanceRedeclare2.mo \
NonexistentRedeclareModifier1.mo \
NonexistentRedeclareModifier2.mo \
PartialInst.mo \
RecursiveExtends1.mo \
RecursiveExtends2.mo \
Expand All @@ -147,7 +153,6 @@ redeclare5.mo \
redeclare11.mo \
redeclare12.mo \
type1.mo \
type2.mo \
type3.mo \
type4.mo \
type5.mo \
Expand Down Expand Up @@ -190,7 +195,6 @@ expconn5.mo \
expconn6.mo \
extends1.mo \
extends2.mo \
extends3.mo \
for1.mo \
for2.mo \
func2.mo \
Expand Down
30 changes: 30 additions & 0 deletions flattening/modelica/scodeinst/extends3.mo
@@ -0,0 +1,30 @@
// name: extends3.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//
// Checks that inherited components are not instantiated in the scope they're
// inherited into.
//

model A
C c;
end A;

model B
model C
Real x;
end C;

extends A;
end B;

// Result:
// Error processing file: extends3.mo
// [flattening/modelica/scodeinst/extends3.mo:11:3-11:6:writable] Error: Class C not found in scope <unknown>.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/usertype2.mo
Expand Up @@ -10,6 +10,7 @@ model M
MyReal x;
Real y(start = 1.0);
end M;

// Result:
// class M
// Real x(start = 1.0);
Expand Down
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/usertype3.mo
@@ -0,0 +1,21 @@
// name: usertype3.mo
// keywords:
// status: correct
// cflags: -d=newInst
//

type MyReal = Real;

model M
MyReal x;
MyReal y(start = 1.0);
MyReal z(start = 2.0);
end M;

// Result:
// class M
// Real x;
// Real y(start = 1.0);
// Real z(start = 2.0);
// end M;
// endResult
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/usertype4.mo
@@ -0,0 +1,23 @@
// name: usertype4.mo
// keywords:
// status: correct
// cflags: -d=newInst
//

type MyReal = Real;
type MyReal2 = MyReal(start = 3.0);
type MyReal3 = MyReal2(start = 4.0);

model M
MyReal x;
MyReal2 y;
MyReal3 z;
end M;

// Result:
// class M
// Real x;
// Real y(start = 3.0);
// Real z(start = 4.0);
// end M;
// endResult
19 changes: 19 additions & 0 deletions flattening/modelica/scodeinst/usertype5.mo
@@ -0,0 +1,19 @@
// name: usertype5.mo
// keywords:
// status: correct
// cflags: -d=newInst
//

model MyReal
extends Real;
end MyReal;

model M
MyReal x;
end M;

// Result:
// class M
// Real x;
// end M;
// endResult
24 changes: 24 additions & 0 deletions flattening/modelica/scodeinst/usertype6.mo
@@ -0,0 +1,24 @@
// name: usertype6.mo
// keywords:
// status: incorrect
// cflags: -d=newInst
//

model MyReal
extends Real;
Real y;
end MyReal;

model M
MyReal x;
end M;

// Result:
// Error processing file: usertype6.mo
// [flattening/modelica/scodeinst/usertype6.mo:8:3-8:15:writable] Error: A class extending from builtin type Real may not have other elements.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// endResult

0 comments on commit dcfd6aa

Please sign in to comment.