Skip to content

Commit

Permalink
Update nfinst tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Nov 22, 2017
1 parent b22d273 commit b674956
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 46 deletions.
1 change: 1 addition & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -338,6 +338,7 @@ NonConnectorFlow1.mo \
NonexistentRedeclareModifier1.mo \
NonexistentRedeclareModifier2.mo \
PackageConstant1.mo \
PackageConstant2.mo \
ParameterBug.mos \
PropagateExtends.mo \
RangeInvalidStep1.mo \
Expand Down
6 changes: 2 additions & 4 deletions flattening/modelica/scodeinst/MultiInheritanceRedeclare1.mo
Expand Up @@ -30,9 +30,7 @@ end MultiInheritanceRedeclare1;

// Result:
// class MultiInheritanceRedeclare1
// constant Integer c.P.j = 5;
// constant Integer c.P.i = 3;
// Integer c.x = c.P.i;
// Integer c.y = c.P.j;
// Integer c.x = 3;
// Integer c.y = 5;
// end MultiInheritanceRedeclare1;
// endResult
5 changes: 2 additions & 3 deletions flattening/modelica/scodeinst/PackageConstant1.mo
@@ -1,4 +1,4 @@
// name: PackageConstant.mo
// name: PackageConstant1
// keywords:
// status: correct
// cflags: -d=newInst
Expand All @@ -14,7 +14,6 @@ end PackageConstant1;

// Result:
// class PackageConstant1
// constant Real P.x = 1.0;
// Real y = P.x;
// Real y = 1.0;
// end PackageConstant1;
// endResult
38 changes: 38 additions & 0 deletions flattening/modelica/scodeinst/PackageConstant2.mo
@@ -0,0 +1,38 @@
// name: PackageConstant2
// keywords:
// status: correct
// cflags: -d=newInst,-replacePackageConstants
//
// Tests that package constants are collected correctly when the
// replacePackageConstants debug flag is disabled.
//

package P
constant Real x1 = 1.0;
constant Real x2 = 2.0;
constant Real x3 = 3.0;
constant Real x4 = 4.0;
end P;

model PackageConstant2
Real y = P.x1;
Real z;
equation
z = P.x2;
algorithm
z := P.x3;
end PackageConstant2;

// Result:
// class PackageConstant2
// constant Real P.x3 = 3.0;
// constant Real P.x2 = 2.0;
// constant Real P.x1 = 1.0;
// Real y = P.x1;
// Real z;
// equation
// z = P.x2;
// algorithm
// z := P.x3;
// end PackageConstant2;
// endResult
3 changes: 1 addition & 2 deletions flattening/modelica/scodeinst/const10.mo
Expand Up @@ -19,8 +19,7 @@ end C;

// Result:
// class C
// constant Integer A.i = 3;
// constant Integer b.j = A.i;
// constant Integer b.j = 3;
// Real b.x = /*Real*/(b.j);
// end C;
// endResult
9 changes: 3 additions & 6 deletions flattening/modelica/scodeinst/const11.mo
Expand Up @@ -35,16 +35,13 @@ end M;

// Result:
// class M
// constant Integer P.A.j = 2;
// constant Integer P.A.B.i = P.A.j;
// constant Integer B.i = P.A.j;
// Integer x = P.A.B.i;
// Integer x = 2;
// constant Integer a.j = 3;
// Integer y = a.j;
// constant Integer b.i = P.A.j;
// constant Integer b.i = 2;
// Integer z = b.i;
// constant Integer j = 2;
// Integer w = j;
// Integer v = B.i;
// Integer v = 2;
// end M;
// endResult
3 changes: 1 addition & 2 deletions flattening/modelica/scodeinst/const12.mo
Expand Up @@ -20,8 +20,7 @@ end B;

// Result:
// class B
// constant Integer A.m.i = {1, 2, 3};
// constant Integer j = A.m[1].i[2];
// constant Integer j = 2;
// Real x = /*Real*/(j);
// end B;
// endResult
4 changes: 1 addition & 3 deletions flattening/modelica/scodeinst/const14.mo
Expand Up @@ -28,8 +28,6 @@ end M;

