Skip to content

Commit

Permalink
[NF] Add if-equation branch selection tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
perost authored and OpenModelica-Hudson committed Oct 18, 2018
1 parent 4654c86 commit 54b3544
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
23 changes: 23 additions & 0 deletions flattening/modelica/scodeinst/IfEquationEval1.mo
@@ -0,0 +1,23 @@
// name: IfEquationEval1
// keywords:
// status: correct
// cflags: -d=newInst
//

model IfEquationEval1
Real x;
equation
if true then
x = 1;
else
x = 2;
end if;
end IfEquationEval1;

// Result:
// class IfEquationEval1
// Real x;
// equation
// x = 1.0;
// end IfEquationEval1;
// endResult
25 changes: 25 additions & 0 deletions flattening/modelica/scodeinst/IfEquationEval2.mo
@@ -0,0 +1,25 @@
// name: IfEquationEval2
// keywords:
// status: correct
// cflags: -d=newInst
//

model IfEquationEval2
Real x;
equation
if false then
x = 0;
elseif true then
x = 1;
else
x = 2;
end if;
end IfEquationEval2;

// Result:
// class IfEquationEval2
// Real x;
// equation
// x = 1.0;
// end IfEquationEval2;
// endResult
29 changes: 29 additions & 0 deletions flattening/modelica/scodeinst/IfEquationEval3.mo
@@ -0,0 +1,29 @@
// name: IfEquationEval3
// keywords:
// status: correct
// cflags: -d=newInst
//

model IfEquationEval3
Real x;
equation
if time < 1 then
x = 0;
elseif true then
x = 1;
else
x = 2;
end if;
end IfEquationEval3;

// Result:
// class IfEquationEval3
// Real x;
// equation
// if time < 1.0 then
// x = 0.0;
// else
// x = 1.0;
// end if;
// end IfEquationEval3;
// endResult
3 changes: 3 additions & 0 deletions flattening/modelica/scodeinst/Makefile
Expand Up @@ -493,6 +493,9 @@ IfEquation3.mo \
IfEquation4.mo \
IfEquation5.mo \
IfEquation6.mo \
IfEquationEval1.mo \
IfEquationEval2.mo \
IfEquationEval3.mo \
IfExpression1.mo \
IfExpression2.mo \
IfExpression3.mo \
Expand Down

0 comments on commit 54b3544

Please sign in to comment.