16.5.1 Wait and time-out actions
When the conformance tester is executed in the asynchronous mode, it uses two
auxiliary actions. The wait action is an internal action that is used when there are no
Advanced Topics 269
TestResult RunTest(int k)
{
Sequence
trace = Sequence.EmptySequence;
Action o = null;
while (trace.Count < steps ||
(!strategy.IsInAcceptingState && trace.Count < maxSteps))
{
if (isAsync && o == null && !obs.IsEmpty) o = obs.Dequeue();
if (o != null)
{
trace = trace.AddLast(o);
string reason = "";
if (strategy.IsActionEnabled(o, out reason))
{ strategy.DoAction(o); o = null; }
else return new TestResult(k,Verdict.Failure,reason,trace);
}
else
{
Action a = strategy.SelectAction(testerActionSymbols);
if (a == null)
{
if (isAsync)
{
Action w = strategy.SelectAction(new Set(waitAction));
int obsTimeout = (w == null ? 0 : (int)w[0]);
if (w != null){ trace = trace.Add(w); strategy.DoAction(w);}
if (!obs.TryDequeue(obsTimeout, out o))
if (strategy.IsInAcceptingState)
return new TestResult(k,Verdict.Success,"",trace);
else
else o = timeoutAction;
}
else
{
if (strategy.IsInAcceptingState)
return new TestResult(k,Verdict.Success,"",trace);
else
return new TestResult(k, Verdict.Failure,
"Did not finish in accepting state", trace);
}}
else
{
strategy.DoAction(a);
trace = trace.AddLast(a);
if (!internalActionSymbols.
Pages:
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354