Add tests for large arrays and NaN values.

This commit is contained in:
John-David Dalton
2014-08-10 10:21:36 -07:00
parent c849fe1496
commit 0deacc7229

View File

@@ -2886,6 +2886,11 @@
deepEqual(_.difference([object1, object2], largeArray), [object2]);
});
test('should work with large arrays of `NaN`', 1, function() {
var largeArray = _.times(LARGE_ARRAY_SIZE, _.constant(NaN));
deepEqual(_.difference([1, NaN, 3], largeArray), [1, 3]);
});
test('should ignore values that are not arrays or `arguments` objects', 3, function() {
var array = [0, 1, null, 3];
deepEqual(_.difference(array, 3, null, { '0': 1 }), array);
@@ -4820,6 +4825,11 @@
deepEqual(_.intersection(_.range(LARGE_ARRAY_SIZE), null, [1]), [1]);
});
test('should work with large arrays of `NaN`', 1, function() {
var largeArray = _.times(LARGE_ARRAY_SIZE, _.constant(NaN));
deepEqual(_.intersection([1, NaN, 3], largeArray), [NaN]);
});
test('should ignore values that are not arrays or `arguments` objects', 3, function() {
var array = [0, 1, null, 3];
deepEqual(_.intersection(array, 3, null, { '0': 1 }), array);
@@ -11119,9 +11129,9 @@
deepEqual(_.uniq(largeArray), [0, 'a', object]);
});
test('should work with large arrays of boolean, `null`, and `undefined` values', 1, function() {
test('should work with large arrays of boolean, `NaN`, `null`, and `undefined` values', 1, function() {
var array = [],
expected = [true, false, null, undefined],
expected = [true, false, NaN, null, undefined],
count = Math.ceil(LARGE_ARRAY_SIZE / expected.length);
_.times(count, function() {