Sync with 5.2.0
[deliverable/titan.core.git] / regression_test / json / Types.ttcn
CommitLineData
970ed795
EL
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 ******************************************************************************/
8module Types {
9
af710487 10import from JsonData all;
11
970ed795
EL
12const integer c_imported_i :=11;
13
14type component MTC {}
15
16type enumerated Days { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
17
18type record R {
19 integer i,
20 charstring cs,
21 boolean b,
22 Days d
23}
24
25type record R2 {
26 R r,
27 float f
28}
29
30type record EmptyRec { }
31
32type union A {
33 R r,
34 integer i,
35 boolean b,
36 float f
37}
38
39type record of universal charstring RoUCS;
40type record of charstring RoCS;
41type record of octetstring RoOS;
42type record of integer RoI;
43
44type record of verdicttype RoV;
45type record of float RoF;
46
47type integer IntArr[3];
48type float FloatArr[3];
49type universal charstring StrArr[4];
50
51type record Date {
52 charstring month,
53 integer day_idx,
54 Days day_name
55}
56
57type record of Date Dates;
58
59type record PhoneNumber {
60 integer country_prefix,
61 integer network_prefix,
62 integer local_number
63} with {
64 variant(country_prefix) "JSON: name as CountryPrefix";
65 variant(network_prefix) "JSON: name as NetworkPrefix";
66 variant(local_number) "JSON : name as LocalNumber"
67}
68
69
70type record Profile0 {
71 charstring name,
72 PhoneNumber phone_no,
73 charstring email_addr optional,
74 Dates meetings optional
75}
76
77type record Profile {
78 charstring name,
79 PhoneNumber phone_no,
80 charstring email_addr optional,
81 Dates meetings optional
82} with {
83 //variant(email_addr) "JSON : omit as null";
84 variant(meetings) "JSON:omit as null";
85 variant(phone_no) "JSON: name as phone";
86 variant(email_addr) "JSON: name as email";
87}
88
89type union CBA {
90 integer i_val,
91 Date date_val,
92 float f_val,
93 charstring cs_val
94} with {
95 variant(date_val) "JSON:name as date";
96 variant(i_val) "JSON:name as int";
97 variant(f_val) "JSON:name as float";
98 variant(cs_val) "JSON:name as string";
99}
100
101type set Product {
102 charstring name,
103 float price optional,
104 hexstring code
105} with {
106 variant(price) "JSON:omit as null"
107}
108
109type union Thing {
110 integer ival,
111 float fval,
112 boolean bval,
113 enumerated { Tiny, Small, Average, Large, Huge } sizeval,
114 bitstring bsval,
115 octetstring osval,
116 union {
117 hexstring hsval,
118 record of charstring rocsval
119 } unival,
120 charstring csval,
121 universal charstring ucsval,
122 Product prodval,
123 record of integer roival,
124 record {
125 charstring name,
126 float price,
127 hexstring productID optional
128 } prod2val
129} with {
130 variant "JSON:as value";
131 variant (prod2val.productID) "JSON:name as code";
132 variant(unival) "JSON:as value";
133}
134
135type record of Thing Stuff;
136
137type record RecDef {
138 integer i,
139 float f,
140 boolean b optional,
141 bitstring bs,
142 hexstring hs,
143 octetstring os,
144 charstring cs,
145 universal charstring ucs,
146 enumerated { Tiny, Small, Medium, Large, Huge } size,
147 verdicttype vt
148} with {
149 variant(cs) "JSON : default(empty)";
150 variant(i) "JSON:default(-19)";
151 variant(f) "JSON:default(1.0e6)";
152 variant(size) "JSON:default(Tiny)";
153 variant(os) "JSON : default(1DE7)";
154 variant(ucs) "JSON:default(üres)";
155 variant(bs) "JSON:default (101)";
156 variant(hs) "JSON:default(DEAD)";
157 variant(vt) "JSON:default(fail)";
158 variant(b) "JSON:default(false)";
159}
160
af710487 161type record HasPardType {
162 ProtocolElem_Field1 pard,
163 boolean buul,
164 Price price
165}
970ed795
EL
166
167} with {
168 encode "JSON";
169}
This page took 0.032413 seconds and 5 git commands to generate.