// Result:
// class M
// constant Integer B.A.B.j = 2;
// constant Integer A.B.A.B.i = B.A.B.j;
// Integer x = A.B.A.B.i;
// Integer x = 2;
// end M;
// endResult
3 changes: 1 addition & 2 deletions flattening/modelica/scodeinst/const15.mo
Expand Up @@ -18,7 +18,6 @@ end C;

// Result:
// class C
// constant Integer B.i = 4;
// Real x = /*Real*/(B.i);
// Real x = /*Real*/(4);
// end C;
// endResult
4 changes: 1 addition & 3 deletions flattening/modelica/scodeinst/const16.mo
Expand Up @@ -24,8 +24,6 @@ end M;

// Result:
// class M
// constant Integer P.P.j = 2;
// constant Integer P.P.P.i = P.P.j;
// Real x = /*Real*/(P.P.P.i);
// Real x = /*Real*/(2);
// end M;
// endResult
4 changes: 1 addition & 3 deletions flattening/modelica/scodeinst/const17.mo
Expand Up @@ -23,8 +23,6 @@ end M;

// Result:
// class M
// constant Integer A.B.i = A.B.A.B.c;
// constant Integer A.B.A.B.c = 2;
// Real x = /*Real*/(A.B.i);
// Real x = /*Real*/(2);
// end M;
// endResult
13 changes: 6 additions & 7 deletions flattening/modelica/scodeinst/eq4.mo
Expand Up @@ -25,7 +25,6 @@ end B;

// Result:
// class B
// constant Integer P.n = 3;
// Real a1[1].x;
// parameter Real a1[1].y = 1.0;
// Real a1[2].x;
Expand All @@ -39,17 +38,17 @@ end B;
// Real a2[3].x;
// parameter Real a2[3].y = 4.0;
// equation
// a1[1].x = a1[1].y * /*Real*/(P.n);
// a1[1].x = a1[1].y * /*Real*/(3);
// a1[1].y = a1[1].x;
// a1[2].x = a1[2].y * /*Real*/(P.n);
// a1[2].x = a1[2].y * /*Real*/(3);
// a1[2].y = a1[2].x;
// a1[3].x = a1[3].y * /*Real*/(P.n);
// a1[3].x = a1[3].y * /*Real*/(3);
// a1[3].y = a1[3].x;
// a2[1].x = a2[1].y * /*Real*/(P.n);
// a2[1].x = a2[1].y * /*Real*/(3);
// a2[1].y = a2[1].x;
// a2[2].x = a2[2].y * /*Real*/(P.n);
// a2[2].x = a2[2].y * /*Real*/(3);
// a2[2].y = a2[2].x;
// a2[3].x = a2[3].y * /*Real*/(P.n);
// a2[3].x = a2[3].y * /*Real*/(3);
// a2[3].y = a2[3].x;
// end B;
// endResult
6 changes: 2 additions & 4 deletions flattening/modelica/scodeinst/ih2.mo
Expand Up @@ -25,9 +25,7 @@ end A;

// Result:
// class A
// constant Integer P2.i = 3;
// constant Integer P1.i = 2;
// Integer i1 = P1.i;
// Integer i2 = P2.i;
// Integer i1 = 2;
// Integer i2 = 3;
// end A;
// endResult
6 changes: 2 additions & 4 deletions flattening/modelica/scodeinst/ih3.mo
Expand Up @@ -25,9 +25,7 @@ end A;

// Result:
// class A
// constant Integer P.P2.i = 3;
// constant Integer P.P1.i = 2;
// Integer i1 = P.P1.i;
// Integer i2 = P.P2.i;
// Integer i1 = 2;
// Integer i2 = 3;
// end A;
// endResult
4 changes: 1 addition & 3 deletions flattening/modelica/scodeinst/redeclare7.mo
Expand Up @@ -3,7 +3,6 @@
// status: correct
// cflags: -d=newInst
//
// FAILREASON: ??
//


Expand All @@ -26,7 +25,6 @@ end D;

// Result:
// class D
// constant Real b.P.x = 2;
// Real b.z = b.P.x;
// Real b.z = 2.0;
// end D;
// endResult

0 comments on commit b674956

Please sign in to comment.