Skip to content

Commit

Permalink
Updated nfinst tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Sep 12, 2017
1 parent ea9199b commit 91a80a7
Show file tree
Hide file tree
Showing 20 changed files with 157 additions and 112 deletions.
@@ -1,22 +1,21 @@
// name: bindings2.mo
// name: BindingArray1
// keywords:
// status: correct
// cflags: -d=newInst
// cflags: -d=newInst
//


model A
Real x;
Real x = 1.0;
end A;

model B
model BindingArray1
A a[3](x = {1, 2, 3});
end B;
end BindingArray1;

// Result:
// class B
// class BindingArray1
// Real a[1].x = 1.0;
// Real a[2].x = 2.0;
// Real a[3].x = 3.0;
// end B;
// end BindingArray1;
// endResult
21 changes: 21 additions & 0 deletions flattening/modelica/scodeinst/BindingArray2.mo
@@ -0,0 +1,21 @@
// name: BindingArray2
// keywords:
// status: correct
// cflags: -d=newInst
//

model A
Real x = 1.0;
end A;

model BindingArray2
A a[3](each x = 2.0);
end BindingArray2;

// Result:
// class BindingArray2
// Real a[1].x = 2.0;
// Real a[2].x = 2.0;
// Real a[3].x = 2.0;
// end BindingArray2;
// endResult
28 changes: 28 additions & 0 deletions flattening/modelica/scodeinst/BindingArray3.mo
@@ -0,0 +1,28 @@
// name: BindingArray3
// keywords:
// status: correct
// cflags: -d=newInst
//

model A
Real x = 1.0;
end A;

model B
A a[3];
end B;

model BindingArray3
B b[2](each a(x = {2, 3, 4}));
end BindingArray3;

// Result:
// class BindingArray3
// Real b[1].a[1].x = 2.0;
// Real b[1].a[2].x = 3.0;
// Real b[1].a[3].x = 4.0;
// Real b[2].a[1].x = 2.0;
// Real b[2].a[2].x = 3.0;
// Real b[2].a[3].x = 4.0;
// end BindingArray3;
// endResult
28 changes: 28 additions & 0 deletions flattening/modelica/scodeinst/BindingArray4.mo
@@ -0,0 +1,28 @@
// name: BindingArray4
// keywords:
// status: correct
// cflags: -d=newInst
//

model A
Real x = 1.0;
end A;

model B
A a[3];
end B;

model BindingArray4
B b[2](each a.x = 2);
end BindingArray4;

// Result:
// class BindingArray4
// Real b[1].a[1].x = 2.0;
// Real b[1].a[2].x = 2.0;
// Real b[1].a[3].x = 2.0;
// Real b[2].a[1].x = 2.0;
// Real b[2].a[2].x = 2.0;
// Real b[2].a[3].x = 2.0;
// end BindingArray4;
// endResult
@@ -1,10 +1,9 @@
// name: type1.mo
// name: BindingArray5
// keywords:
// status: correct
// cflags: -d=newInst
// cflags: -d=newInst
//


type MyReal = Real[4];

model A
Expand All @@ -18,12 +17,12 @@ model B
A b[3](x = {7, 8, 9});
end B;

model C
model BindingArray5
B b[2](a.x = {{1, 2, 3}, {4, 5, 6}});
end C;
end BindingArray5;

// Result:
// class C
// class BindingArray5
// Real b[1].a[1].x(start = 1.0) = 1.0;
// Real b[1].a[1].y[1];
// Real b[1].a[1].y[2];
Expand Down Expand Up @@ -108,5 +107,5 @@ end C;
// Real b[2].b[3].z[2];
// Real b[2].b[3].z[3];
// Real b[2].b[3].z[4];
// end C;
// end BindingArray5;
// endResult
@@ -1,7 +1,7 @@
// name: bindings3.mo
// name: BindingArray6
// keywords:
// status: correct
// cflags: -d=newInst
// cflags: -d=newInst
//


Expand All @@ -14,12 +14,12 @@ model B
A a[3];
end B;

model C
model BindingArray6
B b[2](a.x = {{1, 2, 3}, {4, 5, 6}}, a(each y = 2.0));
end C;
end BindingArray6;

// Result:
// class C
// class BindingArray6
// Real b[1].a[1].x = 1.0;
// Real b[1].a[1].y = 2.0;
// Real b[1].a[2].x = 2.0;
Expand All @@ -32,5 +32,5 @@ end C;
// Real b[2].a[2].y = 2.0;
// Real b[2].a[3].x = 6.0;
// Real b[2].a[3].y = 2.0;
// end C;
// end BindingArray6;
// endResult
5 changes: 2 additions & 3 deletions flattening/modelica/scodeinst/ForEquationEnum2.mo
Expand Up @@ -15,14 +15,13 @@ equation
end ForEquationEnum2;

