Cleanup _.max and _.min unit tests.

Former-commit-id: 5bfdd6d441f20879f3352f260b9b08e714c7b836
This commit is contained in:
John-David Dalton
2012-05-10 01:48:20 -04:00
parent 90989a816d
commit 04a05b4c02

View File

@@ -246,24 +246,25 @@
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/
(function() {
var i = -1,
largeArray = [];
while (++i <= 1e6) {
largeArray[i] = i;
}
_.each(['max', 'min'], function(methodName) { _.each(['max', 'min'], function(methodName) {
QUnit.module('lodash.' + methodName); QUnit.module('lodash.' + methodName);
test('does not error when computing the ' + methodName + ' value of massive arrays', function() { test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
var actual,
array = [],
i = -1;
while (++i <= 1e6) {
array[i] = i;
}
try { try {
actual = _[methodName](array); var actual = _[methodName](largeArray);
} catch(e) { } } catch(e) { }
equal(actual, methodName == 'max' ? 1e6 : 0); equal(actual, methodName == 'max' ? 1e6 : 0);
}); });
}); });
}());
/*--------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------*/