@@ -16,23 +16,13 @@ where
1616 let mut cache = BTreeMap :: new ( ) ;
1717 let mut predicate = |idx : usize | * cache. entry ( idx) . or_insert_with ( || predicate ( & slice[ idx] ) ) ;
1818 let mut unknown_ranges: Vec < ( usize , usize ) > = Vec :: new ( ) ;
19- let mut rm_no = 0 ; // presume that the slice starts with a no
19+ // presume that the slice starts with a no
20+ // this should be tested before call
21+ let mut rm_no = 0 ;
2022
21- eprintln ! ( "verifying the start of the range does not reproduce the regression" ) ;
22- match predicate ( rm_no) {
23- Satisfies :: No => {
24- eprintln ! ( "confirmed the start of the range does not reproduce the regression" )
25- }
26- _ => panic ! ( "the start of the range to test must not reproduce the regression" ) ,
27- }
28-
29- let mut lm_yes = slice. len ( ) - 1 ; // presume that the slice ends with a yes
30-
31- eprintln ! ( "verifying the end of the range reproduces the regression" ) ;
32- match predicate ( lm_yes) {
33- Satisfies :: Yes => eprintln ! ( "confirmed the end of the range reproduces the regression" ) ,
34- _ => panic ! ( "the end of the range to test must reproduce the regression" ) ,
35- }
23+ // presume that the slice ends with a yes
24+ // this should be tested before the call
25+ let mut lm_yes = slice. len ( ) - 1 ;
3626
3727 let mut next = ( rm_no + lm_yes) / 2 ;
3828
@@ -111,7 +101,7 @@ mod tests {
111101 #[ test]
112102 fn least_satisfying_1 ( ) {
113103 assert_eq ! (
114- least_satisfying( & [ No , Unknown , Unknown , No , Yes ] , |i| * i) ,
104+ least_satisfying( & [ No , Unknown , Unknown , No , Yes ] , |i| * i) ,
115105 4
116106 ) ;
117107 }
@@ -155,7 +145,7 @@ mod tests {
155145 #[ test]
156146 fn least_satisfying_8 ( ) {
157147 assert_eq ! (
158- least_satisfying( & [ No , Unknown , No , No , Unknown , Yes , Yes ] , |i| * i) ,
148+ least_satisfying( & [ No , Unknown , No , No , Unknown , Yes , Yes ] , |i| * i) ,
159149 5
160150 ) ;
161151 }
0 commit comments