mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 10:07:48 +00:00
Add more large array tests for sortedIndex methods.
This commit is contained in:
16
test/test.js
16
test/test.js
@@ -11146,21 +11146,25 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', 4, function() {
|
test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', 12, function() {
|
||||||
_.each([Math.ceil(MAX_ARRAY_LENGTH / 2), MAX_ARRAY_LENGTH], function(length, index) {
|
_.each([Math.ceil(MAX_ARRAY_LENGTH / 2), MAX_ARRAY_LENGTH], function(length, index) {
|
||||||
var array = [],
|
var array = [],
|
||||||
steps = 0;
|
values = [MAX_ARRAY_LENGTH, NaN, undefined];
|
||||||
|
|
||||||
array.length = length;
|
array.length = length;
|
||||||
|
|
||||||
// Avoid false fails in older Firefox.
|
// Avoid false fails in older Firefox.
|
||||||
if (array.length == length) {
|
if (array.length == length) {
|
||||||
var actual = func(array, undefined, function() { steps++; });
|
_.each(values, function(value) {
|
||||||
strictEqual(steps, isSortedIndex ? 33 : (32 + index));
|
var steps = 0,
|
||||||
strictEqual(actual, isSortedIndex ? 0 : Math.min(length, MAX_ARRAY_INDEX));
|
actual = func(array, value, function() { steps++; });
|
||||||
|
|
||||||
|
strictEqual(steps, isSortedIndex ? 33 : (32 + index));
|
||||||
|
strictEqual(actual, isSortedIndex ? 0 : Math.min(length, MAX_ARRAY_INDEX));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
skipTest(2);
|
skipTest(6);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user