Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / json / SemanticCheck.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 ******************************************************************************/
8module SemanticCheck {
9
10// Recursive type checks (type Inner doesn't have JSON encoding explicitly,
11// but it can be encoded as part of Outer1)
12type union Inner {
13 integer num,
14 charstring str
15}
16
17type record Outer1 {
18 octetstring bytes,
19 Inner rec
20} with {
21 encode "JSON";
22}
23
24external function f_enc1(in Outer1 x) return octetstring
25 with { extension "prototype(convert) encode(JSON)" }
26
27// Same thing, but Outer2 only has a JSON variant attribute to specify the encoding (no 'encode' attribute)
28type record Outer2 {
29 octetstring bytes,
30 Inner rec
31} with {
32 variant(rec) "JSON : name as stuff";
33}
34
35external function f_enc2(in Outer2 x) return octetstring
36 with { extension "prototype(convert) encode(JSON)" }
37
38// Embedded union with the "as value" attribute
39type record HasUnion
40{
41 charstring str,
42 EmbeddedUnion val
43}
44with {
45 encode "JSON";
46}
47
48
49
50type union EmbeddedUnion
51{
52 integer num,
53 octetstring bytes
54}
55with {
56 variant "JSON: as value";
57}
58
59}
This page took 0.048499 seconds and 5 git commands to generate.