Commit | Line | Data |
---|---|---|
970ed795 EL |
1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2014 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 | module tcname_SW { //^In TTCN-3 module `tcname_SW':// | |
9 | ||
10 | type component PDTestComponent {}; | |
11 | ||
12 | /* Tests for testcasename() function. */ | |
13 | ||
14 | function testcasename_in_func() return charstring { | |
15 | return testcasename() | |
16 | } | |
17 | ||
18 | function testcasename_in_func_runson() runs on PDTestComponent return charstring { | |
19 | return testcasename() | |
20 | } | |
21 | ||
22 | testcase testcasename_in_tc() runs on PDTestComponent { //In testcase definition// | |
23 | if ("testcasename_in_tc" == testcasename_in_func()) | |
24 | { setverdict(pass) } | |
25 | else { setverdict(fail) } | |
26 | // For simple cases these should be the same. | |
27 | if (%testcaseId == testcasename_in_func()) | |
28 | { setverdict(pass) } | |
29 | else { setverdict(fail) } | |
30 | if (%testcaseId == testcasename_in_func_runson()) | |
31 | { setverdict(pass) } | |
32 | else { setverdict(fail) } | |
33 | if (testcasename() == "testcasename_in_tc") | |
34 | { setverdict(pass) } | |
35 | else { setverdict(fail) } //^In else statement// \ | |
36 | //^warning\: Control never reaches this code because of previous effective condition\(s\)// | |
37 | } | |
38 | ||
39 | // Empty string from the control part. | |
40 | testcase testcasename_from_control(in charstring p) runs on PDTestComponent { | |
41 | if (p == "") { setverdict(pass) } else { setverdict(fail) } | |
42 | } | |
43 | ||
44 | control { | |
45 | execute(testcasename_in_tc()); | |
46 | execute(testcasename_from_control(testcasename())); | |
47 | // Call again outside testcase, but not directly from the control part. | |
48 | execute(testcasename_from_control(testcasename_in_func())); | |
49 | } | |
50 | ||
51 | ||
52 | } |