/****************************************************************************** * 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 length_of_SW { //^In TTCN-3 module `length_of_SW':// type component PDTestComponent {}; /*--- LENGTH OF BITSTRING --------------------------------------------------*/ const bitstring lofb := '1110001100'B const bitstring lofb1 := ''B const integer lofbi := lengthof(lofb & lofb) const integer lofbi1 := lengthof(substr(lofb,0,lengthof(lofb))) const integer lofbi2 := lengthof(substr(lofb,0,lengthof(lofb)/2)) const integer lofbi3 := lengthof(lofb & lofb1) const integer lofbi4 := lengthof(lofb1 & lofb1) const integer lofbi5 := lengthof(substr(lofb1,0,lengthof(lofb1))) testcase lengthof_bitstr() runs on PDTestComponent{ //In testcase definition// if ((lofbi == 2*lengthof(lofb)) and (lofbi == lengthof(lofb & lofb))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofbi1 == lengthof(lofb)) and (lofbi1 == lengthof(substr(lofb,0,lengthof(lofb))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofbi2 == 5) and (lofbi2 == lengthof(substr(lofb,0,lengthof(lofb)/2)))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofbi3 == 10) and (lofbi3 == lengthof(lofb & lofb1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofbi4 == 0) and (lofbi4 == lengthof(lofb1 & lofb1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofbi5 == 0) and (lofbi5 == lengthof(substr(lofb1,0,lengthof(lofb1))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- LENGTH OF HEXSTRING --------------------------------------------------*/ const hexstring lofh := '1110001100'H const hexstring lofh1 := ''H const integer lofhi := lengthof(lofh & lofh) const integer lofhi1 := lengthof(substr(lofh,0,lengthof(lofh))) const integer lofhi2 := lengthof(substr(lofh,0,lengthof(lofh)/2)) const integer lofhi3 := lengthof(lofh & lofh1) const integer lofhi4 := lengthof(lofh1 & lofh1) const integer lofhi5 := lengthof(substr(lofh1,0,lengthof(lofh1))) testcase lengthof_hexstr() runs on PDTestComponent{ //In testcase definition// if ((lofhi == 2*lengthof(lofh)) and (lofhi == lengthof(lofh & lofh))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofhi1 == lengthof(lofh)) and (lofhi1 == lengthof(substr(lofh,0,lengthof(lofh))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofhi2 == 5) and (lofhi2 == lengthof(substr(lofh,0,lengthof(lofh)/2)))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofhi3 == 10) and (lofhi3 == lengthof(lofh & lofh1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofhi4 == 0) and (lofhi4 == lengthof(lofh1 & lofh1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofhi5 == 0) and (lofhi5 == lengthof(substr(lofh1,0,lengthof(lofh1))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- LENGTH OF OCTETSTRING --------------------------------------------------*/ const octetstring lofo := '11111100000011110000'O const octetstring lofo1 := ''O const integer lofoi := lengthof(lofo & lofo) const integer lofoi1 := lengthof(substr(lofo,0,lengthof(lofo))) const integer lofoi2 := lengthof(substr(lofo,0,lengthof(lofo)/2)) const integer lofoi3 := lengthof(lofo & lofo1) const integer lofoi4 := lengthof(lofo1 & lofo1) const integer lofoi5 := lengthof(substr(lofo1,0,lengthof(lofo1))) testcase lengthof_octetstr() runs on PDTestComponent{ //In testcase definition// if ((lofoi == 2*lengthof(lofo)) and (lofoi == lengthof(lofo & lofo))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofoi1 == lengthof(lofo)) and (lofoi1 == lengthof(substr(lofo,0,lengthof(lofo))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofoi2 == 5) and (lofoi2 == lengthof(substr(lofo,0,lengthof(lofo)/2)))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofoi3 == 10) and (lofoi3 == lengthof(lofo & lofo1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofoi4 == 0) and (lofoi4 == lengthof(lofo1 & lofo1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofoi5 == 0) and (lofoi5 == lengthof(substr(lofo1,0,lengthof(lofo1))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- LENGTH OF CHARSTRING --------------------------------------------------*/ const charstring lofc := "1110001100" const charstring lofc1 := "" const integer lofci := lengthof(lofc & lofc) const integer lofci1 := lengthof(substr(lofc,0,lengthof(lofc))) const integer lofci2 := lengthof(substr(lofc,0,lengthof(lofc)/2)) const integer lofci3 := lengthof(lofc & lofc1) const integer lofci4 := lengthof(lofc1 & lofc1) const integer lofci5 := lengthof(substr(lofc1,0,lengthof(lofc1))) testcase lengthof_charstr() runs on PDTestComponent{ //In testcase definition// if ((lofci == 2*lengthof(lofc)) and (lofci == lengthof(lofc & lofc))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofci1 == lengthof(lofc)) and (lofci1 == lengthof(substr(lofc,0,lengthof(lofc))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofci2 == 5) and (lofci2 == lengthof(substr(lofc,0,lengthof(lofc)/2)))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofci3 == 10) and (lofci3 == lengthof(lofc & lofc1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofci4 == 0) and (lofci4 == lengthof(lofc1 & lofc1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofci5 == 0) and (lofci5 == lengthof(substr(lofc1,0,lengthof(lofc1))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } /*--- LENGTH OF UNIVERSAL CHARSTRING --------------------------------------------------*/ const universal charstring lofuc := "1111" & char(0,0,0,65) & "0000" & char(0,0,0,66) const universal charstring lofuc1 := "" const integer lofuci := lengthof(lofuc & lofuc) const integer lofuci1 := lengthof(substr(lofuc,0,lengthof(lofuc))) const integer lofuci2 := lengthof(substr(lofuc,0,lengthof(lofuc)/2)) const integer lofuci3 := lengthof(lofuc & lofuc1) const integer lofuci4 := lengthof(lofuc1 & lofuc1) const integer lofuci5 := lengthof(substr(lofuc1,0,lengthof(lofuc1))) testcase lengthof_ucharstr() runs on PDTestComponent{ //In testcase definition// if ((lofuci == 2*lengthof(lofuc)) and (lofuci == lengthof(lofuc & lofuc))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofuci1 == lengthof(lofuc)) and (lofuci1 == lengthof(substr(lofuc,0,lengthof(lofuc))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofuci2 == 5) and (lofuci2 == lengthof(substr(lofuc,0,lengthof(lofuc)/2)))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofuci3 == 10) and (lofuci3 == lengthof(lofuc & lofuc1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofuci4 == 0) and (lofuci4 == lengthof(lofuc1 & lofuc1))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// if ((lofuci5 == 0) and (lofuci5 == lengthof(substr(lofuc1,0,lengthof(lofuc1))))) {setverdict(pass);} else {setverdict(fail);} //^In else statement// \ //^warning\: Control never reaches this code because of previous effective condition\(s\)// } control { execute (lengthof_bitstr()); execute (lengthof_hexstr()); execute (lengthof_octetstr()); execute (lengthof_charstr()); execute (lengthof_ucharstr()); } }