Increase code coverage.

This commit is contained in:
John-David Dalton
2014-12-15 12:11:27 -08:00
parent 74cdaa9fcb
commit 1b8ca164c9

View File

@@ -11147,28 +11147,32 @@
}); });
test('`_.' + methodName + '` should support arrays larger than `MAX_ARRAY_LENGTH / 2`', 12, 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) {
var array = [], var array = [],
values = [MAX_ARRAY_LENGTH, NaN, undefined]; values = [MAX_ARRAY_LENGTH, NaN, undefined];
array.length = length; array.length = length;
// Avoid false fails in older Firefox.
if (array.length == length) {
_.each(values, function(value) { _.each(values, function(value) {
var steps = 0, var steps = 0,
actual = func(array, value, function() { steps++; }); actual = func(array, value, function(value) { steps++; return value; });
strictEqual(steps, isSortedIndex ? 33 : (32 + index)); var expected = (isSortedIndex ? !_.isNaN(value) : _.isFinite(value))
strictEqual(actual, isSortedIndex ? 0 : Math.min(length, MAX_ARRAY_INDEX)); ? 0
}); : Math.min(length, MAX_ARRAY_INDEX)
// Avoid false fails in older Firefox.
if (array.length == length) {
ok(steps == 32 || steps == 33);
strictEqual(actual, expected);
} }
else { else {
skipTest(6); skipTest(2);
} }
}); });
}); });
}); });
});
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/