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