Debian Codegraph @

tests/lsearch.test

raw
1 # Commands covered: lsearch
2 #
3 # This file contains a collection of tests for one or more of the Tcl built-in
4 # commands. Sourcing this file into Tcl runs the tests and generates output
5 # for errors. No output means no errors were found.
6 #
7 # Copyright (c) 1991-1993 The Regents of the University of California.
8 # Copyright (c) 1994 Sun Microsystems, Inc.
9 # Copyright (c) 1998-1999 by Scriptics Corporation.
10 #
11 # See the file "license.terms" for information on usage and redistribution of
12 # this file, and for a DISCLAIMER OF ALL WARRANTIES.
13
14 if {"::tcltest" ni [namespace children]} {
15 package require tcltest 2.5
16 namespace import -force ::tcltest::*
17 }
18
19 set x {abcd bbcd 123 234 345}
20 test lsearch-1.1 {lsearch command} {
21 lsearch $x 123
22 } 2
23 test lsearch-1.2 {lsearch command} {
24 lsearch $x 3456
25 } -1
26 test lsearch-1.3 {lsearch command} {
27 lsearch $x *5
28 } 4
29 test lsearch-1.4 {lsearch command} {
30 lsearch $x *bc*
31 } 0
32
33 test lsearch-2.1 {search modes} {
34 lsearch -exact {xyz bbcc *bc*} *bc*
35 } 2
36 test lsearch-2.2 {search modes} {
37 lsearch -exact {b.x ^bc xy bcx} ^bc
38 } 1
39 test lsearch-2.3 {search modes} {
40 lsearch -exact {foo bar cat} ba
41 } -1
42 test lsearch-2.4 {search modes} {
43 lsearch -exact {foo bar cat} bart
44 } -1
45 test lsearch-2.5 {search modes} {
46 lsearch -exact {foo bar cat} bar
47 } 1
48 test lsearch-2.6 {search modes} -returnCodes error -body {
49 lsearch -regexp {xyz bbcc *bc*} *bc*
50 } -result {couldn't compile regular expression pattern: quantifier operand invalid}
51 test lsearch-2.7 {search modes} {
52 lsearch -regexp {b.x ^bc xy bcx} ^bc
53 } 3
54 test lsearch-2.8 {search modes} {
55 lsearch -glob {xyz bbcc *bc*} *bc*
56 } 1
57 test lsearch-2.9 {search modes} {
58 lsearch -glob {b.x ^bc xy bcx} ^bc
59 } 1
60 test lsearch-2.10 {search modes} -returnCodes error -body {
61 lsearch -glib {b.x bx xy bcx} b.x
62 } -result {bad option "-glib": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}
63 test lsearch-2.11 {search modes with -nocase} {
64 lsearch -exact -nocase {a b c A B C} A
65 } 0
66 test lsearch-2.12 {search modes with -nocase} {
67 lsearch -glob -nocase {a b c A B C} A*
68 } 0
69 test lsearch-2.13 {search modes with -nocase} {
70 lsearch -regexp -nocase {a b c A B C} ^A\$
71 } 0
72 test lsearch-2.14 {search modes without -nocase} {
73 lsearch -exact {a b c A B C} A
74 } 3
75 test lsearch-2.15 {search modes without -nocase} {
76 lsearch -glob {a b c A B C} A*
77 } 3
78 test lsearch-2.16 {search modes without -nocase} {
79 lsearch -regexp {a b c A B C} ^A\$
80 } 3
81
82 test lsearch-3.1 {lsearch errors} -returnCodes error -body {
83 lsearch
84 } -result {wrong # args: should be "lsearch ?-option value ...? list pattern"}
85 test lsearch-3.2 {lsearch errors} -returnCodes error -body {
86 lsearch a
87 } -result {wrong # args: should be "lsearch ?-option value ...? list pattern"}
88 test lsearch-3.3 {lsearch errors} -returnCodes error -body {
89 lsearch a b c
90 } -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}
91 test lsearch-3.4 {lsearch errors} -returnCodes error -body {
92 lsearch a b c d
93 } -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}
94 test lsearch-3.5 {lsearch errors} -returnCodes error -body {
95 lsearch "\{" b
96 } -result {unmatched open brace in list}
97 test lsearch-3.6 {lsearch errors} -returnCodes error -body {
98 lsearch -index a b
99 } -result {"-index" option must be followed by list index}
100 test lsearch-3.7 {lsearch errors} -returnCodes error -body {
101 lsearch -subindices -exact a b
102 } -result {-subindices cannot be used without -index option}
103
104 test lsearch-4.1 {binary data} {
105 lsearch -exact [list foo one\000two bar] bar
106 } 2
107 test lsearch-4.2 {binary data} {
108 set x one
109 append x \x00
110 append x two
111 lsearch -exact [list foo one\000two bar] $x
112 } 1
113
114 # Make a sorted list
115 set l {}
116 set l2 {}
117 for {set i 0} {$i < 100} {incr i} {
118 lappend l $i
119 lappend l2 [expr {double($i)/2}]
120 }
121 set increasingIntegers [lsort -integer $l]
122 set decreasingIntegers [lsort -decreasing -integer $l]
123 set increasingDoubles [lsort -real $l2]
124 set decreasingDoubles [lsort -decreasing -real $l2]
125 set increasingStrings [lsort {48 6a 18b 22a 21aa 35 36}]
126 set decreasingStrings [lsort -decreasing {48 6a 18b 22a 21aa 35 36}]
127 set increasingDictionary [lsort -dictionary {48 6a 18b 22a 21aa 35 36}]
128 set decreasingDictionary [lsort -dictionary -decreasing $increasingDictionary]
129
130 set l {}
131 for {set i 0} {$i < 10} {incr i} {
132 lappend l $i $i $i $i $i
133 }
134 set repeatingIncreasingIntegers [lsort -integer $l]
135 set repeatingDecreasingIntegers [lsort -integer -decreasing $l]
136
137 test lsearch-5.1 {binary search} {
138 set res {}
139 for {set i 0} {$i < 100} {incr i} {
140 lappend res [lsearch -integer -sorted $increasingIntegers $i]
141 }
142 set res
143 } $increasingIntegers
144 test lsearch-5.2 {binary search} {
145 set res {}
146 for {set i 0} {$i < 100} {incr i} {
147 lappend res [lsearch -integer -decreasing -sorted \
148 $decreasingIntegers $i]
149 }
150 set res
151 } $decreasingIntegers
152 test lsearch-5.3 {binary search finds leftmost occurrences} {
153 set res {}
154 for {set i 0} {$i < 10} {incr i} {
155 lappend res [lsearch -integer -sorted $repeatingIncreasingIntegers $i]
156 }
157 set res
158 } [list 0 5 10 15 20 25 30 35 40 45]
159 test lsearch-5.4 {binary search -decreasing finds leftmost occurrences} {
160 set res {}
161 for {set i 9} {$i >= 0} {incr i -1} {
162 lappend res [lsearch -sorted -integer -decreasing \
163 $repeatingDecreasingIntegers $i]
164 }
165 set res
166 } [list 0 5 10 15 20 25 30 35 40 45]
167
168 test lsearch-6.1 {integer search} {
169 set res {}
170 for {set i 0} {$i < 100} {incr i} {
171 lappend res [lsearch -exact -integer $increasingIntegers $i]
172 }
173 set res
174 } [lrange $increasingIntegers 0 99]
175 test lsearch-6.2 {decreasing integer search} {
176 set res {}
177 for {set i 0} {$i < 100} {incr i} {
178 lappend res [lsearch -exact -integer -decreasing \
179 $decreasingIntegers $i]
180 }
181 set res
182 } [lrange $decreasingIntegers 0 99]
183 test lsearch-6.3 {sorted integer search} {
184 set res {}
185 for {set i 0} {$i < 100} {incr i} {
186 lappend res [lsearch -sorted -integer $increasingIntegers $i]
187 }
188 set res
189 } [lrange $increasingIntegers 0 99]
190 test lsearch-6.4 {sorted decreasing integer search} {
191 set res {}
192 for {set i 0} {$i < 100} {incr i} {
193 lappend res [lsearch -integer -sorted -decreasing \
194 $decreasingIntegers $i]
195 }
196 set res
197 } [lrange $decreasingIntegers 0 99]
198
199 test lsearch-7.1 {double search} {
200 set res {}
201 for {set i 0} {$i < 100} {incr i} {
202 lappend res [lsearch -exact -real $increasingDoubles \
203 [expr {double($i)/2}]]
204 }
205 set res
206 } [lrange $increasingIntegers 0 99]
207 test lsearch-7.2 {decreasing double search} {
208 set res {}
209 for {set i 0} {$i < 100} {incr i} {
210 lappend res [lsearch -exact -real -decreasing \
211 $decreasingDoubles [expr {double($i)/2}]]
212 }
213 set res
214 } [lrange $decreasingIntegers 0 99]
215 test lsearch-7.3 {sorted double search} {
216 set res {}
217 for {set i 0} {$i < 100} {incr i} {
218 lappend res [lsearch -sorted -real \
219 $increasingDoubles [expr {double($i)/2}]]
220 }
221 set res
222 } [lrange $increasingIntegers 0 99]
223 test lsearch-7.4 {sorted decreasing double search} {
224 set res {}
225 for {set i 0} {$i < 100} {incr i} {
226 lappend res [lsearch -sorted -real -decreasing \
227 $decreasingDoubles [expr {double($i)/2}]]
228 }
229 set res
230 } [lrange $decreasingIntegers 0 99]
231
232 test lsearch-8.1 {dictionary search} {
233 set res {}
234 foreach val {6a 18b 21aa 22a 35 36 48} {
235 lappend res [lsearch -exact -dictionary $increasingDictionary $val]
236 }
237 set res
238 } [list 0 1 2 3 4 5 6]
239 test lsearch-8.2 {decreasing dictionary search} {
240 set res {}
241 foreach val {6a 18b 21aa 22a 35 36 48} {
242 lappend res [lsearch -exact -dictionary $decreasingDictionary $val]
243 }
244 set res
245 } [list 6 5 4 3 2 1 0]
246 test lsearch-8.3 {sorted dictionary search} {
247 set res {}
248 foreach val {6a 18b 21aa 22a 35 36 48} {
249 lappend res [lsearch -sorted -dictionary $increasingDictionary $val]
250 }
251 set res
252 } [list 0 1 2 3 4 5 6]
253 test lsearch-8.4 {decreasing sorted dictionary search} {
254 set res {}
255 foreach val {6a 18b 21aa 22a 35 36 48} {
256 lappend res [lsearch -decreasing -sorted -dictionary \
257 $decreasingDictionary $val]
258 }
259 set res
260 } [list 6 5 4 3 2 1 0]
261
262 test lsearch-9.1 {ascii search} {
263 set res {}
264 foreach val {18b 21aa 22a 35 36 48 6a} {
265 lappend res [lsearch -exact -ascii $increasingStrings $val]
266 }
267 set res
268 } [list 0 1 2 3 4 5 6]
269 test lsearch-9.2 {decreasing ascii search} {
270 set res {}
271 foreach val {18b 21aa 22a 35 36 48 6a} {
272 lappend res [lsearch -exact -ascii $decreasingStrings $val]
273 }
274 set res
275 } [list 6 5 4 3 2 1 0]
276 test lsearch-9.3 {sorted ascii search} {
277 set res {}
278 foreach val {18b 21aa 22a 35 36 48 6a} {
279 lappend res [lsearch -sorted -ascii $increasingStrings $val]
280 }
281 set res
282 } [list 0 1 2 3 4 5 6]
283 test lsearch-9.4 {decreasing sorted ascii search} {
284 set res {}
285 foreach val {18b 21aa 22a 35 36 48 6a} {
286 lappend res [lsearch -decreasing -sorted -ascii \
287 $decreasingStrings $val]
288 }
289 set res
290 } [list 6 5 4 3 2 1 0]
291
292 test lsearch-10.1 {offset searching} {
293 lsearch -start 2 {a b c a b c} a
294 } 3
295 test lsearch-10.2 {offset searching} {
296 lsearch -start 2 {a b c d e f} a
297 } -1
298 test lsearch-10.3 {offset searching} {
299 lsearch -start end-4 {a b c a b c} a
300 } 3
301 test lsearch-10.4 {offset searching} -returnCodes error -body {
302 lsearch -start foobar {a b c a b c} a
303 } -result {bad index "foobar": must be integer?[+-]integer? or end?[+-]integer?}
304 test lsearch-10.5 {offset searching} -returnCodes error -body {
305 lsearch -start 1 2
306 } -result {missing starting index}
307 test lsearch-10.6 {binary search with offset} {
308 set res {}
309 for {set i 0} {$i < 100} {incr i} {
310 lappend res [lsearch -integer -start 2 -sorted $increasingIntegers $i]
311 }
312 set res
313 } [concat -1 -1 [lrange $increasingIntegers 2 end]]
314 test lsearch-10.7 {offset searching with an empty list} {
315 # Stop bug #694232 from reocurring
316 lsearch -start 0 {} x
317 } -1
318 test lsearch-10.8 {offset searching past the end of the list} {
319 # Stop [Bug 1374778] from reoccurring
320 lsearch -start 10 {a b c} c
321 } -1
322 test lsearch-10.9 {offset searching past the end of the list} {
323 # Stop [Bug 1374778] from reoccurring
324 lsearch -start 10 -all {a b c} c
325 } {}
326 test lsearch-10.10 {offset searching past the end of the list} {
327 # Stop [Bug 1374778] from reoccurring
328 lsearch -start 10 -inline {a b c} c
329 } {}
330
331 test lsearch-11.1 {negated searches} {
332 lsearch -not {a a a b a a a} a
333 } 3
334 test lsearch-11.2 {negated searches} {
335 lsearch -not {a a a a a a a} a
336 } -1
337
338 test lsearch-12.1 {return values instead of indices} {
339 lsearch -glob -inline {a1 b2 c3 d4} c*
340 } c3
341 test lsearch-12.2 {return values instead of indices} {
342 lsearch -glob -inline {a1 b2 c3 d4} e*
343 } {}
344
345 test lsearch-13.1 {search for all matches} {
346 lsearch -all {a b a c a d} 1
347 } {}
348 test lsearch-13.2 {search for all matches} {
349 lsearch -all {a b a c a d} a
350 } {0 2 4}
351 test lsearch-13.3 {search for all matches with -nocase} {
352 lsearch -all -exact -nocase {a b c A B C} A
353 } {0 3}
354 test lsearch-13.4 {search for all matches with -nocase} {
355 lsearch -all -glob -nocase {a b c A B C} A*
356 } {0 3}
357 test lsearch-13.5 {search for all matches with -nocase} {
358 lsearch -all -regexp -nocase {a b c A B C} ^A\$
359 } {0 3}
360
361 test lsearch-14.1 {combinations: -all and -inline} {
362 lsearch -all -inline -glob {a1 b2 a3 c4 a5 d6} a*
363 } {a1 a3 a5}
364 test lsearch-14.2 {combinations: -all, -inline and -not} {
365 lsearch -all -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
366 } {b2 c4 d6}
367 test lsearch-14.3 {combinations: -all and -not} {
368 lsearch -all -not -glob {a1 b2 a3 c4 a5 d6} a*
369 } {1 3 5}
370 test lsearch-14.4 {combinations: -inline and -not} {
371 lsearch -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
372 } {b2}
373 test lsearch-14.5 {combinations: -start, -all and -inline} {
374 lsearch -start 2 -all -inline -glob {a1 b2 a3 c4 a5 d6} a*
375 } {a3 a5}
376 test lsearch-14.6 {combinations: -start, -all, -inline and -not} {
377 lsearch -start 2 -all -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
378 } {c4 d6}
379 test lsearch-14.7 {combinations: -start, -all and -not} {
380 lsearch -start 2 -all -not -glob {a1 b2 a3 c4 a5 d6} a*
381 } {3 5}
382 test lsearch-14.8 {combinations: -start, -inline and -not} {
383 lsearch -start 2 -inline -not -glob {a1 b2 a3 c4 a5 d6} a*
384 } {c4}
385
386 test lsearch-15.1 {make sure no shimmering occurs} {
387 set x [expr {int(sin(0))}]
388 lsearch -start $x $x $x
389 } 0
390
391 test lsearch-16.1 {lsearch -regexp shared object} {
392 set str a
393 lsearch -regexp $str $str
394 } 0
395 # Bug 1366683
396 test lsearch-16.2 {lsearch -regexp allows internal backrefs} {
397 lsearch -regexp {a aa b} {(.)\1}
398 } 1
399
400 test lsearch-17.1 {lsearch -index option, basic functionality} {
401 lsearch -index 1 {{a c} {a b} {a a}} a
402 } 2
403 test lsearch-17.2 {lsearch -index option, basic functionality} {
404 lsearch -index 1 -exact {{a c} {a b} {a a}} a
405 } 2
406 test lsearch-17.3 {lsearch -index option, basic functionality} {
407 lsearch -index 1 -glob {{ab cb} {ab bb} {ab ab}} b*
408 } 1
409 test lsearch-17.4 {lsearch -index option, basic functionality} {
410 lsearch -index 1 -regexp {{ab cb} {ab bb} {ab ab}} {[cb]b}
411 } 0
412 test lsearch-17.5 {lsearch -index option, basic functionality} {
413 lsearch -all -index 0 -exact {{a c} {a b} {d a}} a
414 } {0 1}
415 test lsearch-17.6 {lsearch -index option, basic functionality} {
416 lsearch -all -index 1 -glob {{ab cb} {ab bb} {db bx}} b*
417 } {1 2}
418 test lsearch-17.7 {lsearch -index option, basic functionality} {
419 lsearch -all -index 1 -regexp {{ab cb} {ab bb} {ab ab}} {[cb]b}
420 } {0 1}
421 test lsearch-17.8 {lsearch -index option, empty argument} {
422 lsearch -index {} a a
423 } 0
424 test lsearch-17.9 {lsearch -index option, empty argument} {
425 lsearch -index {} a a
426 } [lsearch a a]
427 test lsearch-17.10 {lsearch -index option, empty argument} {
428 lsearch -index {} [list \{] \{
429 } 0
430 test lsearch-17.11 {lsearch -index option, empty argument} {
431 lsearch -index {} [list \{] \{
432 } [lsearch [list \{] \{]
433 test lsearch-17.12 {lsearch -index option, encoding aliasing} -body {
434 lsearch -index -2 a a
435 } -returnCodes error -result {index "-2" cannot select an element from any list}
436 test lsearch-17.13 {lsearch -index option, encoding aliasing} -body {
437 lsearch -index -1-1 a a
438 } -returnCodes error -result {index "-1-1" cannot select an element from any list}
439 test lsearch-17.14 {lsearch -index option, encoding aliasing} -body {
440 lsearch -index end--1 a a
441 } -returnCodes error -result {index "end--1" cannot select an element from any list}
442 test lsearch-17.15 {lsearch -index option, encoding aliasing} -body {
443 lsearch -index end+1 a a
444 } -returnCodes error -result {index "end+1" cannot select an element from any list}
445 test lsearch-17.16 {lsearch -index option, encoding aliasing} -body {
446 lsearch -index end+2 a a
447 } -returnCodes error -result {index "end+2" cannot select an element from any list}
448
449
450 test lsearch-18.1 {lsearch -index option, list as index basic functionality} {
451 lsearch -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a
452 } 1
453 test lsearch-18.2 {lsearch -index option, list as index basic functionality} {
454 lsearch -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a
455 } 0
456 test lsearch-18.3 {lsearch -index option, list as index basic functionality} {
457 lsearch -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b*
458 } 0
459 test lsearch-18.4 {lsearch -index option, list as index basic functionality} {
460 lsearch -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b}
461 } 0
462 test lsearch-18.5 {lsearch -index option, list as index basic functionality} {
463 lsearch -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a
464 } {0 1}
465
466 test lsearch-19.1 {lsearch -subindices option} {
467 lsearch -subindices -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a
468 } {1 0 0}
469 test lsearch-19.2 {lsearch -subindices option} {
470 lsearch -subindices -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a
471 } {0 2 0}
472 test lsearch-19.3 {lsearch -subindices option} {
473 lsearch -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b*
474 } {0 1 1}
475 test lsearch-19.4 {lsearch -subindices option} {
476 lsearch -subindices -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b}
477 } {0 0 1}
478 test lsearch-19.5 {lsearch -subindices option} {
479 lsearch -subindices -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a
480 } {{0 0 0} {1 0 0}}
481 test lsearch-19.7 {lsearch -subindices option} {
482 lsearch -subindices -index end {{1 a}} a
483 } {0 1}
484 test lsearch-19.8 {lsearch -subindices option} {
485 lsearch -subindices -all -index end {{1 a}} a
486 } {{0 1}}
487
488 test lsearch-20.1 {lsearch -index option, index larger than sublists} -body {
489 lsearch -index 2 {{a c} {a b} {a a}} a
490 } -returnCodes error -result {element 2 missing from sublist "a c"}
491 test lsearch-20.2 {lsearch -index option, malformed index} -body {
492 lsearch -index foo {{a c} {a b} {a a}} a
493 } -returnCodes error -result {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?}
494 test lsearch-20.3 {lsearch -index option, malformed index} -body {
495 lsearch -index \{ {{a c} {a b} {a a}} a
496 } -returnCodes error -result {unmatched open brace in list}
497
498 test lsearch-21.1 {lsearch shimmering crash} {
499 set x 0
500 lsearch -exact -integer $x $x
501 } 0
502 test lsearch-21.2 {lsearch shimmering crash} {
503 set x 0.5
504 lsearch -exact -real $x $x
505 } 0
506
507 test lsearch-22.1 {lsearch -bisect} -setup {
508 set res {}
509 } -body {
510 foreach i {0 1 5 6 7 8 15 16} {
511 lappend res [lsearch -bisect -integer {1 4 5 7 9 15} $i]
512 }
513 return $res
514 } -result {-1 0 2 2 3 3 5 5}
515 test lsearch-22.2 {lsearch -bisect, last of equals} -setup {
516 set res {}
517 } -body {
518 foreach i {0 1 2 3} {
519 lappend res [lsearch -bisect -integer {0 0 1 1 1 2 2 2 3 3 3} $i]
520 }
521 return $res
522 } -result {1 4 7 10}
523 test lsearch-22.3 {lsearch -bisect decreasing order} -setup {
524 set res {}
525 } -body {
526 foreach i {0 1 5 6 7 8 15 16} {
527 lappend res [lsearch -bisect -integer -decreasing {15 9 7 5 4 1} $i]
528 }
529 return $res
530 } -result {5 5 3 2 2 1 0 -1}
531 test lsearch-22.4 {lsearch -bisect, last of equals, decreasing} -setup {
532 set res {}
533 } -body {
534 foreach i {0 1 2 3} {
535 lappend res [lsearch -bisect -integer -decreasing \
536 {3 3 3 2 2 2 1 1 1 0 0} $i]
537 }
538 return $res
539 } -result {10 8 5 2}
540 test lsearch-22.5 {lsearch -bisect, all equal} {
541 lsearch -bisect -integer {5 5 5 5} 5
542 } {3}
543 test lsearch-22.6 {lsearch -sorted, all equal} {
544 lsearch -sorted -integer {5 5 5 5} 5
545 } {0}
546
547 # cleanup
548 catch {unset res}
549 catch {unset increasingIntegers}
550 catch {unset decreasingIntegers}
551 catch {unset increasingDoubles}
552 catch {unset decreasingDoubles}
553 catch {unset increasingStrings}
554 catch {unset decreasingStrings}
555 catch {unset increasingDictionary}
556 catch {unset decreasingDictionary}
557 ::tcltest::cleanupTests
558 return
559
560 # Local Variables:
561 # mode: tcl
562 # End: