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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Systems with Finite <strong>Model</strong>s 79<br />

// ... continued<br />

// Client enabling conditions and actions<br />

public static bool ClientSocketEnabled()<br />

{<br />

return (clientSocket == Socket.None);<br />

}<br />

[Action]<br />

public static void ClientSocket()<br />

{<br />

clientSocket = Socket.Created;<br />

}<br />

public static bool ClientConnectEnabled()<br />

{<br />

return (clientSocket == Socket.Created<br />

&& serverSocket == Socket.Listening);<br />

}<br />

[Action]<br />

public static void ClientConnect()<br />

{<br />

clientSocket = Socket.Connecting;<br />

}<br />

public static bool ClientSendEnabled()<br />

{<br />

return (clientSocket == Socket.Connected<br />

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

}<br />

// No parameter needed here, client always sends the same thing<br />

[Action]<br />

public static void ClientSend()<br />

{<br />

phase = Phase.ServerReceive;<br />

}<br />

// continued ....<br />

Figure 5.10. Remote instrument client/server: model program (part 4).<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!