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'://
10 type component PDTestComponent {};
12 /*--- OCT2BIT --------------------------------------------------*/
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)
23 const bitstring o2bconb := '000000000000000000000000000100010001000100010001'B
25 testcase oct_to_bit() runs on PDTestComponent{ //In testcase definition//
27 if ((o2bcon == oct2bit(''O))
30 else {setverdict(fail);} //^In else statement// \
31 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
33 if ((o2bcon1 == oct2bit('000000'O & ''O & '111111'O))
34 and (o2bcon1 == o2bconb))
36 else {setverdict(fail);} //^In else statement// \
37 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
39 if ((o2bcon2 == oct2bit(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
40 and (o2bcon2 == o2bconb))
42 else {setverdict(fail);} //^In else statement// \
43 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
45 if ((o2bcon3 == oct2bit(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
46 and (o2bcon3 == o2bconb))
48 else {setverdict(fail);} //^In else statement// \
49 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
51 if ((o2bcon4 == oct2bit((not4b 'FFFFFF'O) & '111111'O))
52 and (o2bcon4 == o2bconb))
54 else {setverdict(fail);} //^In else statement// \
55 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
57 if ((o2bcon5 == oct2bit('000000111111'O and4b '000000111111'O))
58 and (o2bcon5 == o2bconb))
60 else {setverdict(fail);} //^In else statement// \
61 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
63 if ((o2bcon6 == oct2bit('000000000000'O or4b '000000111111'O))
64 and (o2bcon6 == o2bconb))
66 else {setverdict(fail);} //^In else statement// \
67 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
69 if ((o2bcon7 == oct2bit('000000000000'O xor4b '000000111111'O))
70 and (o2bcon7 == o2bconb))
72 else {setverdict(fail);} //^In else statement// \
73 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
77 /*--- OCT2CHAR --------------------------------------------------*/
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'//
85 testcase oct_to_char() runs on PDTestComponent{ //In testcase definition//
87 if ((o2ccon1 == oct2char(''O))
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))
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))
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"))
105 else {setverdict(fail);} //^In else statement// \
106 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
111 /*--- OCT2HEX --------------------------------------------------*/
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)
122 const hexstring o2hconh := '000000111111'H
124 testcase oct_to_hex() runs on PDTestComponent{ //In testcase definition//
126 if ((o2hcon == oct2hex(''O))
129 else {setverdict(fail);} //^In else statement// \
130 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
132 if ((o2hcon1 == oct2hex('000000'O & ''O & '111111'O))
133 and (o2hcon1 == o2hconh))
135 else {setverdict(fail);} //^In else statement// \
136 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
138 if ((o2hcon2 == oct2hex(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
139 and (o2hcon2 == o2hconh))
141 else {setverdict(fail);} //^In else statement// \
142 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
144 if ((o2hcon3 == oct2hex(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
145 and (o2hcon3 == o2hconh))
147 else {setverdict(fail);} //^In else statement// \
148 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
150 if ((o2hcon4 == oct2hex((not4b 'FFFFFF'O) & '111111'O))
151 and (o2hcon4 == o2hconh))
153 else {setverdict(fail);} //^In else statement// \
154 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
156 if ((o2hcon5 == oct2hex('000000111111'O and4b '000000111111'O))
157 and (o2hcon5 == o2hconh))
159 else {setverdict(fail);} //^In else statement// \
160 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
162 if ((o2hcon6 == oct2hex('000000000000'O or4b '000000111111'O))
163 and (o2hcon6 == o2hconh))
165 else {setverdict(fail);} //^In else statement// \
166 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
168 if ((o2hcon7 == oct2hex('000000000000'O xor4b '000000111111'O))
169 and (o2hcon7 == o2hconh))
171 else {setverdict(fail);} //^In else statement// \
172 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
176 /*--- OCT2INT --------------------------------------------------*/
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
187 testcase oct_to_int() runs on PDTestComponent{ //In testcase definition//
189 if ((o2icon == oct2int(''O))
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))
197 else {setverdict(fail);} //^In else statement// \
198 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
200 if ((o2icon2 == oct2int((not4b 'FF'O) & 'FFFF'O))
201 and (o2icon2 == 65535))
203 else {setverdict(fail);} //^In else statement// \
204 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
206 if ((o2icon3 == oct2int(('FF'O and4b '00'O) & 'FFFF'O))
207 and (o2icon3 == 65535))
209 else {setverdict(fail);} //^In else statement// \
210 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
212 if ((o2icon4 == oct2int(('00'O or4b '00'O) & 'FFFF'O))
213 and (o2icon4 == 65535))
215 else {setverdict(fail);} //^In else statement// \
216 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
218 if ((o2icon5 == oct2int(('0F'O xor4b '0F'O) & 'FFFF'O))
219 and (o2icon5 == 65535))
221 else {setverdict(fail);} //^In else statement// \
222 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
224 if (oct2int(os1) == i1)
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)
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)
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)
238 else { setverdict(fail) } //^In else statement// \
239 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
242 /*--- OCT2STR --------------------------------------------------*/
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)
253 const charstring o2scons := "000000111111"
255 testcase oct_to_str() runs on PDTestComponent{ //In testcase definition//
258 if ((o2scon == oct2str(''O))
261 else {setverdict(fail);} //^In else statement// \
262 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
264 if ((o2scon1 == oct2str('000000'O & ''O & '111111'O))
265 and (o2scon1 == o2scons))
267 else {setverdict(fail);} //^In else statement// \
268 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
270 if ((o2scon2 == oct2str(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)))
271 and (o2scon2 == o2scons))
273 else {setverdict(fail);} //^In else statement// \
274 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
276 if ((o2scon3 == oct2str(('000000'O <@ 3) & ''O & ('111111'O @> 3)))
277 and (o2scon3 == o2scons))
279 else {setverdict(fail);} //^In else statement// \
280 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
282 if ((o2scon4 == oct2str((not4b 'FFFFFF'O) & '111111'O))
283 and (o2scon4 == o2scons))
285 else {setverdict(fail);} //^In else statement// \
286 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
288 if ((o2scon5 == oct2str('000000111111'O and4b '000000111111'O))
289 and (o2scon5 == o2scons))
291 else {setverdict(fail);} //^In else statement// \
292 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
294 if ((o2scon6 == oct2str('000000000000'O or4b '000000111111'O))
295 and (o2scon6 == o2scons))
297 else {setverdict(fail);} //^In else statement// \
298 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
300 if ((o2scon7 == oct2str('000000000000'O xor4b '000000111111'O))
301 and (o2scon7 == o2scons))
303 else {setverdict(fail);} //^In else statement// \
304 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
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());