Debian Codegraph @

help/info/alt.html

raw symbols SCIP
1 <!--
2 Copyright (c) 2000-2021 Ericsson Telecom AB
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Eclipse Public License v2.0
5 which accompanies this distribution, and is available at
6 https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html
7
8 Contributors:
9 Baji, Laszlo
10 Balasko, Jeno
11 Farkas, Laszlo
12 Szabados, Kristof
13 Szabo, Janos Zoltan – initial implementation
14 -->
15 <html>
16 <head>
17 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
18 <meta http-equiv="Content-Language" content="en-us">
19 <title>alt</title>
20 </head>
21 <body bgcolor="#DAD3C5" vlink="#0094D2" link="#003258">
22 <table align="left" border="0" cellspacing="0" cellpadding="0" valign=top>
23 <tr>
24 <td width=105 height=40><a href="https://projects.eclipse.org/projects/tools.titan"><img src="../images/titan_transparent.gif" border=0 width=105 height=40 align="left" alt="Titan"></a></td>
25 </tr>
26 </table>
27 <table border="0" align="right" cellpadding="0" cellspacing="0">
28 <tr>
29 <td><a href="../titan_main.html" alt="contents"><img border="0" src="../images/ao.jpg" width="53" height="40"></a></td>
30 <td><a href="../titan_index.html" alt="index"><img border="0" src="../images/up.jpg" width="53" height="40"></a></td>
31 <td><a href="all.html" alt="previous"><img border="0" src="../images/left.jpg" width="53" height="40"></a></td>
32 <td><a href="altstep.html" alt="next"><img border="0" src="../images/right.jpg" width="53" height="40"></a></td>
33 </tr>
34 </table>
35 <p><br clear="all">
36 </p>
37 <hr>
38 <h1>alt</h1>
39 <hr align="left" width="75%">
40 <p>The statement denotes branching of test behavior due to the reception and handling of communication and/or timer events and/or the termination of parallel test components. The individual
41 alternatives (or branches) begin with a Boolean guard enabling or disabling the alternative (default is true), continue with an event or “receiving operation�, which can be successful or unsuccessful
42 (&quot;condition&quot;) and end by an optional statement block.
43 <ul>
44 <li>When entering an alt statement, a snapshot is taken. A new snapshot is triggered by the statement <b><font face="Courier New" color="#003258" size="4">repeat</font></b>.</li>
45 <li>It is possible to enable/disable an alternative by means of a Boolean expression placed between the brackets of the alternative.</li>
46 <li>The last branch in an alt statement can be defined as an else branch by including the else keyword between the brackets of the alternative.</li>
47 <li>alt statements may be nested.</li>
48 </ul>
49 <p>Related keywords:</p>
50 <ul>
51 <li><a href="repeat.html"><b><font face="Courier New" color="#003258" size="4">repeat</font></b></a></li>
52 <li><a href="else.html"><b><font face="Courier New" color="#003258" size="4">else</font></b></a></li>
53 </ul>
54 <hr align="left" width="50%">
55 <div align="center">
56 <table border="0" width="90%" bgcolor="#FFB599" cellpadding="4">
57 <tr>
58 <td width="100%">
59 <h3 align="left"><font face="Courier New" color="#003258" size="5"><b>alt {<br>
60 &nbsp;&nbsp;&nbsp; [</b></font> [<i>guard_expression</i>] <font face="Courier New" color="#003258" size="5"><b>]</b></font> [<i>condition</i>] <font face="Courier New" color="#003258" size="5"><b>{</b></font>
61 [<i>statement_block</i>] <font face="Courier New" color="#003258" size="5"><b>}<br>
62 &nbsp;&nbsp;&nbsp; </b></font> ...<font face="Courier New" color="#003258" size="5"><b><br>
63 };</b></font> &nbsp;</h3>
64 </td>
65 </tr>
66 </table>
67 </div>
68 <ul>
69 <li>
70 <p>The <font face="Courier New" color="#003258" size="4"><b>alt</b></font> keyword introduces the branching definition.</p>
71 </li>
72 <li>
73 <p>Each alternative begins with an optional <i>guard_expression</i> with the following options:</p>
74 <ul>
75 <li>empty guard (note that the brackets must be written) The <i>statement_block</i> will be executed if <i>condition</i> is met.&nbsp;</li>
76 <li>Boolean expression. The <i>statement_block</i> will be executed if the Boolean expression evaluates to true AND <i>condition</i> is met.</li>
77 <li>
78 <p><font face="Courier New" color="#003258" size="4"><b>else</b></font> keyword. The <i>statement_block</i> will always be executed.&nbsp; No <i>condition</i> may appear in the branch.</p>
79 </li>
80 </ul>
81 </li>
82 <li>
83 <p><i>condition</i> may be a communication or a timer event or the termination of a parallel test component. The following operations may be written here: <a href="receive.html"><b><font
84 face="Courier New" color="#003258" size="4">receive</font></b></a>, <a href="trigger.html"><b><font face="Courier New" color="#003258" size="4">trigger</font></b></a>, <a href="getcall.html"><b><font
85 face="Courier New" color="#003258" size="4">getcall</font></b></a>, <a href="getreply.html"><b><font face="Courier New" color="#003258" size="4">getreply</font></b></a>, <a href="catch.html"><b><font
86 face="Courier New" color="#003258" size="4">catch</font></b></a>, <a href="check.html"><b><font face="Courier New" color="#003258" size="4">check</font></b></a>, <a href="timeout.html"><b><font
87 face="Courier New" color="#003258" size="4">timeout</font></b></a> and <a href="done.html"><b><font face="Courier New" color="#003258" size="4">done</font></b></a>.</p>
88 </li>
89 <li>
90 <p>The optional <i>statement_block</i> contains one or more statements separated by semicolons. When empty, the curly brackets must be written.</p>
91 </li>
92 <li>
93 <p><b>...</b> indicates that&nbsp; several branches may occur in the <font face="Courier New" color="#003258" size="4"><b>alt</b></font> body. There is no separator between them.</p>
94 </li>
95 </ul>
96 <hr align="left" width="50%">
97 <p>Example:
98 <p><font face="Courier New">alt {&nbsp;<br>
99 &nbsp;&nbsp;&nbsp;[]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;L1_PCO.receive { setverdict(pass) }&nbsp;<br>
100 &nbsp;&nbsp;&nbsp;[x&lt;=1] L2_PCO.receive { setverdict(inconc) }&nbsp;<br>
101 &nbsp;&nbsp;&nbsp;[else]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ setverdict(fail); stop }&nbsp;<br>
102 };</font>
103 <p>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
104 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
105 execution is stopped.</p>
106 <hr align="left" width="25%">
107 <hr align="left" width="25%">
108 <p><a HREF="BNF.html#altconstruct">BNF definition</a> of <font face="Courier New"> alt</font></p>
109 </body>
110 </html>