Sync with 5.4.0
[deliverable/titan.core.git] / regression_test / predefFunction / length_of_SW.ttcn
CommitLineData
970ed795 1/******************************************************************************
3abe9331 2 * Copyright (c) 2000-2015 Ericsson Telecom AB
970ed795
EL
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 ******************************************************************************/
8module length_of_SW { //^In TTCN-3 module `length_of_SW'://
9
10type component PDTestComponent {};
11
12/*--- LENGTH OF BITSTRING --------------------------------------------------*/
13
14const bitstring lofb := '1110001100'B
15const bitstring lofb1 := ''B
16
17const integer lofbi := lengthof(lofb & lofb)
18const integer lofbi1 := lengthof(substr(lofb,0,lengthof(lofb)))
19const integer lofbi2 := lengthof(substr(lofb,0,lengthof(lofb)/2))
20const integer lofbi3 := lengthof(lofb & lofb1)
21const integer lofbi4 := lengthof(lofb1 & lofb1)
22const integer lofbi5 := lengthof(substr(lofb1,0,lengthof(lofb1)))
23
24testcase lengthof_bitstr() runs on PDTestComponent{ //In testcase definition//
25
26 if ((lofbi == 2*lengthof(lofb))
27 and (lofbi == lengthof(lofb & lofb)))
28 {setverdict(pass);}
29 else {setverdict(fail);} //^In else statement// \
30 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
31 if ((lofbi1 == lengthof(lofb))
32 and (lofbi1 == lengthof(substr(lofb,0,lengthof(lofb)))))
33 {setverdict(pass);}
34 else {setverdict(fail);} //^In else statement// \
35 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
36 if ((lofbi2 == 5)
37 and (lofbi2 == lengthof(substr(lofb,0,lengthof(lofb)/2))))
38 {setverdict(pass);}
39 else {setverdict(fail);} //^In else statement// \
40 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
41 if ((lofbi3 == 10)
42 and (lofbi3 == lengthof(lofb & lofb1)))
43 {setverdict(pass);}
44 else {setverdict(fail);} //^In else statement// \
45 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
46 if ((lofbi4 == 0)
47 and (lofbi4 == lengthof(lofb1 & lofb1)))
48 {setverdict(pass);}
49 else {setverdict(fail);} //^In else statement// \
50 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
51 if ((lofbi5 == 0)
52 and (lofbi5 == lengthof(substr(lofb1,0,lengthof(lofb1)))))
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
58/*--- LENGTH OF HEXSTRING --------------------------------------------------*/
59
60const hexstring lofh := '1110001100'H
61const hexstring lofh1 := ''H
62
63const integer lofhi := lengthof(lofh & lofh)
64const integer lofhi1 := lengthof(substr(lofh,0,lengthof(lofh)))
65const integer lofhi2 := lengthof(substr(lofh,0,lengthof(lofh)/2))
66const integer lofhi3 := lengthof(lofh & lofh1)
67const integer lofhi4 := lengthof(lofh1 & lofh1)
68const integer lofhi5 := lengthof(substr(lofh1,0,lengthof(lofh1)))
69
70testcase lengthof_hexstr() runs on PDTestComponent{ //In testcase definition//
71
72 if ((lofhi == 2*lengthof(lofh))
73 and (lofhi == lengthof(lofh & lofh)))
74 {setverdict(pass);}
75 else {setverdict(fail);} //^In else statement// \
76 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
77 if ((lofhi1 == lengthof(lofh))
78 and (lofhi1 == lengthof(substr(lofh,0,lengthof(lofh)))))
79 {setverdict(pass);}
80 else {setverdict(fail);} //^In else statement// \
81 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
82 if ((lofhi2 == 5)
83 and (lofhi2 == lengthof(substr(lofh,0,lengthof(lofh)/2))))
84 {setverdict(pass);}
85 else {setverdict(fail);} //^In else statement// \
86 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
87 if ((lofhi3 == 10)
88 and (lofhi3 == lengthof(lofh & lofh1)))
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 ((lofhi4 == 0)
93 and (lofhi4 == lengthof(lofh1 & lofh1)))
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 ((lofhi5 == 0)
98 and (lofhi5 == lengthof(substr(lofh1,0,lengthof(lofh1)))))
99 {setverdict(pass);}
100 else {setverdict(fail);} //^In else statement// \
101 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
102}
103
104/*--- LENGTH OF OCTETSTRING --------------------------------------------------*/
105
106const octetstring lofo := '11111100000011110000'O
107const octetstring lofo1 := ''O
108
109const integer lofoi := lengthof(lofo & lofo)
110const integer lofoi1 := lengthof(substr(lofo,0,lengthof(lofo)))
111const integer lofoi2 := lengthof(substr(lofo,0,lengthof(lofo)/2))
112const integer lofoi3 := lengthof(lofo & lofo1)
113const integer lofoi4 := lengthof(lofo1 & lofo1)
114const integer lofoi5 := lengthof(substr(lofo1,0,lengthof(lofo1)))
115
116testcase lengthof_octetstr() runs on PDTestComponent{ //In testcase definition//
117
118 if ((lofoi == 2*lengthof(lofo))
119 and (lofoi == lengthof(lofo & lofo)))
120 {setverdict(pass);}
121 else {setverdict(fail);} //^In else statement// \
122 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
123 if ((lofoi1 == lengthof(lofo))
124 and (lofoi1 == lengthof(substr(lofo,0,lengthof(lofo)))))
125 {setverdict(pass);}
126 else {setverdict(fail);} //^In else statement// \
127 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
128 if ((lofoi2 == 5)
129 and (lofoi2 == lengthof(substr(lofo,0,lengthof(lofo)/2))))
130 {setverdict(pass);}
131 else {setverdict(fail);} //^In else statement// \
132 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
133 if ((lofoi3 == 10)
134 and (lofoi3 == lengthof(lofo & lofo1)))
135 {setverdict(pass);}
136 else {setverdict(fail);} //^In else statement// \
137 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
138 if ((lofoi4 == 0)
139 and (lofoi4 == lengthof(lofo1 & lofo1)))
140 {setverdict(pass);}
141 else {setverdict(fail);} //^In else statement// \
142 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
143 if ((lofoi5 == 0)
144 and (lofoi5 == lengthof(substr(lofo1,0,lengthof(lofo1)))))
145 {setverdict(pass);}
146 else {setverdict(fail);} //^In else statement// \
147 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
148}
149
150
151/*--- LENGTH OF CHARSTRING --------------------------------------------------*/
152
153const charstring lofc := "1110001100"
154const charstring lofc1 := ""
155
156const integer lofci := lengthof(lofc & lofc)
157const integer lofci1 := lengthof(substr(lofc,0,lengthof(lofc)))
158const integer lofci2 := lengthof(substr(lofc,0,lengthof(lofc)/2))
159const integer lofci3 := lengthof(lofc & lofc1)
160const integer lofci4 := lengthof(lofc1 & lofc1)
161const integer lofci5 := lengthof(substr(lofc1,0,lengthof(lofc1)))
162
163testcase lengthof_charstr() runs on PDTestComponent{ //In testcase definition//
164
165 if ((lofci == 2*lengthof(lofc))
166 and (lofci == lengthof(lofc & lofc)))
167 {setverdict(pass);}
168 else {setverdict(fail);} //^In else statement// \
169 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
170 if ((lofci1 == lengthof(lofc))
171 and (lofci1 == lengthof(substr(lofc,0,lengthof(lofc)))))
172 {setverdict(pass);}
173 else {setverdict(fail);} //^In else statement// \
174 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
175 if ((lofci2 == 5)
176 and (lofci2 == lengthof(substr(lofc,0,lengthof(lofc)/2))))
177 {setverdict(pass);}
178 else {setverdict(fail);} //^In else statement// \
179 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
180 if ((lofci3 == 10)
181 and (lofci3 == lengthof(lofc & lofc1)))
182 {setverdict(pass);}
183 else {setverdict(fail);} //^In else statement// \
184 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
185 if ((lofci4 == 0)
186 and (lofci4 == lengthof(lofc1 & lofc1)))
187 {setverdict(pass);}
188 else {setverdict(fail);} //^In else statement// \
189 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
190 if ((lofci5 == 0)
191 and (lofci5 == lengthof(substr(lofc1,0,lengthof(lofc1)))))
192 {setverdict(pass);}
193 else {setverdict(fail);} //^In else statement// \
194 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
195}
196
197
198/*--- LENGTH OF UNIVERSAL CHARSTRING --------------------------------------------------*/
199
200const universal charstring lofuc := "1111" & char(0,0,0,65) & "0000" & char(0,0,0,66)
201const universal charstring lofuc1 := ""
202
203const integer lofuci := lengthof(lofuc & lofuc)
204const integer lofuci1 := lengthof(substr(lofuc,0,lengthof(lofuc)))
205const integer lofuci2 := lengthof(substr(lofuc,0,lengthof(lofuc)/2))
206const integer lofuci3 := lengthof(lofuc & lofuc1)
207const integer lofuci4 := lengthof(lofuc1 & lofuc1)
208const integer lofuci5 := lengthof(substr(lofuc1,0,lengthof(lofuc1)))
209
210testcase lengthof_ucharstr() runs on PDTestComponent{ //In testcase definition//
211
212 if ((lofuci == 2*lengthof(lofuc))
213 and (lofuci == lengthof(lofuc & lofuc)))
214 {setverdict(pass);}
215 else {setverdict(fail);} //^In else statement// \
216 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
217 if ((lofuci1 == lengthof(lofuc))
218 and (lofuci1 == lengthof(substr(lofuc,0,lengthof(lofuc)))))
219 {setverdict(pass);}
220 else {setverdict(fail);} //^In else statement// \
221 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
222 if ((lofuci2 == 5)
223 and (lofuci2 == lengthof(substr(lofuc,0,lengthof(lofuc)/2))))
224 {setverdict(pass);}
225 else {setverdict(fail);} //^In else statement// \
226 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
227 if ((lofuci3 == 10)
228 and (lofuci3 == lengthof(lofuc & lofuc1)))
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 ((lofuci4 == 0)
233 and (lofuci4 == lengthof(lofuc1 & lofuc1)))
234 {setverdict(pass);}
235 else {setverdict(fail);} //^In else statement// \
236 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
237 if ((lofuci5 == 0)
238 and (lofuci5 == lengthof(substr(lofuc1,0,lengthof(lofuc1)))))
239 {setverdict(pass);}
240 else {setverdict(fail);} //^In else statement// \
241 //^warning\: Control never reaches this code because of previous effective condition\(s\)//
242}
243
244control {
245 execute (lengthof_bitstr());
246 execute (lengthof_hexstr());
247 execute (lengthof_octetstr());
248 execute (lengthof_charstr());
249 execute (lengthof_ucharstr());
250}
251
252}
This page took 0.033172 seconds and 5 git commands to generate.