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
12 ******************************************************************************/
15 TTCN-3 equivalents of the examples in Annex C
22 type record Employee {
25 record of salary salaries
28 variant "name as uncapitalized";
29 variant (id) "attribute";
30 variant (salaries) "list"
34 //---------- C.3.1 USE-UNION
35 type union Int_or_boolean_u {
41 variant (boolean_) "name as 'boolean'"
44 //---------- C.3.2 USE-TYPE
45 type union Int_or_boolean_t {
52 variant (boolean_) "name as 'boolean'"
53 //variant (boolean_) "namespace as 'foo:bar:baz' prefix 'foobar'"
56 //---------- C.3.3 USENUMBER, LIST
57 type enumerated PrimesUnder30 { int2(2), int3(3), int5(5), int7(7), int11(11),
58 int13(13), int17(17), int19(19), int23(23), int29(29) }
64 type record of PrimesUnder30 InputValues with {
68 // record-of with LIST
69 type record of PrimesUnder30 InputValuesList with {
76 // record which relies on its record-of member having LIST
77 type record PrimeProducts {
78 InputValuesList input,
82 variant (input) "attribute"; // it is not enough that InputValuesList has "attribute"
83 variant (output) "attribute"
84 variant (output) "XSD:decimal"
87 // record which puts LIST on its record-of member
88 type record PrimeProductsLocalList {
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"
99 //---------- C.3.4 DEFAULT-FOR-EMPTY
100 type enumerated Responses { ringing, engaged, number_not_known }
101 with { variant "text 'number_not_known' as 'number-not-known'"}
103 type record CallDetails {
104 charstring number, // NumericString
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
114 // Same as above but defaultForEmpty will be applied later
115 type record CallDetails0 {
116 charstring number, // NumericString
120 variant (number) "attribute"
121 variant (response) "untagged";
122 variant "name as 'CallDetails'"; // same name so we can reuse the test strings
125 type CallDetails0 CallDetails_indirect
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
134 type charstring NoFoo
136 variant "defaultForEmpty as 'foo'"
144 variant "defaultForEmpty as '13'"
149 // embedValues (in EmbedValues.ttcnpp)
152 /* * * * * * * * * * * * * * * * * * */
155 type record nilluser {
157 integer maybe optional
160 variant (title) "attribute"
164 /* * * * * * * * * * * * * * * * * * */
165 // TEXT, from the TTCN standard, 5.2.2
166 type enumerated State { magic(-13), more_magic(17) }
168 variant "name as uncapitalized";
169 variant "text all as capitalized";
170 variant "text 'more_magic' as 'off'"
173 /* * * * * * * * * * * * * * * * * * */
175 type boolean textboolean
176 with { variant "text" }
178 /* * * * * * * * * * * * * * * * * * */
179 // Nillable (nested USE-NIL)
181 type record Nillable {
183 record { charstring content optional } forename
188 variant (content.forename) "useNil";
194 //variant "controlNamespace 'c\x94ntr\x94l-n\x82mszp\x82sz'" // required by USE-NIL and USE-TYPE
195 variant "controlNamespace 'cns' prefix 'p'"