1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 ******************************************************************************/
10 TTCN-3 equivalents of the examples in Annex C
17 type record Employee {
20 record of salary salaries
23 variant "name as uncapitalized";
24 variant (id) "attribute";
25 variant (salaries) "list"
29 //---------- C.3.1 USE-UNION
30 type union Int_or_boolean_u {
36 variant (boolean_) "name as 'boolean'"
39 //---------- C.3.2 USE-TYPE
40 type union Int_or_boolean_t {
47 variant (boolean_) "name as 'boolean'"
48 //variant (boolean_) "namespace as 'foo:bar:baz' prefix 'foobar'"
51 //---------- C.3.3 USENUMBER, LIST
52 type enumerated PrimesUnder30 { int2(2), int3(3), int5(5), int7(7), int11(11),
53 int13(13), int17(17), int19(19), int23(23), int29(29) }
59 type record of PrimesUnder30 InputValues with {
63 // record-of with LIST
64 type record of PrimesUnder30 InputValuesList with {
71 // record which relies on its record-of member having LIST
72 type record PrimeProducts {
73 InputValuesList input,
77 variant (input) "attribute"; // it is not enough that InputValuesList has "attribute"
78 variant (output) "attribute"
79 variant (output) "XSD:decimal"
82 // record which puts LIST on its record-of member
83 type record PrimeProductsLocalList {
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"
94 //---------- C.3.4 DEFAULT-FOR-EMPTY
95 type enumerated Responses { ringing, engaged, number_not_known }
96 with { variant "text 'number_not_known' as 'number-not-known'"}
98 type record CallDetails {
99 charstring number, // NumericString
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
109 // Same as above but defaultForEmpty will be applied later
110 type record CallDetails0 {
111 charstring number, // NumericString
115 variant (number) "attribute"
116 variant (response) "untagged";
117 variant "name as 'CallDetails'"; // same name so we can reuse the test strings
120 type CallDetails0 CallDetails_indirect
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
129 type charstring NoFoo
131 variant "defaultForEmpty as 'foo'"
139 variant "defaultForEmpty as '13'"
144 // embedValues (in EmbedValues.ttcnpp)
147 /* * * * * * * * * * * * * * * * * * */
150 type record nilluser {
152 integer maybe optional
155 variant (title) "attribute"
159 /* * * * * * * * * * * * * * * * * * */
160 // TEXT, from the TTCN standard, 5.2.2
161 type enumerated State { magic(-13), more_magic(17) }
163 variant "name as uncapitalized";
164 variant "text all as capitalized";
165 variant "text 'more_magic' as 'off'"
168 /* * * * * * * * * * * * * * * * * * */
170 type boolean textboolean
171 with { variant "text" }
173 /* * * * * * * * * * * * * * * * * * */
174 // Nillable (nested USE-NIL)
176 type record Nillable {
178 record { charstring content optional } forename
183 variant (content.forename) "useNil";
189 //variant "controlNamespace 'c\x94ntr\x94l-n\x82mszp\x82sz'" // required by USE-NIL and USE-TYPE
190 variant "controlNamespace 'cns' prefix 'p'"