conformance_test/positive_tests added
[deliverable/titan.core.git] / conformance_test / positive_tests / 20_statement_and_operations_for_alt / 2005_default_handling / 200501_the_default_mechanism / Sem_200501_the_default_mechanism_004.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2016 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 v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * Adrien Kirjak – initial implementation
10 *
11 ** @version 0.0.1
12 ** @purpose 1:20.5.1, verify that default processing order is correct
13 ** @verdict pass accept, ttcn3verdict:pass
14 ***************************************************/
15
16 // The following requirement is tested:
17 // For each test component the defaults, i.e. activated altsteps, are stored as an ordered
18 // list. The defaults are listed in the reversed order of their activation i.e. the last
19 // activated default is the first element in the list of active defaults.
20
21 // The default mechanism is evoked at the end of each alt statement, if due to the
22 // actual snapshot none of the specified alternatives could be executed. An evoked
23 // default mechanism invokes the first altstep in the list of defaults, i.e. the last
24 // activated default, and waits for the result of its termination. The termination can
25 // be successful or unsuccessful.
26
27 // In the case of a successful termination, the default ... the main control flow of the
28 // test component will continue immediately after the alt statement from which the default
29 // mechanism was called...
30
31 // Note:
32 // In this test case, two altsteps are activated as defaults. The sooner activated
33 // default leads to a test case failure, but because the last activated default takes
34 // precedence, it should never happen.
35
36 module Sem_200501_the_default_mechanism_004 {
37
38 type port P message {
39 inout integer;
40 } with {extension "internal"}
41
42 type component GeneralComp {
43 port P p;
44 }
45
46 altstep a1() runs on GeneralComp {
47 [] p.receive(integer:?) {
48 setverdict(fail, "First default");
49 }
50 }
51
52 altstep a2() runs on GeneralComp {
53 [] p.receive(integer:?) {
54 setverdict(pass, "Last default");
55 }
56 }
57
58 testcase TC_Sem_200501_the_default_mechanism_004() runs on GeneralComp {
59 activate(a1());
60 activate(a2());
61
62 connect(self:p, self:p);
63 p.send(integer:5);
64
65 alt {
66 [] p.receive(integer:0) { // not expected: leads to default invocation
67 setverdict(fail);
68 }
69 }
70 }
71
72 control{
73 execute(TC_Sem_200501_the_default_mechanism_004());
74 }
75 }
This page took 0.034047 seconds and 5 git commands to generate.