/****************************************************************************** * Copyright (c) 2000-2014 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ module oct_to_SW { //^In TTCN-3 module `oct_to_SW':// type component PDTestComponent {}; /*--- OCT2BIT --------------------------------------------------*/ const bitstring o2bcon := oct2bit(''O) const bitstring o2bcon1 := oct2bit('000000'O & ''O & '111111'O) const bitstring o2bcon2 := oct2bit(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)) const bitstring o2bcon3 := oct2bit(('000000'O <@ 3) & ''O & ('111111'O @> 3)) const bitstring o2bcon4 := oct2bit((not4b 'FFFFFF'O) & '111111'O) const bitstring o2bcon5 := oct2bit('000000111111'O and4b '000000111111'O) const bitstring o2bcon6 := oct2bit('000000000000'O or4b '000000111111'O) const bitstring o2bcon7 := oct2bit('000000000000'O xor4b '000000111111'O) const bitstring o2bconb := '000000000000000000000000000100010001000100010001'B testcase oct_to_bit() runs on PDTestComponent{ //In testcase definition// if ((o2bcon == oct2bit(''O)) and (o2bcon == ''B)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon1 == oct2bit('000000'O & ''O & '111111'O)) and (o2bcon1 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon2 == oct2bit(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))) and (o2bcon2 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon3 == oct2bit(('000000'O <@ 3) & ''O & ('111111'O @> 3))) and (o2bcon3 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon4 == oct2bit((not4b 'FFFFFF'O) & '111111'O)) and (o2bcon4 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon5 == oct2bit('000000111111'O and4b '000000111111'O)) and (o2bcon5 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon6 == oct2bit('000000000000'O or4b '000000111111'O)) and (o2bcon6 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2bcon7 == oct2bit('000000000000'O xor4b '000000111111'O)) and (o2bcon7 == o2bconb)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- OCT2CHAR --------------------------------------------------*/ const char o2ccon1 := oct2char(''O) //^warning: Obsolete type `char' was substituted with `charstring'// const char o2ccon2 := oct2char('41'O) //^warning: Obsolete type `char' was substituted with `charstring'// const char o2ccon3 := oct2char(''O & '41'O) //^warning: Obsolete type `char' was substituted with `charstring'// const char o2ccon4 := oct2char('4142434445464748494A4B4C4D4E4F505152535455565758595A'O)//^warning: Obsolete type `char' was substituted with `charstring'// testcase oct_to_char() runs on PDTestComponent{ //In testcase definition// if ((o2ccon1 == oct2char(''O)) and (o2ccon1 == "")) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2ccon2 == oct2char('41'O)) and (o2ccon2 == "A")) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2ccon3 == oct2char(''O & '41'O)) and (o2ccon3 == "A")) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2ccon4 == oct2char('4142434445464748494A4B4C4D4E4F505152535455565758595A'O)) and (o2ccon4 == "ABCDEFGHIJKLMNOPQRSTUVWXYZ")) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- OCT2HEX --------------------------------------------------*/ const hexstring o2hcon := oct2hex(''O) const hexstring o2hcon1 := oct2hex('000000'O & ''O & '111111'O) const hexstring o2hcon2 := oct2hex(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)) const hexstring o2hcon3 := oct2hex(('000000'O <@ 3) & ''O & ('111111'O @> 3)) const hexstring o2hcon4 := oct2hex((not4b 'FFFFFF'O) & '111111'O) const hexstring o2hcon5 := oct2hex('000000111111'O and4b '000000111111'O) const hexstring o2hcon6 := oct2hex('000000000000'O or4b '000000111111'O) const hexstring o2hcon7 := oct2hex('000000000000'O xor4b '000000111111'O) const hexstring o2hconh := '000000111111'H testcase oct_to_hex() runs on PDTestComponent{ //In testcase definition// if ((o2hcon == oct2hex(''O)) and (o2hcon == ''H)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon1 == oct2hex('000000'O & ''O & '111111'O)) and (o2hcon1 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon2 == oct2hex(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))) and (o2hcon2 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon3 == oct2hex(('000000'O <@ 3) & ''O & ('111111'O @> 3))) and (o2hcon3 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon4 == oct2hex((not4b 'FFFFFF'O) & '111111'O)) and (o2hcon4 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon5 == oct2hex('000000111111'O and4b '000000111111'O)) and (o2hcon5 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon6 == oct2hex('000000000000'O or4b '000000111111'O)) and (o2hcon6 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2hcon7 == oct2hex('000000000000'O xor4b '000000111111'O)) and (o2hcon7 == o2hconh)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- OCT2INT --------------------------------------------------*/ const integer o2icon := oct2int(''O) const integer o2icon1 := oct2int('FF'O & 'FFFF'O) const integer o2icon2 := oct2int((not4b 'FF'O) & 'FFFF'O) const integer o2icon3 := oct2int(('FF'O and4b '00'O) & 'FFFF'O) const integer o2icon4 := oct2int(('00'O or4b '00'O) & 'FFFF'O) const integer o2icon5 := oct2int(('0F'O xor4b '0F'O) & 'FFFF'O) const integer i1 := 12345678910111213141516 const octetstring os1 := '00000000000000000000000000000000000000000000029D42B65689328BBE0C'O testcase oct_to_int() runs on PDTestComponent{ //In testcase definition// if ((o2icon == oct2int(''O)) and (o2icon == 0)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2icon1 == oct2int('FF'O & 'FFFF'O)) and (o2icon1 == 16777215)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2icon2 == oct2int((not4b 'FF'O) & 'FFFF'O)) and (o2icon2 == 65535)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2icon3 == oct2int(('FF'O and4b '00'O) & 'FFFF'O)) and (o2icon3 == 65535)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2icon4 == oct2int(('00'O or4b '00'O) & 'FFFF'O)) and (o2icon4 == 65535)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2icon5 == oct2int(('0F'O xor4b '0F'O) & 'FFFF'O)) and (o2icon5 == 65535)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if (oct2int(os1) == i1) { setverdict(pass) } else { setverdict(fail) } //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if (oct2int('00000000000000000000000000000000000000000000029D42B65689328BBE0C'O) == 12345678910111213141516) { setverdict(pass) } else { setverdict(fail) } //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if (oct2int('00000000000000000000000000000000000000000000029D42B65689328BBE0C'O) == i1) { setverdict(pass) } else { setverdict(fail) } //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if (oct2int('029D42B65689328BBE0C'O) == i1) { setverdict(pass) } else { setverdict(fail) } //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- OCT2STR --------------------------------------------------*/ const charstring o2scon := oct2str(''O) const charstring o2scon1 := oct2str('000000'O & ''O & '111111'O) const charstring o2scon2 := oct2str(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3)) const charstring o2scon3 := oct2str(('000000'O <@ 3) & ''O & ('111111'O @> 3)) const charstring o2scon4 := oct2str((not4b 'FFFFFF'O) & '111111'O) const charstring o2scon5 := oct2str('000000111111'O and4b '000000111111'O) const charstring o2scon6 := oct2str('000000000000'O or4b '000000111111'O) const charstring o2scon7 := oct2str('000000000000'O xor4b '000000111111'O) const charstring o2scons := "000000111111" testcase oct_to_str() runs on PDTestComponent{ //In testcase definition// if ((o2scon == oct2str(''O)) and (o2scon == "")) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon1 == oct2str('000000'O & ''O & '111111'O)) and (o2scon1 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon2 == oct2str(substr('000000111111'O,0,3) & ''O & substr('000000111111'O,3,3))) and (o2scon2 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon3 == oct2str(('000000'O <@ 3) & ''O & ('111111'O @> 3))) and (o2scon3 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon4 == oct2str((not4b 'FFFFFF'O) & '111111'O)) and (o2scon4 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon5 == oct2str('000000111111'O and4b '000000111111'O)) and (o2scon5 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon6 == oct2str('000000000000'O or4b '000000111111'O)) and (o2scon6 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((o2scon7 == oct2str('000000000000'O xor4b '000000111111'O)) and (o2scon7 == o2scons)) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } control { execute (oct_to_bit()); execute (oct_to_char()); execute (oct_to_hex()); execute (oct_to_int()); execute (oct_to_str()); } }