Last sync 2016.04.01
[deliverable/titan.core.git] / function_test / Semantic_Analyser / defpars / bende_t_SE.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 * Balasko, Jeno
10 * Raduly, Csaba
11 *
12 ******************************************************************************/
13 module bende_t_SE { //^In TTCN-3 module//
14
15 type record Cause
16 {
17 octetstring causeValue,
18 bitstring cS
19 }
20
21 type record PrivateExtension
22 {}
23
24 type set DownlinkDataNotificationFailureIndication
25 {
26 Cause cause,
27 PrivateExtension privateExtension optional
28 };
29
30
31 type union GTPCv2_PDUs
32 {
33 DownlinkDataNotificationFailureIndication downlinkDataNotificationFailureIndication
34 }
35
36 const bitstring zerobit := '0'B;
37
38 // GTPCv2_IE_Templates.ttcn:122
39 template Cause t_GTPCv2_IE_cause (
40 template bitstring pl_cS := // specific value, which is either:
41 '0'B, // V_BSTR
42 template octetstring pl_causeValue := omit
43 ) :=
44 {
45 causeValue := pl_causeValue,
46 cS := pl_cS
47 // The presence of this _parameterized_ template alone is not enough for fatal error.
48 // It has to be the default value of a parameter (template or function).
49 }
50
51 const octetstring cg_GTPv2_CV_UENotResponding := '57'O
52
53 // The original kaboom
54 template GTPCv2_PDUs t_GTPCv2_DataDownlinkNotificationFailureIndication(
55 template Cause pl_Cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding)
56 ) :=
57 {
58 downlinkDataNotificationFailureIndication :=
59 {
60 cause := pl_Cause,
61 privateExtension := omit
62 }
63 } /* template t_GTPCv2_DataDownlinkNotificationFailureIndication */
64
65 // Parameterized template as default value => kaboom!
66 //function f(in template Cause p_cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding)) runs on C
67 //{}
68
69 type component C {
70 var octetstring m_os;
71 var bitstring m_bs;
72 var template Cause mt_cause := {};
73 }
74
75 // correctly flagged as error:
76 // "default value cannot refer to a field of the component in the `runs on' clause"
77 function f2( //^In function definition// //^In formal parameter list:$//
78 in template Cause p_cause := mt_cause //^In parameter `p_cause':$// //^In default value:// \
79 //^error\: default value cannot refer to a field of the component in the \`runs on\' clause$//
80 ) runs on C
81 {}
82
83
84 testcase tc1() runs on C
85 {
86 // no problems here
87 var template Cause vt_cause := t_GTPCv2_IE_cause(pl_causeValue := cg_GTPv2_CV_UENotResponding);
88 }
89
90 }
This page took 0.052229 seconds and 5 git commands to generate.