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