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

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

Create(); // factory method
Sequence frontier = new Sequence(m.InitialState);
Sequence explored = new Sequence(); // empty
Set transitions = new Set(); // empty
while (!frontier.IsEmpty)
{
State current = frontier.Head; // choose first element of frontier
frontier = frontier.Tail; // all but first element of frontier
explored = explored.AddLast(current); // append current to explored
foreach (Action a in m.GetActions(current))
{
State next = m.GetNextState(current, a);
if (!frontier.Contains(next) && !explored.Contains(next))
{
frontier = frontier.AddLast(next); // append for breadth-first
}
transitions = transitions.Add(Transition(current, a, next));
}
}
Figure 6.7. An exhaustive exploration algorithm.
The exploration algorithm also uses these types, which are defined in the modeling
library (Chapter 10):
Set The unordered collection of elements of type T, with constructors
Set(), Set(x,y,z), and so on, and method Add, where s.Add(x) returns
a new set that contains all the elements of set s and the element x.
Sequence The ordered collection of elements of type T, with properties Head
(the first element), Tail (all but the first element), and methods AddFirst (which
pushes an element on the head) , and AddLast (which appends an element to
end).
Figure 6.7 shows an exhaustive exploration algorithm.


Pages:
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6