Always pass on a compare function to sort

This commit is contained in:
Bart van den Eijnden
2015-12-16 10:03:10 +01:00
parent dd4e88525e
commit e0be143ed5
11 changed files with 54 additions and 9 deletions

View File

@@ -2,6 +2,16 @@ goog.provide('ol.test.array');
describe('ol.array', function() {
describe('defaultCompare', function() {
it('sorts as expected', function() {
var arr = [40, 200, 3000];
var expected = [40, 200, 3000];
// default sort would yield [200, 3000, 40]
arr.sort(ol.array.defaultCompare);
expect(arr).to.eql(expected);
});
});
describe('binaryFindNearest', function() {
it('returns expected value', function() {
var arr = [1000, 500, 100];