Use eql instead of equalArray
This commit is contained in:
@@ -29,7 +29,7 @@ describe('ol.collection', function() {
|
||||
it('adds elements to the collection', function() {
|
||||
collection.push(1);
|
||||
expect(collection.getLength()).to.eql(1);
|
||||
expect(collection.getArray()).to.equalArray([1]);
|
||||
expect(collection.getArray()).to.eql([1]);
|
||||
expect(collection.getAt(0)).to.eql(1);
|
||||
});
|
||||
});
|
||||
@@ -267,7 +267,7 @@ describe('ol.collection', function() {
|
||||
it('adds elements to end of the collection', function() {
|
||||
collection.extend([1, 2]);
|
||||
expect(collection.getLength()).to.eql(2);
|
||||
expect(collection.getArray()).to.equalArray([1, 2]);
|
||||
expect(collection.getArray()).to.eql([1, 2]);
|
||||
expect(collection.getAt(0)).to.eql(1);
|
||||
expect(collection.getAt(1)).to.eql(2);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('ol.structs.Buffer', function() {
|
||||
});
|
||||
|
||||
it('constructs a populated instance', function() {
|
||||
expect(b.getArray()).to.equalArray([0, 1, 2, 3]);
|
||||
expect(b.getArray()).to.eql([0, 1, 2, 3]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -80,7 +80,7 @@ describe('ol.structs.Buffer', function() {
|
||||
|
||||
it('allows elements to be added', function() {
|
||||
expect(b.add([0, 1, 2, 3])).to.be(0);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 2, 3]);
|
||||
expect(b.getArray()).to.eql([0, 1, 2, 3]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -128,7 +128,7 @@ describe('ol.structs.Buffer', function() {
|
||||
var callback = sinon.spy();
|
||||
b.forEachRange(callback);
|
||||
expect(callback.calledOnce).to.be(true);
|
||||
expect(callback.args[0]).to.equalArray([0, 4]);
|
||||
expect(callback.args[0]).to.eql([0, 4]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -155,7 +155,7 @@ describe('ol.structs.Buffer', function() {
|
||||
|
||||
it('updates the items', function() {
|
||||
b.set([5, 6], 2);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 5, 6]);
|
||||
expect(b.getArray()).to.eql([0, 1, 5, 6]);
|
||||
});
|
||||
|
||||
it('marks the set items as dirty', function() {
|
||||
@@ -164,7 +164,7 @@ describe('ol.structs.Buffer', function() {
|
||||
expect(dirtySet.isEmpty()).to.be(true);
|
||||
b.set([5, 6], 2);
|
||||
expect(dirtySet.isEmpty()).to.be(false);
|
||||
expect(dirtySet.getArray()).to.equalArray([2, 4]);
|
||||
expect(dirtySet.getArray()).to.eql([2, 4]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -184,7 +184,7 @@ describe('ol.structs.Buffer', function() {
|
||||
|
||||
it('allows more items to be added', function() {
|
||||
expect(b.add([4, 5, 6, 7])).to.be(4);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 2, 3, 4, 5, 6, 7]);
|
||||
expect(b.getArray()).to.eql([0, 1, 2, 3, 4, 5, 6, 7]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -195,7 +195,7 @@ describe('ol.structs.Buffer', function() {
|
||||
var callback = sinon.spy();
|
||||
b.forEachRange(callback);
|
||||
expect(callback.calledOnce).to.be(true);
|
||||
expect(callback.args[0]).to.equalArray([0, 4]);
|
||||
expect(callback.args[0]).to.eql([0, 4]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -213,7 +213,7 @@ describe('ol.structs.Buffer', function() {
|
||||
it('returns the expected set', function() {
|
||||
var freeSet = b.getFreeSet();
|
||||
expect(freeSet.isEmpty()).to.be(false);
|
||||
expect(freeSet.getArray()).to.equalArray([4, 8]);
|
||||
expect(freeSet.getArray()).to.eql([4, 8]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -225,31 +225,31 @@ describe('ol.structs.Buffer', function() {
|
||||
it('allows multiple adds and removes', function() {
|
||||
var b = new ol.structs.Buffer(new Array(8), 0);
|
||||
expect(b.add([0, 1])).to.be(0);
|
||||
expect(b.getArray()).to.equalArray([0, 1, NaN, NaN, NaN, NaN, NaN, NaN]);
|
||||
expect(b.getArray()).to.eql([0, 1, NaN, NaN, NaN, NaN, NaN, NaN]);
|
||||
expect(b.getCount()).to.be(2);
|
||||
expect(b.add([2, 3, 4, 5])).to.be(2);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 2, 3, 4, 5, NaN, NaN]);
|
||||
expect(b.getArray()).to.eql([0, 1, 2, 3, 4, 5, NaN, NaN]);
|
||||
expect(b.getCount()).to.be(6);
|
||||
expect(b.add([6, 7])).to.be(6);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 2, 3, 4, 5, 6, 7]);
|
||||
expect(b.getArray()).to.eql([0, 1, 2, 3, 4, 5, 6, 7]);
|
||||
expect(b.getCount()).to.be(8);
|
||||
b.remove(2, 2);
|
||||
expect(b.getArray()).to.equalArray([0, 1, NaN, NaN, 4, 5, 6, 7]);
|
||||
expect(b.getArray()).to.eql([0, 1, NaN, NaN, 4, 5, 6, 7]);
|
||||
expect(b.getCount()).to.be(6);
|
||||
expect(b.add([8, 9])).to.be(2);
|
||||
expect(b.getArray()).to.equalArray([0, 1, 8, 9, 4, 5, 6, 7]);
|
||||
expect(b.getArray()).to.eql([0, 1, 8, 9, 4, 5, 6, 7]);
|
||||
expect(b.getCount()).to.be(8);
|
||||
b.remove(1, 1);
|
||||
expect(b.getArray()).to.equalArray([0, NaN, 8, 9, 4, 5, 6, 7]);
|
||||
expect(b.getArray()).to.eql([0, NaN, 8, 9, 4, 5, 6, 7]);
|
||||
expect(b.getCount()).to.be(7);
|
||||
b.remove(4, 4);
|
||||
expect(b.getArray()).to.equalArray([0, NaN, 8, 9, NaN, NaN, NaN, NaN]);
|
||||
expect(b.getArray()).to.eql([0, NaN, 8, 9, NaN, NaN, NaN, NaN]);
|
||||
expect(b.getCount()).to.be(3);
|
||||
expect(b.add([10, 11, 12])).to.be(4);
|
||||
expect(b.getArray()).to.equalArray([0, NaN, 8, 9, 10, 11, 12, NaN]);
|
||||
expect(b.getArray()).to.eql([0, NaN, 8, 9, 10, 11, 12, NaN]);
|
||||
expect(b.getCount()).to.be(6);
|
||||
expect(b.add([13])).to.be(1);
|
||||
expect(b.getArray()).to.equalArray([0, 13, 8, 9, 10, 11, 12, NaN]);
|
||||
expect(b.getArray()).to.eql([0, 13, 8, 9, 10, 11, 12, NaN]);
|
||||
expect(b.getCount()).to.be(7);
|
||||
});
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
it('constructs with a valid array', function() {
|
||||
var is = new ol.structs.IntegerSet([0, 2, 4, 6]);
|
||||
expect(is).to.be.an(ol.structs.IntegerSet);
|
||||
expect(is.getArray()).to.equalArray([0, 2, 4, 6]);
|
||||
expect(is.getArray()).to.eql([0, 2, 4, 6]);
|
||||
});
|
||||
|
||||
it('throws an exception with an odd number of elements', function() {
|
||||
@@ -50,7 +50,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
|
||||
it('creates a new element', function() {
|
||||
is.addRange(0, 2);
|
||||
expect(is.getArray()).to.equalArray([0, 2]);
|
||||
expect(is.getArray()).to.eql([0, 2]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -79,7 +79,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
var callback = sinon.spy();
|
||||
is.forEachRangeInverted(0, 8, callback);
|
||||
expect(callback.calledOnce).to.be(true);
|
||||
expect(callback.args[0]).to.equalArray([0, 8]);
|
||||
expect(callback.args[0]).to.eql([0, 8]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -145,52 +145,52 @@ describe('ol.structs.IntegerSet', function() {
|
||||
|
||||
it('inserts before the first element', function() {
|
||||
is.addRange(0, 2);
|
||||
expect(is.getArray()).to.equalArray([0, 2, 4, 6, 8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([0, 2, 4, 6, 8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('extends the first element to the left', function() {
|
||||
is.addRange(0, 4);
|
||||
expect(is.getArray()).to.equalArray([0, 6, 8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([0, 6, 8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('extends the first element to the right', function() {
|
||||
is.addRange(6, 7);
|
||||
expect(is.getArray()).to.equalArray([4, 7, 8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 7, 8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('merges the first two elements', function() {
|
||||
is.addRange(6, 8);
|
||||
expect(is.getArray()).to.equalArray([4, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('extends middle elements to the left', function() {
|
||||
is.addRange(7, 8);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 7, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 7, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('extends middle elements to the right', function() {
|
||||
is.addRange(10, 11);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 11, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 11, 12, 14]);
|
||||
});
|
||||
|
||||
it('merges the last two elements', function() {
|
||||
is.addRange(10, 12);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 14]);
|
||||
});
|
||||
|
||||
it('extends the last element to the left', function() {
|
||||
is.addRange(11, 12);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10, 11, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10, 11, 14]);
|
||||
});
|
||||
|
||||
it('extends the last element to the right', function() {
|
||||
is.addRange(14, 15);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10, 12, 15]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10, 12, 15]);
|
||||
});
|
||||
|
||||
it('inserts after the last element', function() {
|
||||
is.addRange(16, 18);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10, 12, 14, 16, 18]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10, 12, 14, 16, 18]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -239,9 +239,9 @@ describe('ol.structs.IntegerSet', function() {
|
||||
is.forEachRange(callback);
|
||||
expect(callback).to.be.called();
|
||||
expect(callback.calledThrice).to.be(true);
|
||||
expect(callback.args[0]).to.equalArray([4, 6]);
|
||||
expect(callback.args[1]).to.equalArray([8, 10]);
|
||||
expect(callback.args[2]).to.equalArray([12, 14]);
|
||||
expect(callback.args[0]).to.eql([4, 6]);
|
||||
expect(callback.args[1]).to.eql([8, 10]);
|
||||
expect(callback.args[2]).to.eql([12, 14]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -252,10 +252,10 @@ describe('ol.structs.IntegerSet', function() {
|
||||
var callback = sinon.spy();
|
||||
is.forEachRangeInverted(0, 16, callback);
|
||||
expect(callback.callCount).to.be(4);
|
||||
expect(callback.args[0]).to.equalArray([0, 4]);
|
||||
expect(callback.args[1]).to.equalArray([6, 8]);
|
||||
expect(callback.args[2]).to.equalArray([10, 12]);
|
||||
expect(callback.args[3]).to.equalArray([14, 16]);
|
||||
expect(callback.args[0]).to.eql([0, 4]);
|
||||
expect(callback.args[1]).to.eql([6, 8]);
|
||||
expect(callback.args[2]).to.eql([10, 12]);
|
||||
expect(callback.args[3]).to.eql([14, 16]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -334,57 +334,57 @@ describe('ol.structs.IntegerSet', function() {
|
||||
|
||||
it('removes the first part of the first element', function() {
|
||||
is.removeRange(4, 5);
|
||||
expect(is.getArray()).to.equalArray([5, 6, 8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([5, 6, 8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes the last part of the first element', function() {
|
||||
is.removeRange(5, 6);
|
||||
expect(is.getArray()).to.equalArray([4, 5, 8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 5, 8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes the first element', function() {
|
||||
is.removeRange(4, 6);
|
||||
expect(is.getArray()).to.equalArray([8, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([8, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes the first part of a middle element', function() {
|
||||
is.removeRange(8, 9);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 9, 10, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 9, 10, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes the last part of a middle element', function() {
|
||||
is.removeRange(9, 10);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 9, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 9, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes a middle element', function() {
|
||||
is.removeRange(8, 10);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 12, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 12, 14]);
|
||||
});
|
||||
|
||||
it('removes the first part of the last element', function() {
|
||||
is.removeRange(12, 13);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10, 13, 14]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10, 13, 14]);
|
||||
});
|
||||
|
||||
it('removes the last part of the last element', function() {
|
||||
is.removeRange(13, 14);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10, 12, 13]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10, 12, 13]);
|
||||
});
|
||||
|
||||
it('removes the last element', function() {
|
||||
is.removeRange(12, 14);
|
||||
expect(is.getArray()).to.equalArray([4, 6, 8, 10]);
|
||||
expect(is.getArray()).to.eql([4, 6, 8, 10]);
|
||||
});
|
||||
|
||||
it('can remove multiple ranges near the start', function() {
|
||||
is.removeRange(3, 11);
|
||||
expect(is.getArray()).to.equalArray([12, 14]);
|
||||
expect(is.getArray()).to.eql([12, 14]);
|
||||
});
|
||||
|
||||
it('can remove multiple ranges near the start', function() {
|
||||
is.removeRange(7, 15);
|
||||
expect(is.getArray()).to.equalArray([4, 6]);
|
||||
expect(is.getArray()).to.eql([4, 6]);
|
||||
});
|
||||
|
||||
it('throws an exception when passed an invalid range', function() {
|
||||
@@ -459,29 +459,29 @@ describe('ol.structs.IntegerSet', function() {
|
||||
|
||||
it('removing an empty range has no effect', function() {
|
||||
is.removeRange(0, 0);
|
||||
expect(is.getArray()).to.equalArray(
|
||||
expect(is.getArray()).to.eql(
|
||||
[0, 1, 2, 4, 5, 8, 9, 12, 13, 15, 16, 17]);
|
||||
});
|
||||
|
||||
it('can remove elements from the middle of range', function() {
|
||||
is.removeRange(6, 7);
|
||||
expect(is.getArray()).to.equalArray(
|
||||
expect(is.getArray()).to.eql(
|
||||
[0, 1, 2, 4, 5, 6, 7, 8, 9, 12, 13, 15, 16, 17]);
|
||||
});
|
||||
|
||||
it('can remove multiple ranges', function() {
|
||||
is.removeRange(2, 12);
|
||||
expect(is.getArray()).to.equalArray([0, 1, 13, 15, 16, 17]);
|
||||
expect(is.getArray()).to.eql([0, 1, 13, 15, 16, 17]);
|
||||
});
|
||||
|
||||
it('can remove multiple ranges and reduce others', function() {
|
||||
is.removeRange(0, 10);
|
||||
expect(is.getArray()).to.equalArray([10, 12, 13, 15, 16, 17]);
|
||||
expect(is.getArray()).to.eql([10, 12, 13, 15, 16, 17]);
|
||||
});
|
||||
|
||||
it('can remove all ranges', function() {
|
||||
is.removeRange(0, 18);
|
||||
expect(is.getArray()).to.equalArray([]);
|
||||
expect(is.getArray()).to.eql([]);
|
||||
});
|
||||
|
||||
});
|
||||
@@ -556,7 +556,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
addStop = addStart + goog.math.randomInt(16);
|
||||
is.addRange(addStart, addStop);
|
||||
sis.addRange(addStart, addStop);
|
||||
expect(is.getArray()).to.equalArray(sis.getArray());
|
||||
expect(is.getArray()).to.eql(sis.getArray());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -569,7 +569,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
removeStop = removeStart + goog.math.randomInt(16);
|
||||
is.removeRange(removeStart, removeStop);
|
||||
sis.removeRange(removeStart, removeStop);
|
||||
expect(is.getArray()).to.equalArray(sis.getArray());
|
||||
expect(is.getArray()).to.eql(sis.getArray());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -585,7 +585,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
is.removeRange(start, stop);
|
||||
sis.removeRange(start, stop);
|
||||
}
|
||||
expect(is.getArray()).to.equalArray(sis.getArray());
|
||||
expect(is.getArray()).to.eql(sis.getArray());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -605,7 +605,7 @@ describe('ol.structs.IntegerSet', function() {
|
||||
is.clear();
|
||||
sis.clear();
|
||||
}
|
||||
expect(is.getArray()).to.equalArray(sis.getArray());
|
||||
expect(is.getArray()).to.eql(sis.getArray());
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -32,8 +32,8 @@ describe('ol.structs.PriorityQueue', function() {
|
||||
expect(function() {
|
||||
pq.assertValid();
|
||||
}).not.to.throwException();
|
||||
expect(pq.elements_).to.equalArray([0]);
|
||||
expect(pq.priorities_).to.equalArray([0]);
|
||||
expect(pq.elements_).to.eql([0]);
|
||||
expect(pq.priorities_).to.eql([0]);
|
||||
});
|
||||
|
||||
it('maintains the pq property while elements are enqueued', function() {
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('ol.TileUrlFunction', function() {
|
||||
]);
|
||||
var tileUrl1 = tileUrl(new ol.TileCoord(1, 0, 0));
|
||||
var tileUrl2 = tileUrl(new ol.TileCoord(1, 0, 1));
|
||||
expect(tileUrl1).not.to.eql(tileUrl2);
|
||||
expect(tileUrl1).not.to.be(tileUrl2);
|
||||
expect(tileUrl(null)).to.be(undefined);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user