// Result:
// class ForEquationEnum1
// class ForEquationEnum2
// enumeration(one, two, three) x[E.one];
// enumeration(one, two, three) x[E.two];
// enumeration(one, two, three) x[E.three];
// parameter enumeration(one, two, three) e;
// equation
// x[E.one] = E.one;
// x[E.two] = E.two;
// x[E.three] = E.three;
// end ForEquationEnum1;
// end ForEquationEnum2;
// endResult
33 changes: 19 additions & 14 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -3,6 +3,12 @@ TEST=../../../rtest -v
TESTFILES=\
arrfunc.mo \
Binding1.mo \
BindingArray1.mo \
BindingArray2.mo \
BindingArray3.mo \
BindingArray4.mo \
BindingArray5.mo \
BindingArray6.mo \
bindings1.mo \
bindings4.mo \
bindings5.mo \
Expand Down Expand Up @@ -37,6 +43,7 @@ const7.mo \
const8.mo \
const10.mo \
const11.mo \
const12.mo \
const13.mo \
const14.mo \
const15.mo \
Expand All @@ -54,6 +61,9 @@ dim1.mo \
dim10.mo \
dim12.mo \
dim13.mo \
dim14.mo \
dim15.mo \
dim16.mo \
dim17.mo \
dim18.mo \
dim19.mo \
Expand All @@ -78,6 +88,8 @@ enum5.mo \
enum7.mo \
enum8.mo \
eq1.mo \
eq6.mo \
eq7.mo \
eq10.mo \
Extends1.mo \
Extends2.mo \
Expand All @@ -99,6 +111,7 @@ ForEquation3.mo \
ForEquation4.mo \
ForEquation5.mo \
ForEquationEnum1.mo \
ForEquationEnum2.mo \
ForEquationNonParam.mo \
ForStatement1.mo \
ForStatement2.mo \
Expand Down Expand Up @@ -196,6 +209,8 @@ RangeTypeError2.mo \
RangeTypeError3.mo \
RecursiveExtends1.mo \
RedeclareClass1.mo \
RedeclareElementClass1.mo \
RedeclareElementComp1.mo \
RedeclareElementMissing1.mo \
RedeclareElementMissing2.mo \
redeclare1.mo \
Expand Down Expand Up @@ -241,40 +256,35 @@ ModClass2.mo \
ModClass4.mo \
ModClass5.mo \
DuplicateElementsCond1.mo \
bindings2.mo \
bindings3.mo \
ceval4.mo \
compfunc.mo \
cond1.mo \
cond2.mo \
cond3.mo \
conn10.mo \
conn11.mo \
conn12.mo \
conn13.mo \
conn14.mo \
conn3.mo \
conn5.mo \
conn6.mo \
conn7.mo \
conn8.mo \
conn9.mo \
conngraph1.mo \
conngraph2.mo \
const12.mo \
const4.mo \
const5.mo \
const6.mo \
ConstantConnector1.mo \
ConstantConnector2.mo \
ConstantConnector3.mo \
dim14.mo \
dim15.mo \
dim16.mo \
dim2.mo \
enum6.mo \
eq2.mo \
eq3.mo \
eq4.mo \
eq5.mo \
eq6.mo \
eq7.mo \
eq8.mo \
eq9.mo \
expconn1.mo \
Expand All @@ -284,10 +294,7 @@ expconn4.mo \
expconn5.mo \
expconn6.mo \
expconn7.mo \
extends1.mo \
extends2.mo \
ExtendsVisibility.mo \
ForEquationEnum2.mo \
func1.mo \
func2.mo \
func4.mo \
Expand Down Expand Up @@ -349,7 +356,6 @@ InvalidVariability2.mo \
loop4.mo \
MissingRedeclare1.mo \
mod13.mo \
mod7.mo \
MultiInheritanceRedeclare1.mo \
MultiInheritanceRedeclare2.mo \
noretcall1.mo \
Expand All @@ -363,7 +369,6 @@ redeclare4.mo \
redeclare5.mo \
redeclare8.mo \
RedeclaredFunction1.mo \
type1.mo \
type4.mo \
type5.mo \

Expand Down
12 changes: 5 additions & 7 deletions flattening/modelica/scodeinst/Range1.mo
Expand Up @@ -11,11 +11,9 @@ model Range1
end Range1;

// Result:
// Error processing file: Range1.mo
// [flattening/modelica/scodeinst/Range1.mo:10:3-10:28:writable] Error: Expected E to be a component, but found class instead.
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
//
// Execution failed!
// class Range1
// enumeration(one, two, three) x[E.one] = E.one;
// enumeration(one, two, three) x[E.two] = E.two;
// enumeration(one, two, three) x[E.three] = E.three;
// end Range1;
// endResult
6 changes: 6 additions & 0 deletions flattening/modelica/scodeinst/RedeclareElementClass1.mo
Expand Up @@ -19,3 +19,9 @@ model RedeclareElementClass1
Real x = 2.0;
end B;
end RedeclareElementClass1;

// Result:
// class RedeclareElementClass1
// Real b.x = 2.0;
// end RedeclareElementClass1;
// endResult
6 changes: 3 additions & 3 deletions flattening/modelica/scodeinst/RedeclareElementComp1.mo
Expand Up @@ -15,7 +15,7 @@ model RedeclareElementComp1
end RedeclareElementComp1;

// Result:
// class B
// Real m.y;
// end B;
// class RedeclareElementComp1
// Real x = 2.0;
// end RedeclareElementComp1;
// endResult
18 changes: 4 additions & 14 deletions flattening/modelica/scodeinst/const12.mo
@@ -1,9 +1,8 @@
// name: const12.mo
// name: const12
// keywords:
// status: correct
// cflags: -d=newInst
// cflags: -d=newInst
//
// FAILREASON: Subscripted types not handled yet.
//

package A
Expand All @@ -20,17 +19,8 @@ model B
end B;

// Result:
//
// EXPANDED FORM:
//
// class B
// Real x = {1,2,3};
// end B;
//
//
// Found 1 components and 0 parameters.
// class B
// constant Integer j = 2;
// Real x = 2.0;
// constant Integer j = A.m[1].i[2];
// Real x = /*Real*/(j);
// end B;
// endResult

0 comments on commit 91a80a7

Please sign in to comment.