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