Skip to content

Commit

Permalink
[NF] Added extends tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Mar 26, 2018
1 parent 489a0c5 commit 21bec3c
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/ExtendsShort1.mo
@@ -0,0 +1,25 @@
// name: ExtendsShort1
// keywords:
// status: correct
// cflags: -d=newInst
//
//

package P
constant Integer n = 2;

model M
Integer x = n;
end M;
end P;

model ExtendsShort1
model M = P.M;
M m;
end ExtendsShort1;

// Result:
// class ExtendsShort1
// Integer m.x = 2;
// end ExtendsShort1;
// endResult
43 changes: 43 additions & 0 deletions flattening/modelica/scodeinst/ExtendsShort2.mo
@@ -0,0 +1,43 @@
// name: ExtendsShort2
// keywords:
// status: correct
// cflags: -d=newInst
//
//

package P
function f
input Real x;
output Real y;
algorithm
y := f2(x);
end f;

function f2
input Real x;
output Real y = x * 2;
end f2;
end P;

model ExtendsShort2
function f = P.f;
Real x = f(2.0);
end ExtendsShort2;

// Result:
// function P.f2
// input Real x;
// output Real y = x * 2.0;
// end P.f2;
//
// function f
// input Real x;
// output Real y;
// algorithm
// y := P.f2(x);
// end f;
//
// class ExtendsShort2
// Real x = f(2.0);
// end ExtendsShort2;
// endResult
2 changes: 2 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -242,6 +242,8 @@ ExtendSections.mo \
ExtendSelf1.mo \
ExtendSelf2.mo \
ExtendSelf3.mo \
ExtendsShort1.mo \
ExtendsShort2.mo \
ExtendsVisibility1.mo \
ExtendsVisibility2.mo \
ExtendsVisibility3.mo \
Expand Down

0 comments on commit 21bec3c

Please sign in to comment.