Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

[NF] Add more when tests. #911

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion flattening/modelica/scodeinst/Makefile
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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