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 tcdefparam { | |
9 | ||
10 | type component D { | |
11 | var integer dx := 13; | |
12 | var template float fx; | |
13 | } | |
14 | ||
15 | testcase tc_no_par() runs on D | |
16 | { | |
17 | setverdict(pass); | |
18 | } | |
19 | ||
20 | testcase tc_one_dp(in integer par1 := 42) runs on D | |
21 | { | |
22 | if (par1 == 42) { setverdict(pass); } | |
23 | else { setverdict(fail); } | |
24 | } | |
25 | ||
26 | testcase tc_two_dps(in charstring s := "Stan", in charstring o := "Ollie") runs on D | |
27 | { | |
28 | if (s == "Stan" and o == "Ollie") { setverdict(pass); } | |
29 | else { setverdict(fail, "here's another nice mess you've gotten me into!"); } | |
30 | } | |
31 | ||
32 | modulepar integer x; | |
33 | ||
34 | testcase tc_outpar(out integer o := dx) runs on D | |
35 | { | |
36 | if (o == 13) { setverdict(pass); } | |
37 | else { setverdict(fail, match(o,13)); } | |
38 | ||
39 | o := 17; | |
40 | } | |
41 | ||
42 | testcase tc_inoutpar(inout integer io := dx) runs on D | |
43 | { | |
44 | if (io == 13) { setverdict(pass); } | |
45 | else { setverdict(fail, match(io, 13)); } | |
46 | ||
47 | io := 18; | |
48 | } | |
49 | ||
50 | testcase tc_one_template_dp(in template charstring foobar := charstring : ("foo", "bar", "baz")) runs on D | |
51 | { | |
52 | if (match("baz", foobar)) { setverdict(pass); } | |
53 | else { setverdict(fail, match("baz", foobar)); } | |
54 | } | |
55 | ||
56 | testcase tc_out_template_dp(out template float fd := fx) runs on D { | |
57 | if (isbound(fd)) { setverdict(fail, "inbound out parameter should be unbound"); } | |
58 | else { setverdict(pass); } | |
59 | } | |
60 | ||
61 | control { | |
62 | // This control part is not supposed to be run. The following call | |
63 | // intentionally causes a fail verdict. | |
64 | execute(tc_one_dp(13)); | |
65 | ||
66 | // These calls are here to see the generated code | |
67 | execute(tc_out_template_dp()); | |
68 | execute(tc_outpar()); | |
69 | execute(tc_inoutpar()); | |
70 | ||
71 | execute(tc_one_template_dp()); | |
72 | execute(tc_one_template_dp(-)); | |
73 | execute(tc_one_template_dp("baz")); | |
74 | execute(tc_one_template_dp(?)); | |
75 | ||
76 | execute(tc_one_dp()); | |
77 | execute(tc_one_dp(-)); | |
78 | execute(tc_one_dp(42)); | |
79 | ||
80 | execute(tc_two_dps()); | |
81 | execute(tc_two_dps(-)); | |
82 | execute(tc_two_dps(-, -)); | |
83 | execute(tc_two_dps("Stan")); | |
84 | execute(tc_two_dps(-, "Ollie")); | |
85 | execute(tc_two_dps(-)); | |
86 | execute(tc_two_dps("Stan", "Ollie")); | |
87 | } | |
88 | ||
89 | } |