Opened 11 years ago

Closed 11 years ago

#2237 closed defect (fixed)

Assertions checked at the wrong place

Reported by: Martin Sjölund Owned by: Willi Braun
Priority: high Milestone: 1.9.0
Component: Run-time Version: trunk
Keywords: Cc: Willi Braun, Lennart Ochel

Description

From the compliance suite:

within ModelicaCompliance.Algorithms.Assignment;

model AssignmentOrder
  extends Icons.TestCase;

  Real x;
algorithm
  x := 3.0;
  assert(Util.compareReal(x, 3.0), "x was not set correctly, "+String(x)+" <> 3.0.");
  x := 4.0;
  assert(Util.compareReal(x, 4.0), "x was not set correctly, "+String(x)+" <> 4.0.");
  x := 5.0;

  annotation (
    __ModelicaAssociation(TestCase(shouldPass = true)),
    experiment(StopTime = 0.01),
    Documentation(
    info = "<html>Tests that assignments in an algorithm section are performed
      in the given order.</html>"));
end AssignmentOrder;

We get:

Message : x was not set correctly, 5 <> 3.0.

Change History (3)

comment:1 by Lennart Ochel, 11 years ago

Owner: changed from somebody to Willi Braun
Status: newassigned

I guess this a known issue. We talked already several times about that. The current implementation collect all assertions and check them at the end of a step (all together). This is of course wrong.
I guess Willi has at least some experiences with this implementation (maybe it is actually his implementation?).

comment:2 by Willi Braun, 11 years ago

Status: assignedaccepted

That's also the reason why some of the msl32.Modelica.Fluid.* models don't simulate correct.

comment:3 by Willi Braun, 11 years ago

Resolution: fixed
Status: acceptedclosed

fixed in r16387.

Note: See TracTickets for help on using tickets.