Skip to content

Commit

Permalink
[NF] Add more when tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Apr 3, 2018
1 parent b374bc7 commit 155e22a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
4 changes: 3 additions & 1 deletion flattening/modelica/scodeinst/Makefile
Expand Up @@ -614,7 +614,9 @@ Visibility1.mo \
Visibility2.mo \
Visibility3.mo \
Visibility4.mo \
when1.mo \
When1.mo \
When2.mo \
When3.mo \
WhenInitial1.mo \
WhenNested1.mo \
Wild1.mo \
Expand Down
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/When1.mo
@@ -0,0 +1,23 @@
// name: When1
// keywords:
// status: correct
// cflags: -d=newInst
//

model When1
Real x;
equation
when time > 1 then
reinit(x, 2.0);
end when;
end When1;

// Result:
// class When1
// Real x;
// equation
// when time > 1.0 then
// reinit(x, 2.0);
// end when;
// end When1;
// endResult
27 changes: 27 additions & 0 deletions flattening/modelica/scodeinst/When2.mo
@@ -0,0 +1,27 @@
// name: When2
// keywords:
// status: correct
// cflags: -d=newInst
//

model When2
Real x = 1;
Boolean b[3];
equation
when b then
reinit(x, 2.0);
end when;
end When2;

// Result:
// class When2
// Real x = 1.0;
// Boolean b[1];
// Boolean b[2];
// Boolean b[3];
// equation
// when {b[1], b[2], b[3]} then
// reinit(x, 2.0);
// end when;
// end When2;
// endResult
@@ -1,21 +1,21 @@
// name: when1.mo
// name: When3
// keywords:
// status: correct
// cflags: -d=newInst
//
//

model A
model When3
Real x, y;
Boolean b, b2;
equation
when {b, b2} then
x = y;
end when;
end A;
end When3;

// Result:
// class A
// class When3
// Real x;
// Real y;
// Boolean b;
Expand All @@ -24,5 +24,5 @@ end A;
// when {b, b2} then
// x = y;
// end when;
// end A;
// end When3;
// endResult

0 comments on commit 155e22a

Please sign in to comment.