Skip to content

Commit

Permalink
Add unit test for _.sortedIndex to ensure it supports arrays with h…
Browse files Browse the repository at this point in the history
…igh `length` values.
  • Loading branch information
jdalton committed Jun 4, 2012
1 parent c5bf234 commit c07e156
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/test.js
Expand Up @@ -582,6 +582,17 @@

equal(actual, 0);
});

test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', function() {
var length = Math.pow(2, 32) - 1,
index = length - 1,
array = Array(length),
steps = 0;

array[index] = index;
_.sortedIndex(array, index, function() { steps++; });
equal(steps, 33);
});
}());

/*--------------------------------------------------------------------------*/
Expand Down

0 comments on commit c07e156

Please sign in to comment.