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