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 267 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

You can implement a
transition coverage function as follows. It is useful to map states to their hash
codes here, rather than keeping around full states.
Bag GetTransitionCoverage(IState s, Action a)
{
return new Bag(Term.Create("Cp",
new Literal(s.GetHashCode()),a));
}
Notice that it is not necessary to compute the actual target state of the
transition, because it is uniquely determined by the source state and the action,
and would therefore not affect the coverage.
12.4.2 Action selection
Our custom strategy derives from the basic strategy. It takes a given model program
model and a given coverage function getCoverage.
partial class CustomStrategy : Strategy
{
CoverageFunction GetCoverage;
public CustomStrategy(ModelProgram model,
CoverageFunction getCoverage) : base(model)
{
this.GetCoverage = getCoverage;
}
}
The custom strategy uses a history variable coveragePoints, which also happens
to be a bag, that keeps count of the total number of occurrences of all the coverage
points seen so far. Initially the bag is empty.
partial class CustomStrategy
{
Bag coveragePoints = Bag.EmptyBag;
}
The main purpose of the custom strategy is to provide a particular implementation
of the method SelectAction. The idea is that an action is selected in such a way
that its reward is maximized. The GetReward function is defined below.


Pages:
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6