Add unit test for _.sortedIndex to ensure it supports arrays with high length values.

Former-commit-id: 8956495dfa40c75dcb3c0585e78913607bf92e99
This commit is contained in:
John-David Dalton
2012-06-04 16:18:23 -04:00
parent 89f9ab9940
commit 7053e9113f

View File

@@ -582,6 +582,17 @@
equal(actual, 0);
});
test('supports arrays with lengths larger than `Math.pow(2, 31) - 1`', function() {
var length = Math.pow(2, 32) - 1,
index = length - 1,
array = Array(length),
steps = 0;
array[index] = index;
_.sortedIndex(array, index, function() { steps++; });
equal(steps, 33);
});
}());
/*--------------------------------------------------------------------------*/