Commit | Line | Data |
---|---|---|
970ed795 | 1 | /****************************************************************************** |
3abe9331 | 2 | * Copyright (c) 2000-2015 Ericsson Telecom AB |
970ed795 EL |
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 | module TcontrolTimer { | |
9 | ||
10 | type component CT {} | |
11 | ||
12 | testcase tc_delay(float delay) runs on CT | |
13 | { | |
14 | timer T := delay; | |
15 | all timer.stop; | |
16 | T.start; | |
17 | T.timeout; | |
18 | setverdict(pass); | |
19 | } | |
20 | ||
21 | testcase SetVerdict(verdicttype v) runs on CT | |
22 | { | |
23 | setverdict(v); | |
24 | } | |
25 | ||
26 | function f() | |
27 | { | |
28 | timer T := 0.4; | |
29 | T.start; | |
30 | execute(tc_delay(0.1)); | |
31 | alt { | |
32 | [] T.timeout { execute(SetVerdict(fail)); } | |
33 | [] any timer.timeout { execute(SetVerdict(pass)); } | |
34 | } | |
35 | } | |
36 | ||
37 | control { | |
38 | timer T1 := 0.3, T2 := 0.4; | |
39 | T1.start; | |
40 | execute(tc_delay(0.1)); | |
41 | T2.start; | |
42 | alt { | |
43 | [] T1.timeout { execute(SetVerdict(pass)); } | |
44 | [] T2.timeout { execute(SetVerdict(fail)); } | |
45 | } | |
46 | all timer.stop; | |
47 | T1.start; | |
48 | execute(tc_delay(0.1), 0.2); | |
49 | T2.start; | |
50 | alt { | |
51 | [] T1.timeout { execute(SetVerdict(pass)); } | |
52 | [] T2.timeout { execute(SetVerdict(fail)); } | |
53 | } | |
54 | all timer.stop; | |
55 | T1.start; | |
56 | f(); | |
57 | } | |
58 | ||
59 | } |