Compartilhar via


PointShootConstruct

This machine behavior construct relates to comprehensive data testing. It aims at overcoming state explosion in exploration produced by the accumulated branching due to the successive expansion of parameter combinations.

Syntax Definition

PointShootConstruct ::= construct point shoot
where Shoot = String
[, PathDepth = Number ]
[, Complete = true | false ]
[, Completer = String ]
[with EmbeddedCode ]
for Behavior .

Remarks

For an underlying behavior (the Point machine), an exploration is performed. Whenever a state is reached that meets the shoot condition, a different machine (the Shoot machine) is used to continue exploration from this state (as in sequential composition). Typically, the latter is the result of combining two other constructs: bounded exploration and accept completion.

The Bounded Exploration machine is only explored until a bound provided as a construct parameter is hit. This functionality is also provided through configuration switches, thus affecting all machines using that configuration. This is a way to make a bound local to a specified behavior.

The result of a bounded exploration is likely to have many end states that are not accepting, because the bound is typically hit before reaching an end state. So another construct is provided to build an Accept Completion machine by sequentially composing, at each bound-hit state, a path to an accepting state. Another machine must be provided for the completion.

These two constructs are typically applied in composition to a behavior that involves a large number of parameter combinations.

This construct has the following switches to apply the last two constructs to the Shoot machine as part of the composition, although this is not strictly necessary:

  • PathDepth causes bounded exploration to be applied to the Shoot machine in the Shoot phase. Its default is 0, which means no bound, and hence no bound exploration composition.

  • Complete causes completion to be applied to the Shoot machine in the Shoot phase. Its default is FALSE, which means no completion, and hence no accept completion composition.

  • Completer specifies the completion machine. Its default is the machine used in the Shoot switch.

    • If this switch is specified and Complete is not, Complete is assumed.

    • Complete cannot be set to FALSE when this switch is specified.

    • If Complete is set to TRUE and no Completer is specified, the default Completer is used (the Shoot machine without any bound specified).

Example

The following Cord code shows two variations of using the PointShootConstruct. This code is extracted from the stand-alone Sailboat sample (see Finding the Code Samples).

machine PointAndShoot() : MovementActions 
{
    construct point shoot 
        where Shoot = "BoundedShoot" 
        with (. Sailboat.Model.SailboatModel.AwayFromTheShore .)
        for Point
}
machine PointAndShoot2() : MovementActions 
{
    construct point shoot 
        where PathDepth = 2, Shoot = "Shoot", Completer = "ShootCompleter" 
        with (. SailboatModel.AwayFromTheShore .)
        for Point
}

Machine PointAndShoot is based on configuration MovementActions and uses the PointShootConstruct to construct its machine behavior using the Shoot switch. Machine PointAndShoot2 is based on configuration MovementActions and uses the PointShootConstruct to construct its machine behavior using the Shoot and the Completer switches.

See Also

Reference

ConstructBehavior
Machine

Concepts

Cord Syntax Definition
Point and Shoot