Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / testcase_defparam / tcdefparam.ttcn
CommitLineData
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 ******************************************************************************/
8module tcdefparam {
9
10type component D {
11 var integer dx := 13;
12 var template float fx;
13}
14
15testcase tc_no_par() runs on D
16{
17 setverdict(pass);
18}
19
20testcase tc_one_dp(in integer par1 := 42) runs on D
21{
22 if (par1 == 42) { setverdict(pass); }
23 else { setverdict(fail); }
24}
25
26testcase 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
32modulepar integer x;
33
34testcase 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
42testcase 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
50testcase 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
56testcase 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
61control {
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}
This page took 0.036865 seconds and 5 git commands to generate.