2016-10-13 20:24:47 +00:00
|
|
|
Before:
|
|
|
|
let g:loclist = [
|
|
|
|
\ {'lnum': 2, 'col': 10},
|
|
|
|
\ {'lnum': 3, 'col': 2},
|
|
|
|
\ {'lnum': 3, 'col': 10},
|
|
|
|
\ {'lnum': 3, 'col': 12},
|
|
|
|
\ {'lnum': 3, 'col': 25},
|
|
|
|
\ {'lnum': 5, 'col': 4},
|
|
|
|
\ {'lnum': 5, 'col': 5},
|
|
|
|
\]
|
|
|
|
|
|
|
|
Execute (Exact column matches should be correct):
|
2016-10-14 19:34:21 +00:00
|
|
|
AssertEqual 1, ale#util#BinarySearch(g:loclist, 3, 2)
|
2016-10-13 20:24:47 +00:00
|
|
|
|
|
|
|
Execute (Off lines, there should be no match):
|
2016-10-14 19:34:21 +00:00
|
|
|
AssertEqual -1, ale#util#BinarySearch(g:loclist, 4, 2)
|
2016-10-13 20:24:47 +00:00
|
|
|
|
|
|
|
Execute (Near column matches should be taken):
|
2016-10-14 19:34:21 +00:00
|
|
|
AssertEqual 2, ale#util#BinarySearch(g:loclist, 3, 11)
|
|
|
|
AssertEqual 4, ale#util#BinarySearch(g:loclist, 3, 13)
|
2016-10-13 20:24:47 +00:00
|
|
|
|
|
|
|
Execute (Columns before should be taken when the cursor is far ahead):
|
2016-10-14 19:34:21 +00:00
|
|
|
AssertEqual 4, ale#util#BinarySearch(g:loclist, 3, 300)
|
2016-10-13 20:24:47 +00:00
|
|
|
|
|
|
|
After:
|
|
|
|
unlet g:loclist
|