27.07.2013 Views

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

2 Why We Need Model-Based Testing

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

90 <strong>Model</strong> Programs<br />

// ... Reactive system model program, continued<br />

// Actions and enabling conditions for environment, added for model<br />

static bool TimeoutEnabled()<br />

{<br />

return (!MessageRequested<br />

&& TimeoutScheduled<br />

&& phase == Phase.WaitForEvent);<br />

}<br />

[Action]<br />

static void Timeout()<br />

{<br />

cevent = ControlEvent.Timeout;<br />

TimeoutScheduled = false;<br />

phase = Phase.HandleEvent;<br />

}<br />

static bool TimeoutMsgLostEnabled()<br />

{<br />

return (MessageRequested<br />

&& TimeoutScheduled<br />

&& phase == Phase.WaitForEvent);<br />

}<br />

[Action]<br />

static void TimeoutMsgLost()<br />

{<br />

cevent = ControlEvent.Timeout;<br />

TimeoutScheduled = false;<br />

phase = Phase.HandleEvent;<br />

MessageRequested = false;<br />

}<br />

// continued ...<br />

Figure 5.16. Reactive system: model program (part 5).<br />

more free ebooks download links at:<br />

http://www.ebook-x.com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!