Sync with 5.1.0
[deliverable/titan.core.git] / regression_test / predefFunction / oct_to_SW.ttcn
1 /******************************************************************************
2 * Copyright (c) 2000-2014 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 oct_to_SW { //^In TTCN-3 module `oct_to_SW'://
9
10 type component PDTestComponent {};
11
12 /*--- OCT2BIT --------------------------------------------------*/
13
14 const bitstring o2bcon := oct2bit(''O)
15 const bitstring o2bcon1 := oct2bit('000000'O & ''O & '111111'O)
16 const bitstring o2bcon2 := oct2bit(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))
17 const bitstring o2bcon3 := oct2bit(('000000'O <@ 3) & ''O & ('111111'O @> 3))
18 const bitstring o2bcon4 := oct2bit((not4b 'FFFFFF'O) & '111111'O)
19 const bitstring o2bcon5 := oct2bit('000000111111'O and4b '000000111111'O)
20 const bitstring o2bcon6 := oct2bit('000000000000'O or4b '000000111111'O)
21 const bitstring o2bcon7 := oct2bit('000000000000'O xor4b '000000111111'O)
22
23 const bitstring o2bconb := '000000000000000000000000000100010001000100010001'B
24
25 testcase oct_to_bit() runs on PDTestComponent{ //In testcase definition//
26
27 if ((o2bcon == oct2bit(''O))
28 and (o2bcon == ''B))
29 {setverdict(pass);}
30 else {setverdict(fail);} //^In else statement// \
31 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
32
33 if ((o2bcon1 == oct2bit('000000'O & ''O & '111111'O))
34 and (o2bcon1 == o2bconb))
35 {setverdict(pass);}
36 else {setverdict(fail);} //^In else statement// \
37 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
38
39 if ((o2bcon2 == oct2bit(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
40 and (o2bcon2 == o2bconb))
41 {setverdict(pass);}
42 else {setverdict(fail);} //^In else statement// \
43 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
44
45 if ((o2bcon3 == oct2bit(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
46 and (o2bcon3 == o2bconb))
47 {setverdict(pass);}
48 else {setverdict(fail);} //^In else statement// \
49 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
50
51 if ((o2bcon4 == oct2bit((not4b 'FFFFFF'O) & '111111'O))
52 and (o2bcon4 == o2bconb))
53 {setverdict(pass);}
54 else {setverdict(fail);} //^In else statement// \
55 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
56
57 if ((o2bcon5 == oct2bit('000000111111'O and4b '000000111111'O))
58 and (o2bcon5 == o2bconb))
59 {setverdict(pass);}
60 else {setverdict(fail);} //^In else statement// \
61 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
62
63 if ((o2bcon6 == oct2bit('000000000000'O or4b '000000111111'O))
64 and (o2bcon6 == o2bconb))
65 {setverdict(pass);}
66 else {setverdict(fail);} //^In else statement// \
67 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
68
69 if ((o2bcon7 == oct2bit('000000000000'O xor4b '000000111111'O))
70 and (o2bcon7 == o2bconb))
71 {setverdict(pass);}
72 else {setverdict(fail);} //^In else statement// \
73 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
74
75 }
76
77 /*--- OCT2CHAR --------------------------------------------------*/
78
79
80 const char o2ccon1 := oct2char(''O) //^warning: Obsolete type `char' was substituted with `charstring'//
81 const char o2ccon2 := oct2char('41'O) //^warning: Obsolete type `char' was substituted with `charstring'//
82 const char o2ccon3 := oct2char(''O & '41'O) //^warning: Obsolete type `char' was substituted with `charstring'//
83 const char o2ccon4 := oct2char('4142434445464748494A4B4C4D4E4F505152535455565758595A'O)//^warning: Obsolete type `char' was substituted with `charstring'//
84
85 testcase oct_to_char() runs on PDTestComponent{ //In testcase definition//
86
87 if ((o2ccon1 == oct2char(''O))
88 and (o2ccon1 == ""))
89 {setverdict(pass);}
90 else {setverdict(fail);} //^In else statement// \
91 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
92 if ((o2ccon2 == oct2char('41'O))
93 and (o2ccon2 == "A"))
94 {setverdict(pass);}
95 else {setverdict(fail);} //^In else statement// \
96 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
97 if ((o2ccon3 == oct2char(''O & '41'O))
98 and (o2ccon3 == "A"))
99 {setverdict(pass);}
100 else {setverdict(fail);} //^In else statement// \
101 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
102 if ((o2ccon4 == oct2char('4142434445464748494A4B4C4D4E4F505152535455565758595A'O))
103 and (o2ccon4 == "ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
104 {setverdict(pass);}
105 else {setverdict(fail);} //^In else statement// \
106 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
107
108 }
109
110
111 /*--- OCT2HEX --------------------------------------------------*/
112
113 const hexstring o2hcon := oct2hex(''O)
114 const hexstring o2hcon1 := oct2hex('000000'O & ''O & '111111'O)
115 const hexstring o2hcon2 := oct2hex(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))
116 const hexstring o2hcon3 := oct2hex(('000000'O <@ 3) & ''O & ('111111'O @> 3))
117 const hexstring o2hcon4 := oct2hex((not4b 'FFFFFF'O) & '111111'O)
118 const hexstring o2hcon5 := oct2hex('000000111111'O and4b '000000111111'O)
119 const hexstring o2hcon6 := oct2hex('000000000000'O or4b '000000111111'O)
120 const hexstring o2hcon7 := oct2hex('000000000000'O xor4b '000000111111'O)
121
122 const hexstring o2hconh := '000000111111'H
123
124 testcase oct_to_hex() runs on PDTestComponent{ //In testcase definition//
125
126 if ((o2hcon == oct2hex(''O))
127 and (o2hcon == ''H))
128 {setverdict(pass);}
129 else {setverdict(fail);} //^In else statement// \
130 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
131
132 if ((o2hcon1 == oct2hex('000000'O & ''O & '111111'O))
133 and (o2hcon1 == o2hconh))
134 {setverdict(pass);}
135 else {setverdict(fail);} //^In else statement// \
136 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
137
138 if ((o2hcon2 == oct2hex(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
139 and (o2hcon2 == o2hconh))
140 {setverdict(pass);}
141 else {setverdict(fail);} //^In else statement// \
142 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
143
144 if ((o2hcon3 == oct2hex(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
145 and (o2hcon3 == o2hconh))
146 {setverdict(pass);}
147 else {setverdict(fail);} //^In else statement// \
148 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
149
150 if ((o2hcon4 == oct2hex((not4b 'FFFFFF'O) & '111111'O))
151 and (o2hcon4 == o2hconh))
152 {setverdict(pass);}
153 else {setverdict(fail);} //^In else statement// \
154 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
155
156 if ((o2hcon5 == oct2hex('000000111111'O and4b '000000111111'O))
157 and (o2hcon5 == o2hconh))
158 {setverdict(pass);}
159 else {setverdict(fail);} //^In else statement// \
160 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
161
162 if ((o2hcon6 == oct2hex('000000000000'O or4b '000000111111'O))
163 and (o2hcon6 == o2hconh))
164 {setverdict(pass);}
165 else {setverdict(fail);} //^In else statement// \
166 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
167
168 if ((o2hcon7 == oct2hex('000000000000'O xor4b '000000111111'O))
169 and (o2hcon7 == o2hconh))
170 {setverdict(pass);}
171 else {setverdict(fail);} //^In else statement// \
172 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
173
174 }
175
176 /*--- OCT2INT --------------------------------------------------*/
177
178 const integer o2icon := oct2int(''O)
179 const integer o2icon1 := oct2int('FF'O & 'FFFF'O)
180 const integer o2icon2 := oct2int((not4b 'FF'O) & 'FFFF'O)
181 const integer o2icon3 := oct2int(('FF'O and4b '00'O) & 'FFFF'O)
182 const integer o2icon4 := oct2int(('00'O or4b '00'O) & 'FFFF'O)
183 const integer o2icon5 := oct2int(('0F'O xor4b '0F'O) & 'FFFF'O)
184 const integer i1 := 12345678910111213141516
185 const octetstring os1 := '00000000000000000000000000000000000000000000029D42B65689328BBE0C'O
186
187 testcase oct_to_int() runs on PDTestComponent{ //In testcase definition//
188
189 if ((o2icon == oct2int(''O))
190 and (o2icon == 0))
191 {setverdict(pass);}
192 else {setverdict(fail);} //^In else statement// \
193 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
194 if ((o2icon1 == oct2int('FF'O & 'FFFF'O))
195 and (o2icon1 == 16777215))
196 {setverdict(pass);}
197 else {setverdict(fail);} //^In else statement// \
198 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
199
200 if ((o2icon2 == oct2int((not4b 'FF'O) & 'FFFF'O))
201 and (o2icon2 == 65535))
202 {setverdict(pass);}
203 else {setverdict(fail);} //^In else statement// \
204 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
205
206 if ((o2icon3 == oct2int(('FF'O and4b '00'O) & 'FFFF'O))
207 and (o2icon3 == 65535))
208 {setverdict(pass);}
209 else {setverdict(fail);} //^In else statement// \
210 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
211
212 if ((o2icon4 == oct2int(('00'O or4b '00'O) & 'FFFF'O))
213 and (o2icon4 == 65535))
214 {setverdict(pass);}
215 else {setverdict(fail);} //^In else statement// \
216 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
217
218 if ((o2icon5 == oct2int(('0F'O xor4b '0F'O) & 'FFFF'O))
219 and (o2icon5 == 65535))
220 {setverdict(pass);}
221 else {setverdict(fail);} //^In else statement// \
222 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
223
224 if (oct2int(os1) == i1)
225 { setverdict(pass) }
226 else { setverdict(fail) } //^In else statement// \
227 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
228 if (oct2int('00000000000000000000000000000000000000000000029D42B65689328BBE0C'O) == 12345678910111213141516)
229 { setverdict(pass) }
230 else { setverdict(fail) } //^In else statement// \
231 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
232 if (oct2int('00000000000000000000000000000000000000000000029D42B65689328BBE0C'O) == i1)
233 { setverdict(pass) }
234 else { setverdict(fail) } //^In else statement// \
235 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
236 if (oct2int('029D42B65689328BBE0C'O) == i1)
237 { setverdict(pass) }
238 else { setverdict(fail) } //^In else statement// \
239 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
240 }
241
242 /*--- OCT2STR --------------------------------------------------*/
243
244 const charstring o2scon := oct2str(''O)
245 const charstring o2scon1 := oct2str('000000'O & ''O & '111111'O)
246 const charstring o2scon2 := oct2str(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))
247 const charstring o2scon3 := oct2str(('000000'O <@ 3) & ''O & ('111111'O @> 3))
248 const charstring o2scon4 := oct2str((not4b 'FFFFFF'O) & '111111'O)
249 const charstring o2scon5 := oct2str('000000111111'O and4b '000000111111'O)
250 const charstring o2scon6 := oct2str('000000000000'O or4b '000000111111'O)
251 const charstring o2scon7 := oct2str('000000000000'O xor4b '000000111111'O)
252
253 const charstring o2scons := "000000111111"
254
255 testcase oct_to_str() runs on PDTestComponent{ //In testcase definition//
256
257
258 if ((o2scon == oct2str(''O))
259 and (o2scon == ""))
260 {setverdict(pass);}
261 else {setverdict(fail);} //^In else statement// \
262 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
263
264 if ((o2scon1 == oct2str('000000'O & ''O & '111111'O))
265 and (o2scon1 == o2scons))
266 {setverdict(pass);}
267 else {setverdict(fail);} //^In else statement// \
268 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
269
270 if ((o2scon2 == oct2str(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
271 and (o2scon2 == o2scons))
272 {setverdict(pass);}
273 else {setverdict(fail);} //^In else statement// \
274 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
275
276 if ((o2scon3 == oct2str(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
277 and (o2scon3 == o2scons))
278 {setverdict(pass);}
279 else {setverdict(fail);} //^In else statement// \
280 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
281
282 if ((o2scon4 == oct2str((not4b 'FFFFFF'O) & '111111'O))
283 and (o2scon4 == o2scons))
284 {setverdict(pass);}
285 else {setverdict(fail);} //^In else statement// \
286 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
287
288 if ((o2scon5 == oct2str('000000111111'O and4b '000000111111'O))
289 and (o2scon5 == o2scons))
290 {setverdict(pass);}
291 else {setverdict(fail);} //^In else statement// \
292 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
293
294 if ((o2scon6 == oct2str('000000000000'O or4b '000000111111'O))
295 and (o2scon6 == o2scons))
296 {setverdict(pass);}
297 else {setverdict(fail);} //^In else statement// \
298 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
299
300 if ((o2scon7 == oct2str('000000000000'O xor4b '000000111111'O))
301 and (o2scon7 == o2scons))
302 {setverdict(pass);}
303 else {setverdict(fail);} //^In else statement// \
304 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
305
306 }
307
308
309 control {
310 execute (oct_to_bit());
311 execute (oct_to_char());
312 execute (oct_to_hex());
313 execute (oct_to_int());
314 execute (oct_to_str());
315 }
316
317
318 }
This page took 0.037438 seconds and 5 git commands to generate.