mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-02 08:07:50 +00:00
Cleanup _.max and _.min unit tests.
Former-commit-id: 5bfdd6d441f20879f3352f260b9b08e714c7b836
This commit is contained in:
29
test/test.js
29
test/test.js
@@ -246,24 +246,25 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
_.each(['max', 'min'], function(methodName) {
|
||||
QUnit.module('lodash.' + methodName);
|
||||
(function() {
|
||||
var i = -1,
|
||||
largeArray = [];
|
||||
|
||||
test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
|
||||
var actual,
|
||||
array = [],
|
||||
i = -1;
|
||||
while (++i <= 1e6) {
|
||||
largeArray[i] = i;
|
||||
}
|
||||
_.each(['max', 'min'], function(methodName) {
|
||||
QUnit.module('lodash.' + methodName);
|
||||
|
||||
while (++i <= 1e6) {
|
||||
array[i] = i;
|
||||
}
|
||||
try {
|
||||
actual = _[methodName](array);
|
||||
} catch(e) { }
|
||||
test('does not error when computing the ' + methodName + ' value of massive arrays', function() {
|
||||
try {
|
||||
var actual = _[methodName](largeArray);
|
||||
} catch(e) { }
|
||||
|
||||
equal(actual, methodName == 'max' ? 1e6 : 0);
|
||||
equal(actual, methodName == 'max' ? 1e6 : 0);
|
||||
});
|
||||
});
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user