mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Add unit test for _.sortedIndex to ensure it supports arrays with high length values.
Former-commit-id: 8956495dfa40c75dcb3c0585e78913607bf92e99
This commit is contained in:
11
test/test.js
11
test/test.js
@@ -582,6 +582,17 @@
|
|||||||
|
|
||||||
equal(actual, 0);
|
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);
|
||||||
|
});
|
||||||
}());
|
}());
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|||||||
Reference in New Issue
Block a user