diff options
Diffstat (limited to 'tests/lsearch.test')
| -rw-r--r-- | tests/lsearch.test | 367 |
1 files changed, 70 insertions, 297 deletions
diff --git a/tests/lsearch.test b/tests/lsearch.test index c913e60..36bf389 100644 --- a/tests/lsearch.test +++ b/tests/lsearch.test @@ -1,21 +1,21 @@ # Commands covered: lsearch # -# This file contains a collection of tests for one or more of the Tcl built-in -# commands. Sourcing this file into Tcl runs the tests and generates output -# for errors. No output means no errors were found. +# This file contains a collection of tests for one or more of the Tcl +# built-in commands. Sourcing this file into Tcl runs the tests and +# generates output for errors. No output means no errors were found. # -# Copyright © 1991-1993 The Regents of the University of California. -# Copyright © 1994 Sun Microsystems, Inc. -# Copyright © 1998-1999 Scriptics Corporation. +# Copyright (c) 1991-1993 The Regents of the University of California. +# Copyright (c) 1994 Sun Microsystems, Inc. +# Copyright (c) 1998-1999 by Scriptics Corporation. # -# See the file "license.terms" for information on usage and redistribution of -# this file, and for a DISCLAIMER OF ALL WARRANTIES. +# See the file "license.terms" for information on usage and redistribution +# of this file, and for a DISCLAIMER OF ALL WARRANTIES. -if {"::tcltest" ni [namespace children]} { - package require tcltest 2.5 +if {[lsearch [namespace children] ::tcltest] == -1} { + package require tcltest namespace import -force ::tcltest::* } - + set x {abcd bbcd 123 234 345} test lsearch-1.1 {lsearch command} { lsearch $x 123 @@ -45,9 +45,9 @@ test lsearch-2.4 {search modes} { test lsearch-2.5 {search modes} { lsearch -exact {foo bar cat} bar } 1 -test lsearch-2.6 {search modes} -returnCodes error -body { - lsearch -regexp {xyz bbcc *bc*} *bc* -} -result {couldn't compile regular expression pattern: quantifier operand invalid} +test lsearch-2.6 {search modes} { + list [catch {lsearch -regexp {xyz bbcc *bc*} *bc*} msg] $msg +} {1 {couldn't compile regular expression pattern: quantifier operand invalid}} test lsearch-2.7 {search modes} { lsearch -regexp {b.x ^bc xy bcx} ^bc } 3 @@ -57,9 +57,9 @@ test lsearch-2.8 {search modes} { test lsearch-2.9 {search modes} { lsearch -glob {b.x ^bc xy bcx} ^bc } 1 -test lsearch-2.10 {search modes} -returnCodes error -body { - lsearch -glib {b.x bx xy bcx} b.x -} -result {bad option "-glib": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} +test lsearch-2.10 {search modes} { + list [catch {lsearch -glib {b.x bx xy bcx} b.x} msg] $msg +} {1 {bad option "-glib": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}} test lsearch-2.11 {search modes with -nocase} { lsearch -exact -nocase {a b c A B C} A } 0 @@ -79,36 +79,36 @@ test lsearch-2.16 {search modes without -nocase} { lsearch -regexp {a b c A B C} ^A\$ } 3 -test lsearch-3.1 {lsearch errors} -returnCodes error -body { - lsearch -} -result {wrong # args: should be "lsearch ?-option value ...? list pattern"} -test lsearch-3.2 {lsearch errors} -returnCodes error -body { - lsearch a -} -result {wrong # args: should be "lsearch ?-option value ...? list pattern"} -test lsearch-3.3 {lsearch errors} -returnCodes error -body { - lsearch a b c -} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} -test lsearch-3.4 {lsearch errors} -returnCodes error -body { - lsearch a b c d -} -result {bad option "a": must be -all, -ascii, -bisect, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, -stride, or -subindices} -test lsearch-3.5 {lsearch errors} -returnCodes error -body { - lsearch "\{" b -} -result {unmatched open brace in list} -test lsearch-3.6 {lsearch errors} -returnCodes error -body { - lsearch -index a b -} -result {"-index" option must be followed by list index} -test lsearch-3.7 {lsearch errors} -returnCodes error -body { - lsearch -subindices -exact a b -} -result {-subindices cannot be used without -index option} +test lsearch-3.1 {lsearch errors} { + list [catch lsearch msg] $msg +} {1 {wrong # args: should be "lsearch ?options? list pattern"}} +test lsearch-3.2 {lsearch errors} { + list [catch {lsearch a} msg] $msg +} {1 {wrong # args: should be "lsearch ?options? list pattern"}} +test lsearch-3.3 {lsearch errors} { + list [catch {lsearch a b c} msg] $msg +} {1 {bad option "a": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}} +test lsearch-3.4 {lsearch errors} { + list [catch {lsearch a b c d} msg] $msg +} {1 {bad option "a": must be -all, -ascii, -decreasing, -dictionary, -exact, -glob, -increasing, -index, -inline, -integer, -nocase, -not, -real, -regexp, -sorted, -start, or -subindices}} +test lsearch-3.5 {lsearch errors} { + list [catch {lsearch "\{" b} msg] $msg +} {1 {unmatched open brace in list}} +test lsearch-3.6 {lsearch errors} { + list [catch {lsearch -index a b} msg] $msg +} {1 {"-index" option must be followed by list index}} +test lsearch-3.7 {lsearch errors} { + list [catch {lsearch -subindices -exact a b} msg] $msg +} {1 {-subindices cannot be used without -index option}} test lsearch-4.1 {binary data} { - lsearch -exact [list foo one\x00two bar] bar + lsearch -exact [list foo one\000two bar] bar } 2 test lsearch-4.2 {binary data} { set x one append x \x00 append x two - lsearch -exact [list foo one\x00two bar] $x + lsearch -exact [list foo one\000two bar] $x } 1 # Make a sorted list @@ -149,14 +149,14 @@ test lsearch-5.2 {binary search} { } set res } $decreasingIntegers -test lsearch-5.3 {binary search finds leftmost occurrences} { +test lsearch-5.3 {binary search finds leftmost occurances} { set res {} for {set i 0} {$i < 10} {incr i} { lappend res [lsearch -integer -sorted $repeatingIncreasingIntegers $i] } set res } [list 0 5 10 15 20 25 30 35 40 45] -test lsearch-5.4 {binary search -decreasing finds leftmost occurrences} { +test lsearch-5.4 {binary search -decreasing finds leftmost occurances} { set res {} for {set i 9} {$i >= 0} {incr i -1} { lappend res [lsearch -sorted -integer -decreasing \ @@ -298,12 +298,12 @@ test lsearch-10.2 {offset searching} { test lsearch-10.3 {offset searching} { lsearch -start end-4 {a b c a b c} a } 3 -test lsearch-10.4 {offset searching} -returnCodes error -body { - lsearch -start foobar {a b c a b c} a -} -result {bad index "foobar": must be integer?[+-]integer? or end?[+-]integer?} -test lsearch-10.5 {offset searching} -returnCodes error -body { - lsearch -start 1 2 -} -result {missing starting index} +test lsearch-10.4 {offset searching} { + list [catch {lsearch -start foobar {a b c a b c} a} msg] $msg +} {1 {bad index "foobar": must be integer?[+-]integer? or end?[+-]integer?}} +test lsearch-10.5 {offset searching} { + list [catch {lsearch -start 1 2} msg] $msg +} {1 {missing starting index}} test lsearch-10.6 {binary search with offset} { set res {} for {set i 0} {$i < 100} {incr i} { @@ -384,7 +384,7 @@ test lsearch-14.8 {combinations: -start, -inline and -not} { } {c4} test lsearch-15.1 {make sure no shimmering occurs} { - set x [expr {int(sin(0))}] + set x [expr int(sin(0))] lsearch -start $x $x $x } 0 @@ -404,48 +404,20 @@ test lsearch-17.2 {lsearch -index option, basic functionality} { lsearch -index 1 -exact {{a c} {a b} {a a}} a } 2 test lsearch-17.3 {lsearch -index option, basic functionality} { - lsearch -index 1 -glob {{ab cb} {ab bb} {ab ab}} b* + lsearch -index 1 -glob {{ab cb} {ab bb} {ab ab}} b* } 1 test lsearch-17.4 {lsearch -index option, basic functionality} { lsearch -index 1 -regexp {{ab cb} {ab bb} {ab ab}} {[cb]b} -} 0 +} 0 test lsearch-17.5 {lsearch -index option, basic functionality} { lsearch -all -index 0 -exact {{a c} {a b} {d a}} a } {0 1} test lsearch-17.6 {lsearch -index option, basic functionality} { - lsearch -all -index 1 -glob {{ab cb} {ab bb} {db bx}} b* + lsearch -all -index 1 -glob {{ab cb} {ab bb} {db bx}} b* } {1 2} test lsearch-17.7 {lsearch -index option, basic functionality} { lsearch -all -index 1 -regexp {{ab cb} {ab bb} {ab ab}} {[cb]b} } {0 1} -test lsearch-17.8 {lsearch -index option, empty argument} { - lsearch -index {} a a -} 0 -test lsearch-17.9 {lsearch -index option, empty argument} { - lsearch -index {} a a -} [lsearch a a] -test lsearch-17.10 {lsearch -index option, empty argument} { - lsearch -index {} [list \{] \{ -} 0 -test lsearch-17.11 {lsearch -index option, empty argument} { - lsearch -index {} [list \{] \{ -} [lsearch [list \{] \{] -test lsearch-17.12 {lsearch -index option, encoding aliasing} -body { - lsearch -index -2 a a -} -returnCodes error -result {index "-2" out of range} -test lsearch-17.13 {lsearch -index option, encoding aliasing} -body { - lsearch -index -1-1 a a -} -returnCodes error -result {index "-1-1" out of range} -test lsearch-17.14 {lsearch -index option, encoding aliasing} -body { - lsearch -index end--1 a a -} -returnCodes error -result {index "end--1" out of range} -test lsearch-17.15 {lsearch -index option, encoding aliasing} -body { - lsearch -index end+1 a a -} -returnCodes error -result {index "end+1" out of range} -test lsearch-17.16 {lsearch -index option, encoding aliasing} -body { - lsearch -index end+2 a a -} -returnCodes error -result {index "end+2" out of range} - test lsearch-18.1 {lsearch -index option, list as index basic functionality} { lsearch -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a @@ -454,49 +426,40 @@ test lsearch-18.2 {lsearch -index option, list as index basic functionality} { lsearch -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a } 0 test lsearch-18.3 {lsearch -index option, list as index basic functionality} { - lsearch -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* + lsearch -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* } 0 test lsearch-18.4 {lsearch -index option, list as index basic functionality} { lsearch -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b} -} 0 +} 0 test lsearch-18.5 {lsearch -index option, list as index basic functionality} { lsearch -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a } {0 1} -test lsearch-19.1 {lsearch -subindices option} { +test lsearch-19.1 {lsearch -sunindices option} { lsearch -subindices -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a } {1 0 0} -test lsearch-19.2 {lsearch -subindices option} { +test lsearch-19.2 {lsearch -sunindices option} { lsearch -subindices -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a } {0 2 0} -test lsearch-19.3 {lsearch -subindices option} { - lsearch -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* +test lsearch-19.3 {lsearch -sunindices option} { + lsearch -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* } {0 1 1} -test lsearch-19.4 {lsearch -subindices option} { +test lsearch-19.4 {lsearch -sunindices option} { lsearch -subindices -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b} -} {0 0 1} -test lsearch-19.5 {lsearch -subindices option} { +} {0 0 1} +test lsearch-19.5 {lsearch -sunindices option} { lsearch -subindices -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a } {{0 0 0} {1 0 0}} -test lsearch-19.6 {lsearch -subindices option} { - lsearch -subindices -all -index {1 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a -} {{0 1 0} {1 1 0}} -test lsearch-19.7 {lsearch -subindices option} { - lsearch -subindices -index end {{1 a}} a -} {0 1} -test lsearch-19.8 {lsearch -subindices option} { - lsearch -subindices -all -index end {{1 a}} a -} {{0 1}} -test lsearch-20.1 {lsearch -index option, index larger than sublists} -body { - lsearch -index 2 {{a c} {a b} {a a}} a -} -returnCodes error -result {element 2 missing from sublist "a c"} -test lsearch-20.2 {lsearch -index option, malformed index} -body { - lsearch -index foo {{a c} {a b} {a a}} a -} -returnCodes error -result {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?} -test lsearch-20.3 {lsearch -index option, malformed index} -body { - lsearch -index \{ {{a c} {a b} {a a}} a -} -returnCodes error -result {unmatched open brace in list} +test lsearch-20.1 {lsearch -index option, index larger than sublists} { + list [catch {lsearch -index 2 {{a c} {a b} {a a}} a} msg] $msg +} {1 {element 2 missing from sublist "a c"}} +test lsearch-20.2 {lsearch -index option, malformed index} { + list [catch {lsearch -index foo {{a c} {a b} {a a}} a} msg] $msg +} {1 {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?}} +test lsearch-20.3 {lsearch -index option, malformed index} { + list [catch {lsearch -index \{ {{a c} {a b} {a a}} a} msg] $msg +} {1 {unmatched open brace in list}} test lsearch-21.1 {lsearch shimmering crash} { set x 0 @@ -507,192 +470,6 @@ test lsearch-21.2 {lsearch shimmering crash} { lsearch -exact -real $x $x } 0 -test lsearch-22.1 {lsearch -bisect} -setup { - set res {} -} -body { - foreach i {0 1 5 6 7 8 15 16} { - lappend res [lsearch -bisect -integer {1 4 5 7 9 15} $i] - } - return $res -} -result {-1 0 2 2 3 3 5 5} -test lsearch-22.2 {lsearch -bisect, last of equals} -setup { - set res {} -} -body { - foreach i {0 1 2 3} { - lappend res [lsearch -bisect -integer {0 0 1 1 1 2 2 2 3 3 3} $i] - } - return $res -} -result {1 4 7 10} -test lsearch-22.3 {lsearch -bisect decreasing order} -setup { - set res {} -} -body { - foreach i {0 1 5 6 7 8 15 16} { - lappend res [lsearch -bisect -integer -decreasing {15 9 7 5 4 1} $i] - } - return $res -} -result {5 5 3 2 2 1 0 -1} -test lsearch-22.4 {lsearch -bisect, last of equals, decreasing} -setup { - set res {} -} -body { - foreach i {0 1 2 3} { - lappend res [lsearch -bisect -integer -decreasing \ - {3 3 3 2 2 2 1 1 1 0 0} $i] - } - return $res -} -result {10 8 5 2} -test lsearch-22.5 {lsearch -bisect, all equal} { - lsearch -bisect -integer {5 5 5 5} 5 -} {3} -test lsearch-22.6 {lsearch -sorted, all equal} { - lsearch -sorted -integer {5 5 5 5} 5 -} {0} - -test lsearch-23.1 {lsearch -stride option, errors} -body { - lsearch -stride {a b} a -} -returnCodes error -result {"-stride" option must be followed by stride length} -test lsearch-23.2 {lsearch -stride option, errors} -body { - lsearch -stride 0 {a b} a -} -returnCodes error -match glob -result {stride length must be between 1 and *} -test lsearch-23.3 {lsearch -stride option, errors} -body { - lsearch -stride 2 {a b c} a -} -returnCodes error -result {list size must be a multiple of the stride length} -test lsearch-23.4 {lsearch -stride option, errors} -body { - lsearch -stride 5 {a b c} a -} -returnCodes error -result {list size must be a multiple of the stride length} -test lsearch-23.5 {lsearch -stride option, errors} -body { - # Stride equal to length is ok - lsearch -stride 3 {a b c} a -} -result 0 - -test lsearch-24.1 {lsearch -stride option} -body { - lsearch -stride 2 {a b c d e f g h} d -} -result -1 -test lsearch-24.2 {lsearch -stride option} -body { - lsearch -stride 2 {a b c d e f g h} e -} -result 4 -test lsearch-24.3 {lsearch -stride option} -body { - lsearch -stride 3 {a b c d e f g h i} e -} -result -1 -test lsearch-24.4 {lsearch -stride option} -body { - # Result points first in group - lsearch -stride 3 -index 1 {a b c d e f g h i} e -} -result 3 -test lsearch-24.5 {lsearch -stride option} -body { - lsearch -inline -stride 2 {a b c d e f g h} d -} -result {} -test lsearch-24.6 {lsearch -stride option} -body { - # Inline result is a "single element" strided list - lsearch -inline -stride 2 {a b c d e f g h} e -} -result "e f" -test lsearch-24.7 {lsearch -stride option} -body { - lsearch -inline -stride 3 {a b c d e f g h i} e -} -result {} -test lsearch-24.8 {lsearch -stride option} -body { - lsearch -inline -stride 3 -index 1 {a b c d e f g h i} e -} -result "d e f" -test lsearch-24.9 {lsearch -stride option} -body { - lsearch -all -inline -stride 3 -index 1 {a b c d e f g e i} e -} -result "d e f g e i" -test lsearch-24.10 {lsearch -stride option} -body { - lsearch -all -inline -stride 3 -index 0 {a b c d e f a e i} a -} -result "a b c a e i" -test lsearch-24.11 {lsearch -stride option} -body { - # Stride 1 is same as no stride - lsearch -stride 1 {a b c d e f g h} d -} -result 3 - -# 25* mimics 19* but with -inline added to -subindices -test lsearch-25.1 {lsearch -subindices option} { - lsearch -inline -subindices -index {0 0} {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a -} {a} -test lsearch-25.2 {lsearch -subindices option} { - lsearch -inline -subindices -index {2 0} -exact {{{x x} {x b} {a d}} {{a c} {a b} {a a}}} a -} {a} -test lsearch-25.3 {lsearch -subindices option} { - lsearch -inline -subindices -index {1 1} -glob {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} b* -} {bb} -test lsearch-25.4 {lsearch -subindices option} { - lsearch -inline -subindices -index {0 1} -regexp {{{ab cb} {ab bb} {ab ab}} {{ab cb} {ab bb} {ab ab}}} {[cb]b} -} {cb} -test lsearch-25.5 {lsearch -subindices option} { - lsearch -inline -subindices -all -index {0 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a -} {a a} -test lsearch-25.6 {lsearch -subindices option} { - lsearch -inline -subindices -all -index {1 0} -exact {{{a c} {a b} {d a}} {{a c} {a b} {d a}}} a -} {a a} - -# 26* mimics 19* but with -stride added -test lsearch-26.1 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -index {0 0} {{x x} {x b} {a d} {a c} {a b} {a a}} a -} {3 0} -test lsearch-26.2 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -index {2 0} -exact {{x x} {x b} {a d} {a c} {a b} {a a}} a -} {2 0} -test lsearch-26.3 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -index {1 1} -glob {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} b* -} {1 1} -test lsearch-26.4 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -index {0 1} -regexp {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} {[cb]b} -} {0 1} -test lsearch-26.5 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -all -index {0 0} -exact {{a c} {a b} {d a} {a c} {a b} {d a}} a -} {{0 0} {3 0}} -test lsearch-26.6 {lsearch -stride + -subindices option} { - lsearch -stride 3 -subindices -all -index {1 0} -exact {{a c} {a b} {d a} {x c} {a b} {d a}} a -} {{1 0} {4 0}} - -# 27* mimics 25* but with -stride added -test lsearch-27.1 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -index {0 0} {{x x} {x b} {a d} {a c} {a b} {a a}} a -} {a} -test lsearch-27.2 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -index {2 0} -exact {{x x} {x b} {a d} {a c} {a b} {a a}} a -} {a} -test lsearch-27.3 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -index {1 1} -glob {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} b* -} {bb} -test lsearch-27.4 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -index {0 1} -regexp {{ab cb} {ab bb} {ab ab} {ab cb} {ab bb} {ab ab}} {[cb]b} -} {cb} -test lsearch-27.5 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -all -index {0 0} -exact {{a c} {a b} {d a} {a c} {a b} {d a}} a -} {a a} -test lsearch-27.6 {lsearch -stride + -subindices option} { - lsearch -inline -stride 3 -subindices -all -index {1 0} -exact {{a c} {a b} {d a} {x c} {a b} {d a}} a -} {a a} - -test lsearch-28.1 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 5 -} -result 0 -test lsearch-28.2 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 3 -} -result -1 -test lsearch-28.3 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 7 -} -result 2 -test lsearch-28.4 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 8 -} -result -1 -test lsearch-28.5 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 9 -} -result 4 -test lsearch-28.6 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 {5 3 7 8 9 2} 2 -} -result -1 -test lsearch-28.7 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 -index 0 -subindices {5 3 7 8 9 2} 9 -} -result 4 -test lsearch-28.8 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 -index 1 -subindices {3 5 8 7 2 9} 9 -} -result 5 -test lsearch-28.9 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9 -} -result 9 -test lsearch-28.10 {lsearch -sorted with -stride} -body { - lsearch -sorted -stride 4294967296 -index 1 -subindices -inline {3 5 8 7 2 9} 9 -} -returnCodes 1 -match glob -result {stride length must be between 1 and *} - - # cleanup catch {unset res} catch {unset increasingIntegers} @@ -705,7 +482,3 @@ catch {unset increasingDictionary} catch {unset decreasingDictionary} ::tcltest::cleanupTests return - -# Local Variables: -# mode: tcl -# End: |
