@@ -33,20 +33,36 @@ const macro = (
33
33
t . is ( pos ( r ) , length , `where === ${ length } ` ) ;
34
34
35
35
// CHECK BODY
36
- for ( let i = length - 1 ; i >= 0 ; -- i ) {
36
+ for ( let i = 0 ; i < length ; ++ i ) {
37
37
r = search ( delta , a , 0 , length , a [ i ] ) ;
38
38
t . true ( found ( r ) , `found a[${ i } ]` ) ;
39
39
t . deepEqual ( a [ pos ( r ) ] , a [ i ] , `val === ${ a [ i ] } ` ) ;
40
40
}
41
41
42
+ // CHECK INNER MISS
43
+ for ( let i = 1 ; i < length ; ++ i ) {
44
+ const values = new Set ( [
45
+ arrayValue ( array , Number ( a [ i - 1 ] ) + ( delta ( - 1 , 0 ) < 0 ? 1 : - 1 ) ) ,
46
+ arrayValue ( array , ( Number ( a [ i - 1 ] ) + Number ( a [ i ] ) ) / 2 ) ,
47
+ arrayValue ( array , Number ( a [ i ] ) + ( delta ( - 1 , 0 ) < 0 ? - 1 : 1 ) ) ,
48
+ ] ) ;
49
+ for ( const v of values ) {
50
+ if ( delta ( v , a [ i - 1 ] ) <= 0 ) continue ;
51
+ if ( delta ( v , a [ i ] ) >= 0 ) continue ;
52
+ const r = search ( delta , a , 0 , length , v ) ;
53
+ t . false ( found ( r ) , `not found ${ v } ` ) ;
54
+ t . deepEqual ( pos ( r ) , i , `pos === ${ i } ` ) ;
55
+ }
56
+ }
57
+
42
58
// CHECK < OUTER BOUND
43
59
v = delta ( - 1 , 0 ) > 0 ? _max : _min ;
44
60
r = search ( delta , a , 0 , length , v ) ;
45
- t . false ( found ( r ) , ' not found -1' ) ;
61
+ t . false ( found ( r ) , ` not found ${ v } ` ) ;
46
62
t . is ( pos ( r ) , 0 , 'where === 0' ) ;
47
63
} else {
48
64
const r = search ( delta , a , 0 , length , _min ) ;
49
- t . false ( found ( r ) , ' not found -1' ) ;
65
+ t . false ( found ( r ) , ` not found ${ _min } ` ) ;
50
66
t . is ( pos ( r ) , 0 , 'where === 0' ) ;
51
67
}
52
68
0 commit comments