a38c6d4c |
1 | /****************************************************************************** |
d44e3c4f |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB |
a38c6d4c |
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 | * Baranyi, Botond |
11 | * |
a38c6d4c |
12 | ******************************************************************************/ |
13 | |
14 | // This module tests the compatibility between record-ofs and set-ofs of base |
15 | // element types |
16 | module TrecofCompat { |
17 | |
18 | type component CT_Empty {} |
19 | |
20 | // record of |
21 | type record of integer RoI1; |
22 | type record of integer RoI2; |
23 | |
24 | type record of boolean RoB1; |
25 | type record of boolean RoB2; |
26 | |
27 | type record of float RoF1; |
28 | type record of float RoF2; |
29 | |
30 | type record of bitstring RoBS1; |
31 | type record of bitstring RoBS2; |
32 | |
33 | type record of hexstring RoHS1; |
34 | type record of hexstring RoHS2; |
35 | |
36 | type record of octetstring RoOS1; |
37 | type record of octetstring RoOS2; |
38 | |
39 | type record of charstring RoCS1; |
40 | type record of charstring RoCS2; |
41 | |
42 | type record of universal charstring RoUS1; |
43 | type record of universal charstring RoUS2; |
44 | |
45 | type record of integer RoI1_opt with { extension "optimize:memalloc" }; |
46 | type record of integer RoI2_opt with { extension "optimize:memalloc" }; |
47 | |
48 | testcase tc_record_of_compat() runs on CT_Empty |
49 | { |
50 | var RoI1 v_roi1 := { 1, 2 }; |
51 | var RoI2 v_roi2 := v_roi1; |
52 | if (not match( { 1, 2 }, v_roi2) or v_roi1 != v_roi2) { setverdict(fail, "record of integer incompatibility"); } |
53 | |
54 | var RoB1 v_rob1 := { true, false }; |
55 | var RoB2 v_rob2 := v_rob1; |
56 | if (not match( { true, false }, v_rob2) or v_rob1 != v_rob2) { setverdict(fail, "record of boolean incompatibility"); } |
57 | |
58 | var RoF1 v_rof1 := { 0.4, 9.6 }; |
59 | var RoF2 v_rof2 := v_rof1; |
60 | if (not match( { 0.4, 9.6 }, v_rof2) or v_rof1 != v_rof2) { setverdict(fail, "record of float incompatibility"); } |
61 | |
62 | var RoBS1 v_robs1 := { '1101'B, '10101'B }; |
63 | var RoBS2 v_robs2 := v_robs1; |
64 | if (not match( { '1101'B, '10101'B }, v_robs2) or v_robs1 != v_robs2) { setverdict(fail, "record of bitstring incompatibility"); } |
65 | |
66 | var RoHS1 v_rohs1 := { '1AF74'H, 'D000D'H }; |
67 | var RoHS2 v_rohs2 := v_rohs1; |
68 | if (not match( { '1AF74'H, 'D000D'H }, v_rohs2) or v_rohs1 != v_rohs2) { setverdict(fail, "record of hexstring incompatibility"); } |
69 | |
70 | var RoOS1 v_roos1 := { 'DEAD'O, '1BC5'O }; |
71 | var RoOS2 v_roos2 := v_roos1; |
72 | if (not match( { 'DEAD'O, '1BC5'O }, v_roos2) or v_roos1 != v_roos2) { setverdict(fail, "record of octetstring incompatibility"); } |
73 | |
74 | var RoCS1 v_rocs1 := { "red", "blue" }; |
75 | var RoCS2 v_rocs2 := v_rocs1; |
76 | if (not match( { "red", "blue" }, v_rocs2) or v_rocs1 != v_rocs2) { setverdict(fail, "record of charstring incompatibility"); } |
77 | |
78 | var RoUS1 v_rous1 := { "yellow", "green" }; |
79 | var RoUS2 v_rous2 := v_rous1; |
80 | if (not match( { "yellow", "green" }, v_rous2) or v_rous1 != v_rous2) { setverdict(fail, "record of universal charstring incompatibility"); } |
81 | |
82 | var RoI1_opt v_roi1_opt := { 1, 2 }; |
83 | var RoI2_opt v_roi2_opt := v_roi1_opt; |
84 | if (not match( { 1, 2 }, v_roi2_opt) or v_roi1_opt != v_roi2_opt) { setverdict(fail, "record of integer (optimized) incompatibility"); } |
85 | |
86 | setverdict(pass); |
87 | } |
88 | |
89 | // record of template |
90 | testcase tc_record_of_template_compat() runs on CT_Empty |
91 | { |
92 | var template RoI1 vt_roi1 := { 1, 2 }; |
93 | var template RoI2 vt_roi2 := vt_roi1; |
94 | if (not match( { 1, 2 }, vt_roi2) or not match(valueof(vt_roi1), vt_roi2)) |
95 | { setverdict(fail, "record of integer template incompatibility"); } |
96 | |
97 | var template RoB1 vt_rob1 := { true, false }; |
98 | var template RoB2 vt_rob2 := vt_rob1; |
99 | if (not match( { true, false }, vt_rob2) or not match(valueof(vt_rob1), vt_rob2)) |
100 | { setverdict(fail, "record of boolean template incompatibility"); } |
101 | |
102 | var template RoF1 vt_rof1 := { 0.4, 9.6 }; |
103 | var template RoF2 vt_rof2 := vt_rof1; |
104 | if (not match( { 0.4, 9.6 }, vt_rof2) or not match(valueof(vt_rof1), vt_rof2)) |
105 | { setverdict(fail, "record of float template incompatibility"); } |
106 | |
107 | var template RoBS1 vt_robs1 := { '1101'B, '10101'B }; |
108 | var template RoBS2 vt_robs2 := vt_robs1; |
109 | if (not match( { '1101'B, '10101'B }, vt_robs2) or not match(valueof(vt_robs1), vt_robs2)) |
110 | { setverdict(fail, "record of bitstring template incompatibility"); } |
111 | |
112 | var template RoHS1 vt_rohs1 := { '1AF74'H, 'D000D'H }; |
113 | var template RoHS2 vt_rohs2 := vt_rohs1; |
114 | if (not match( { '1AF74'H, 'D000D'H }, vt_rohs2) or not match(valueof(vt_rohs1), vt_rohs2)) |
115 | { setverdict(fail, "record of hexstring template incompatibility"); } |
116 | |
117 | var template RoOS1 vt_roos1 := { 'DEAD'O, '1BC5'O }; |
118 | var template RoOS2 vt_roos2 := vt_roos1; |
119 | if (not match( { 'DEAD'O, '1BC5'O }, vt_roos2) or not match(valueof(vt_roos1), vt_roos2)) |
120 | { setverdict(fail, "record of octetstring template incompatibility"); } |
121 | |
122 | var template RoCS1 vt_rocs1 := { "red", "blue" }; |
123 | var template RoCS2 vt_rocs2 := vt_rocs1; |
124 | if (not match( { "red", "blue" }, vt_rocs2) or not match(valueof(vt_rocs1), vt_rocs2)) |
125 | { setverdict(fail, "record of charstring template incompatibility"); } |
126 | |
127 | var template RoUS1 vt_rous1 := { "yellow", "green" }; |
128 | var template RoUS2 vt_rous2 := vt_rous1; |
129 | if (not match( { "yellow", "green" }, vt_rous2) or not match(valueof(vt_rous1), vt_rous2)) |
130 | { setverdict(fail, "record of universal charstring template incompatibility"); } |
131 | |
132 | var template RoI1_opt vt_roi1_opt := { 1, 2 }; |
133 | var template RoI2_opt vt_roi2_opt := vt_roi1_opt; |
134 | if (not match( { 1, 2 }, vt_roi2_opt) or not match(valueof(vt_roi1_opt), vt_roi2_opt)) |
135 | { setverdict(fail, "record of integer template (optimized) incompatibility"); } |
136 | |
137 | setverdict(pass); |
138 | } |
139 | |
140 | // set of |
141 | type set of integer SoI1; |
142 | type set of integer SoI2; |
143 | |
144 | type set of boolean SoB1; |
145 | type set of boolean SoB2; |
146 | |
147 | type set of float SoF1; |
148 | type set of float SoF2; |
149 | |
150 | type set of bitstring SoBS1; |
151 | type set of bitstring SoBS2; |
152 | |
153 | type set of hexstring SoHS1; |
154 | type set of hexstring SoHS2; |
155 | |
156 | type set of octetstring SoOS1; |
157 | type set of octetstring SoOS2; |
158 | |
159 | type set of charstring SoCS1; |
160 | type set of charstring SoCS2; |
161 | |
162 | type set of universal charstring SoUS1; |
163 | type set of universal charstring SoUS2; |
164 | |
165 | type set of integer SoI1_opt with { extension "optimize:memalloc" }; |
166 | type set of integer SoI2_opt with { extension "optimize:memalloc" }; |
167 | |
168 | testcase tc_set_of_compat() runs on CT_Empty |
169 | { |
170 | var SoI1 v_soi1 := { 1, 2 }; |
171 | var SoI2 v_soi2 := v_soi1; |
172 | if (not match( { 1, 2 }, v_soi2) or v_soi1 != v_soi2) { setverdict(fail, "set of integer incompatibility"); } |
173 | |
174 | var SoB1 v_sob1 := { true, false }; |
175 | var SoB2 v_sob2 := v_sob1; |
176 | if (not match( { true, false }, v_sob2) or v_sob1 != v_sob2) { setverdict(fail, "set of boolean incompatibility"); } |
177 | |
178 | var SoF1 v_sof1 := { 0.4, 9.6 }; |
179 | var SoF2 v_sof2 := v_sof1; |
180 | if (not match( { 0.4, 9.6 }, v_sof2) or v_sof1 != v_sof2) { setverdict(fail, "set of float incompatibility"); } |
181 | |
182 | var SoBS1 v_sobs1 := { '1101'B, '10101'B }; |
183 | var SoBS2 v_sobs2 := v_sobs1; |
184 | if (not match( { '1101'B, '10101'B }, v_sobs2) or v_sobs1 != v_sobs2) { setverdict(fail, "set of bitstring incompatibility"); } |
185 | |
186 | var SoHS1 v_sohs1 := { '1AF74'H, 'D000D'H }; |
187 | var SoHS2 v_sohs2 := v_sohs1; |
188 | if (not match( { '1AF74'H, 'D000D'H }, v_sohs2) or v_sohs1 != v_sohs2) { setverdict(fail, "set of hexstring incompatibility"); } |
189 | |
190 | var SoOS1 v_soos1 := { 'DEAD'O, '1BC5'O }; |
191 | var SoOS2 v_soos2 := v_soos1; |
192 | if (not match( { 'DEAD'O, '1BC5'O }, v_soos2) or v_soos1 != v_soos2) { setverdict(fail, "set of octetstring incompatibility"); } |
193 | |
194 | var SoCS1 v_socs1 := { "red", "blue" }; |
195 | var SoCS2 v_socs2 := v_socs1; |
196 | if (not match( { "red", "blue" }, v_socs2) or v_socs1 != v_socs2) { setverdict(fail, "set of charstring incompatibility"); } |
197 | |
198 | var SoUS1 v_sous1 := { "yellow", "green" }; |
199 | var SoUS2 v_sous2 := v_sous1; |
200 | if (not match( { "yellow", "green" }, v_sous2) or v_sous1 != v_sous2) { setverdict(fail, "set of universal charstring incompatibility"); } |
201 | |
202 | var SoI1_opt v_soi1_opt := { 1, 2 }; |
203 | var SoI2_opt v_soi2_opt := v_soi1_opt; |
204 | if (not match( { 1, 2 }, v_soi2_opt) or v_soi1_opt != v_soi2_opt) { setverdict(fail, "set of integer (optimized) incompatibility"); } |
205 | |
206 | setverdict(pass); |
207 | } |
208 | |
209 | // set of template |
210 | testcase tc_set_of_template_compat() runs on CT_Empty |
211 | { |
212 | var template SoI1 vt_soi1 := { 1, 2 }; |
213 | var template SoI2 vt_soi2 := vt_soi1; |
214 | if (not match( { 1, 2 }, vt_soi2) or not match(valueof(vt_soi1), vt_soi2)) |
215 | { setverdict(fail, "set of integer template incompatibility"); } |
216 | |
217 | var template SoB1 vt_sob1 := { true, false }; |
218 | var template SoB2 vt_sob2 := vt_sob1; |
219 | if (not match( { true, false }, vt_sob2) or not match(valueof(vt_sob1), vt_sob2)) |
220 | { setverdict(fail, "set of boolean template incompatibility"); } |
221 | |
222 | var template SoF1 vt_sof1 := { 0.4, 9.6 }; |
223 | var template SoF2 vt_sof2 := vt_sof1; |
224 | if (not match( { 0.4, 9.6 }, vt_sof2) or not match(valueof(vt_sof1), vt_sof2)) |
225 | { setverdict(fail, "set of float template incompatibility"); } |
226 | |
227 | var template SoBS1 vt_sobs1 := { '1101'B, '10101'B }; |
228 | var template SoBS2 vt_sobs2 := vt_sobs1; |
229 | if (not match( { '1101'B, '10101'B }, vt_sobs2) or not match(valueof(vt_sobs1), vt_sobs2)) |
230 | { setverdict(fail, "set of bitstring template incompatibility"); } |
231 | |
232 | var template SoHS1 vt_sohs1 := { '1AF74'H, 'D000D'H }; |
233 | var template SoHS2 vt_sohs2 := vt_sohs1; |
234 | if (not match( { '1AF74'H, 'D000D'H }, vt_sohs2) or not match(valueof(vt_sohs1), vt_sohs2)) |
235 | { setverdict(fail, "set of hexstring template incompatibility"); } |
236 | |
237 | var template SoOS1 vt_soos1 := { 'DEAD'O, '1BC5'O }; |
238 | var template SoOS2 vt_soos2 := vt_soos1; |
239 | if (not match( { 'DEAD'O, '1BC5'O }, vt_soos2) or not match(valueof(vt_soos1), vt_soos2)) |
240 | { setverdict(fail, "set of octetstring template incompatibility"); } |
241 | |
242 | var template SoCS1 vt_socs1 := { "red", "blue" }; |
243 | var template SoCS2 vt_socs2 := vt_socs1; |
244 | if (not match( { "red", "blue" }, vt_socs2) or not match(valueof(vt_socs1), vt_socs2)) |
245 | { setverdict(fail, "set of charstring template incompatibility"); } |
246 | |
247 | var template SoUS1 vt_sous1 := { "yellow", "green" }; |
248 | var template SoUS2 vt_sous2 := vt_sous1; |
249 | if (not match( { "yellow", "green" }, vt_sous2) or not match(valueof(vt_sous1), vt_sous2)) |
250 | { setverdict(fail, "set of universal charstring template incompatibility"); } |
251 | |
252 | var template SoI1_opt vt_soi1_opt := { 1, 2 }; |
253 | var template SoI2_opt vt_soi2_opt := vt_soi1_opt; |
254 | if (not match( { 1, 2 }, vt_soi2_opt) or not match(valueof(vt_soi1_opt), vt_soi2_opt)) |
255 | { setverdict(fail, "set of integer template (optimized) incompatibility"); } |
256 | |
257 | setverdict(pass); |
258 | } |
259 | |
260 | control { |
261 | execute(tc_record_of_template_compat()); |
262 | execute(tc_record_of_compat()); |
263 | execute(tc_set_of_template_compat()); |
264 | execute(tc_set_of_compat()); |
265 | } |
266 | |
267 | } |