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 29, 2017
1 parent 2be51e2 commit 4e49f31
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
43 changes: 37 additions & 6 deletions flattening/modelica/scodeinst/PackageConstant1.mo
Expand Up @@ -5,15 +5,46 @@
//

package P
constant Real x = 1.0;
constant Real x1 = 1.0;
constant Real x2 = 2.0;
constant Real x3 = 3.0;
constant Real x4 = 4.0;
constant Real x5 = 5.0;
constant Real x6 = 6.0;
end P;

model PackageConstant1
Real y = P.x;
end PackageConstant1;
function f
input Real x = P.x5;
output Real y;
algorithm
y := x * P.x6;
end f;

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

// Result:
// class PackageConstant1
// function f
// input Real x = 5.0;
// output Real y;
// algorithm
// y := x * 6.0;
// end f;
//
// class PackageConstant2
// Real y = 1.0;
// end PackageConstant1;
// Real z;
// equation
// z = 2.0;
// algorithm
// z := 3.0;
// f(1.0);
// end PackageConstant2;
// endResult
20 changes: 20 additions & 0 deletions flattening/modelica/scodeinst/PackageConstant2.mo
Expand Up @@ -12,19 +12,38 @@ package P
constant Real x2 = 2.0;
constant Real x3 = 3.0;
constant Real x4 = 4.0;
constant Real x5 = 5.0;
constant Real x6 = 6.0;
end P;

function f
input Real x = P.x5;
output Real y;
algorithm
y := x * P.x6;
end f;

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

// Result:
// function f
// input Real x = P.x5;
// output Real y;
// algorithm
// y := x * P.x6;
// end f;
//
// class PackageConstant2
// constant Real P.x6 = 6.0;
// constant Real P.x5 = 5.0;
// constant Real P.x3 = 3.0;
// constant Real P.x2 = 2.0;
// constant Real P.x1 = 1.0;
Expand All @@ -34,5 +53,6 @@ end PackageConstant2;
// z = P.x2;
// algorithm
// z := P.x3;
// f(1.0);
// end PackageConstant2;
// endResult
2 changes: 1 addition & 1 deletion flattening/modelica/scodeinst/func2.mo
Expand Up @@ -20,7 +20,7 @@ end B;

// Result:
// Error processing file: func2.mo
// [flattening/modelica/scodeinst/func2.mo:12:3-12:15:writable] Error: Type mismatch in binding x = f(), expected subtype of Real, got type ().
// [flattening/modelica/scodeinst/func2.mo:12:3-12:15:writable] Error: Type mismatch in binding x = A.f(), expected subtype of Real, got type ().
//
// # Error encountered! Exiting...
// # Please check the error message and the flags.
Expand Down

0 comments on commit 4e49f31

Please sign in to comment.