SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 201 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"


case("ServerBind"):
s.Bind(host,port);
return null;
Here is a more complex case, where DoAction handles the server??™s Send action.
This code extracts the argument from the action term using the indexer expression
a[0], casts it to double, and passes it to the implementation. The modeling library
provides action arguments through a C# indexer, which accesses elements by subscripts.
(Appendix A.3 explains this and other facilities for working with action
terms.)
case("ServerSend"):
// s.Send sends a double, not a string
s.Send((double) action[0]);
return null;
The most complex cases occur where there is a split action (that has outputs).
The test runner passes DoAction a term that represents the start action. DoAction
invokes the corresponding method in the implementation. When that method returns,
DoAction collects the output, constructs a term that represents the finish action using
Action.Create, and returns the finish action to the test runner. Here is an example,
the case where DoAction handles the client??™s Receive action:
case("ClientReceive_Start"):
// c.Receive returns a double, not a string
return Action.Create("ClientReceive_Finish", c.Receive());
The DoAction code could also read implementation state variables, and include
their values in the term for the finish action. To make use of this information, the
corresponding action method of the model would have to return the values of model
state variables in out parameters.


Pages:
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6