Skip to content

Commit

Permalink
Add test case for #3358
Browse files Browse the repository at this point in the history
  • Loading branch information
lochel committed Jun 19, 2015
1 parent 823aeb7 commit b58087d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
1 change: 1 addition & 0 deletions simulation/modelica/events/Makefile
Expand Up @@ -6,6 +6,7 @@ bug2718.mos \
bug2752.mos \
bug2808.mos \
bug3092.mos \
bug3358.mos \
ChatteringEventsTest1.mos \
ChatteringEventsTest2.mos \
CheckEvents.mos \
Expand Down
60 changes: 60 additions & 0 deletions simulation/modelica/events/bug3358.mos
@@ -0,0 +1,60 @@
// name: bug3358
// keywords: events
// status: correct

loadString("
package bug3358
model foo3
Real x(fixed=true, start=0.0);
Boolean b1, b2;
algorithm
b1 := time > 0.5;
b2 := time > 0.5;
when b1 then
x := pre(x) + 1;
elsewhen b2 then
x := pre(x) + 0.1;
end when;
end foo3;

model foo3b
Real x(fixed=true, start=0.0);
Boolean b1, b2;
algorithm
b2 := time > 0.5;
b1 := time > 0.5;
when b1 then
x := pre(x) + 1;
elsewhen b2 then
x := pre(x) + 0.1;
end when;
end foo3b;
end bug3358;
"); getErrorString();

simulate(bug3358.foo3); getErrorString();
val(x, 1.0); getErrorString();

simulate(bug3358.foo3b); getErrorString();
val(x, 1.0); getErrorString();

// Result:
// true
// ""
// record SimulationResult
// resultFile = "bug3358.foo3_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'bug3358.foo3', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 1.0
// ""
// record SimulationResult
// resultFile = "bug3358.foo3b_res.mat",
// simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 1e-06, method = 'dassl', fileNamePrefix = 'bug3358.foo3b', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
// messages = ""
// end SimulationResult;
// ""
// 1.0
// ""
// endResult

0 comments on commit b58087d

Please sign in to comment.