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