Last sync 2016.04.01
[deliverable/titan.core.git] / regression_test / XML / TTCNandXML / X693amd1.ttcn
CommitLineData
970ed795 1/******************************************************************************
d44e3c4f 2 * Copyright (c) 2000-2016 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
d44e3c4f 7 *
8 * Contributors:
9 * Balasko, Jeno
10 * Raduly, Csaba
11 *
970ed795
EL
12 ******************************************************************************/
13/*
14
15TTCN-3 equivalents of the examples in Annex C
16
17*/
18module X693amd1 {
19
20type integer salary;
21//---------- C.2.2
22type record Employee {
23 integer id,
24 charstring recruited,
25 record of salary salaries
26}
27with {
28 variant "name as uncapitalized";
29 variant (id) "attribute";
30 variant (salaries) "list"
31}
32
33
34//---------- C.3.1 USE-UNION
35type union Int_or_boolean_u {
36 integer int,
37 boolean boolean_
38}
39with {
40 variant "useUnion";
41 variant (boolean_) "name as 'boolean'"
42}
43
44//---------- C.3.2 USE-TYPE
45type union Int_or_boolean_t {
46 integer int,
47 boolean boolean_,
48 charstring text
49}
50with {
51 variant "useType";
52 variant (boolean_) "name as 'boolean'"
53 //variant (boolean_) "namespace as 'foo:bar:baz' prefix 'foobar'"
54}
55
56//---------- C.3.3 USENUMBER, LIST
57type enumerated PrimesUnder30 { int2(2), int3(3), int5(5), int7(7), int11(11),
58 int13(13), int17(17), int19(19), int23(23), int29(29) }
59with {
60 variant "useNumber"
61}
62
63// record-of
64type record of PrimesUnder30 InputValues with {
65 variant "attribute"
66}
67
68// record-of with LIST
69type record of PrimesUnder30 InputValuesList with {
70 variant "attribute"
71 variant "list"
72}
73
74type float REAL;
75
76// record which relies on its record-of member having LIST
77type record PrimeProducts {
78 InputValuesList input,
79 REAL output
80}
81with {
82 variant (input) "attribute"; // it is not enough that InputValuesList has "attribute"
83 variant (output) "attribute"
84 variant (output) "XSD:decimal"
85}
86
87// record which puts LIST on its record-of member
88type record PrimeProductsLocalList {
89 InputValues input,
90 float output
91}
92with {
93 variant (input) "attribute"; // it is not enough that InputValues has "attribute"
94 variant (output) "attribute"
95 variant (output) "XSD:decimal"
96 variant (input) "list"
97}
98
99//---------- C.3.4 DEFAULT-FOR-EMPTY
100type enumerated Responses { ringing, engaged, number_not_known }
101with { variant "text 'number_not_known' as 'number-not-known'"}
102
103type record CallDetails {
104 charstring number, // NumericString
105 Responses response
106}
107with {
108 variant "defaultForEmpty as 'number_not_known'";
109 variant (number) "attribute";
110 variant (response) "untagged"; // Nokalva requires this (correctly, I think)
111 // even though it's not in the example from the ASN.1 standard
112}
113
114// Same as above but defaultForEmpty will be applied later
115type record CallDetails0 {
116 charstring number, // NumericString
117 Responses response
118}
119with {
120 variant (number) "attribute"
121 variant (response) "untagged";
122 variant "name as 'CallDetails'"; // same name so we can reuse the test strings
123}
124
125type CallDetails0 CallDetails_indirect
126with {
127 variant "defaultForEmpty as 'ringing'";
128 variant "name as 'CallDetails'"; // same name so we can reuse the test strings
129 // variant (number) "attribute" not possible here
130}
131
132//------------ D-F-E
133/*
134type charstring NoFoo
135with {
136 variant "defaultForEmpty as 'foo'"
137}
138
139type record NoBar {
140 integer nb
141}
142with {
143 variant "useNil";
144 variant "defaultForEmpty as '13'"
145}
146*/
147
148//---------- C.3.5
149// embedValues (in EmbedValues.ttcnpp)
150//
151
152/* * * * * * * * * * * * * * * * * * */
153// USE-NIL
154
155type record nilluser {
156 charstring title,
157 integer maybe optional
158}
159with {
160 variant (title) "attribute"
161 variant "useNil"
162}
163
164/* * * * * * * * * * * * * * * * * * */
165// TEXT, from the TTCN standard, 5.2.2
166type enumerated State { magic(-13), more_magic(17) }
167with {
168 variant "name as uncapitalized";
169 variant "text all as capitalized";
170 variant "text 'more_magic' as 'off'"
171}
172
173/* * * * * * * * * * * * * * * * * * */
174
175type boolean textboolean
176with { variant "text" }
177
178/* * * * * * * * * * * * * * * * * * */
179// Nillable (nested USE-NIL)
180
181type record Nillable {
182 record {
183 record { charstring content optional } forename
184 } content optional
185}
186with {
187 variant "useNil";
188 variant (content.forename) "useNil";
189}
190
191}
192with {
193encode "XML"
194//variant "controlNamespace 'c\x94ntr\x94l-n\x82mszp\x82sz'" // required by USE-NIL and USE-TYPE
195variant "controlNamespace 'cns' prefix 'p'"
196}
This page took 0.038205 seconds and 5 git commands to generate.