Titan



altstep


The keyword is used to specify default behavior or to structure the alternatives of an alt statement. Altsteps are similar to functions but the altstep body defines a set of alternatives (cf. alt). 

Related keywords:


altstep  altstep_identifier ( [ altstep_parameter ... ] )[ runs on component_reference ] {
    
[ local_definitions
    [
[guard_expression] ] [condition] { [statement_block] }
   
...
};
 


Example:

altstep as_AltSet_A(in integer pl_MyPar1) runs on MyComponentType_ct {
   []     L1_PCO.receive { setverdict(pass) } 
   [x<=1] L2_PCO.receive { setverdict(inconc) } 
   [else]                { setverdict(fail); stop } 
};

The altstep called as_AltSet_A is defined. It has a read/only parameter called pl_MyPar1. The definitions made in the component MyComponentType_ct are visible to the altstep. The first branch is activated if a message has been received on port L1_PCO. The verdict is set to pass. The second branch is activated if a message has been received on port L2_PCO and the variable x is not grater then one. In this case the verdict is set to inconclusive. The last branch is activated if none of the ports has received a messages. The verdict is set to fail and test execution is stopped.



BNF definition of altstep