Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / XML / TTCNandXML / AnnexB3Template.ttcnpp
1 /******************************************************************************
2 * Copyright (c) 2000-2015 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 ******************************************************************************/
8 module AnnexB3Template {
9 //import from XSD language "XML" all;
10 import from AnnexB3 all;
11
12 modulepar boolean AnnexB3Template_verbose := false;
13 #define verbose AnnexB3Template_verbose
14 #include "../macros.ttcnin"
15
16 type component ice3 {}
17
18 template C1 t_C1:= {
19 a1 :=1, // attribute
20 a2 :=2, // -""-
21 base := "All your base are belong to us!" // untagged
22 }
23
24 template C2 t_C2:= {
25 a1 :=1,
26 a2 :=-2,
27 base :=24
28 }
29
30 template C3 t_C3:= {
31 a1 :=1,
32 a2 :=-1000,
33 base :=25
34 }
35
36
37 DECLARE_EXER_ENCODERS(C1, c1);
38 DECLARE_XER_ENCODERS(C1, c1);
39
40 DECLARE_EXER_ENCODERS(C2, c2);
41 DECLARE_XER_ENCODERS(C2, c2);
42
43 DECLARE_EXER_ENCODERS(C3, c3);
44 DECLARE_XER_ENCODERS(C3, c3);
45
46 const universal charstring c1_str_e := "<C1 A1='1' A2='2'>All your base are belong to us!</C1>\n\n"
47 // Note no namespace because it's a type, not a top-level element
48 const universal charstring c1_str_b :=
49 "<C1>\n" &
50 "\t<a1>1</a1>\n" &
51 "\t<a2>2</a2>\n" &
52 "\t<base>All your base are belong to us!</base>\n" &
53 "</C1>\n\n";
54
55 const universal charstring c2_str_e := "<C2 A1='1' A2='-2'>24</C2>\n\n";
56 // Note no namespace because it's a type, not a top-level element
57 const universal charstring c2_str_b :=
58 "<C2>\n" &
59 "\t<a1>1</a1>\n" &
60 "\t<a2>-2</a2>\n" &
61 "\t<base>24</base>\n" &
62 "</C2>\n\n";
63
64 const universal charstring c3_str_e := "<C3 A1='1' A2='-1000'>25</C3>\n\n";
65 // Note no namespace because it's a type, not a top-level element
66 const universal charstring c3_str_b :=
67 "<C3>\n" &
68 "\t<a1>1</a1>\n" &
69 "\t<a2>-1000</a2>\n" &
70 "\t<base>25</base>\n" &
71 "</C3>\n\n";
72
73
74 testcase enc_untagged() runs on ice3
75 {
76 CHECK_METHOD(bxer_enc_c1, valueof(t_C1), c1_str_b);
77 CHECK_METHOD(exer_enc_c1, valueof(t_C1), c1_str_e);
78
79 CHECK_METHOD(bxer_enc_c2, valueof(t_C2), c2_str_b);
80 CHECK_METHOD(exer_enc_c2, valueof(t_C2), c2_str_e);
81
82 CHECK_METHOD(bxer_enc_c3, valueof(t_C3), c3_str_b);
83 CHECK_METHOD(exer_enc_c3, valueof(t_C3), c3_str_e);
84 }
85
86 testcase dec_untagged() runs on ice3
87 {
88 CHECK_DECODE(bxer_dec_c1, c1_str_b, C1, t_C1);
89 CHECK_DECODE(exer_dec_c1, c1_str_e, C1, t_C1);
90
91 CHECK_DECODE(bxer_dec_c2, c2_str_b, C2, t_C2);
92 CHECK_DECODE(exer_dec_c2, c2_str_e, C2, t_C2);
93
94 CHECK_DECODE(bxer_dec_c3, c3_str_b, C3, t_C3);
95 CHECK_DECODE(exer_dec_c3, c3_str_e, C3, t_C3);
96 }
97
98 control {
99 execute(enc_untagged());
100 execute(dec_untagged());
101 }
102
103 }
104
105 /*
106 <?xml version="1.0" encoding="UTF-8"?>
107 <C1 xmlns="nsA" A1=1 A2=2>-1000</C1>
108 <?xml version="1.0" encoding="UTF-8"?>
109 <C2 xmlns="nsA" A1=1 A2=-2>24</C2>
110 <?xml version="1.0" encoding="UTF-8"?>
111 <C3 xmlns="nsA" A1=1 A2=-1000>25</C3>
112 */
This page took 0.054289 seconds and 5 git commands to generate.