Converted "vector" branch unit tests to mocha, expect.js and sinon
This commit is contained in:
@@ -15,24 +15,24 @@ describe('ol.structs.RTree', function() {
|
||||
it('stores items', function() {
|
||||
expect(goog.object.getCount(rTree.find(new ol.Rectangle(
|
||||
Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY,
|
||||
Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)))).toBe(6);
|
||||
Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY)))).to.be(6);
|
||||
});
|
||||
|
||||
it('filters by rectangle', function() {
|
||||
var result;
|
||||
result = goog.object.getValues(rTree.find(new ol.Rectangle(2, 2, 3, 3)));
|
||||
expect(result).toContain(2);
|
||||
expect(result).toContain(3);
|
||||
expect(result.length).toBe(2);
|
||||
expect(result).to.contain(2);
|
||||
expect(result).to.contain(3);
|
||||
expect(result.length).to.be(2);
|
||||
result = goog.object.getValues(
|
||||
rTree.find(new ol.Rectangle(-1, -1, 2, 2)));
|
||||
expect(result).toContain(1);
|
||||
expect(result).toContain(2);
|
||||
expect(result).toContain(3);
|
||||
expect(result).toContain(5);
|
||||
expect(result.length).toBe(4);
|
||||
expect(result).to.contain(1);
|
||||
expect(result).to.contain(2);
|
||||
expect(result).to.contain(3);
|
||||
expect(result).to.contain(5);
|
||||
expect(result.length).to.be(4);
|
||||
expect(goog.object.getCount(rTree.find(new ol.Rectangle(5, 5, 6, 6))))
|
||||
.toBe(0);
|
||||
.to.be(0);
|
||||
});
|
||||
|
||||
it('can store thosands of items and find fast', function() {
|
||||
@@ -41,17 +41,17 @@ describe('ol.structs.RTree', function() {
|
||||
Math.random() * 10, Math.random() * 10), i);
|
||||
}
|
||||
expect(goog.object.getCount(
|
||||
rTree.find(new ol.Rectangle(-10, -10, 10, 10)))).toBe(10000);
|
||||
rTree.find(new ol.Rectangle(-10, -10, 10, 10)))).to.be(10000);
|
||||
var result = rTree.find(new ol.Rectangle(0, 0, 0, 0));
|
||||
expect(goog.object.getCount(result)).toBe(9995);
|
||||
expect(goog.object.getCount(result)).to.be(9995);
|
||||
var values = goog.object.getValues(result);
|
||||
expect(values).toContain(1);
|
||||
expect(values).not.toContain(2);
|
||||
expect(values).not.toContain(3);
|
||||
expect(values).not.toContain(4);
|
||||
expect(values).not.toContain(5);
|
||||
expect(values).not.toContain(6);
|
||||
expect(values).toContain(7);
|
||||
expect(values).to.contain(1);
|
||||
expect(values).not.to.contain(2);
|
||||
expect(values).not.to.contain(3);
|
||||
expect(values).not.to.contain(4);
|
||||
expect(values).not.to.contain(5);
|
||||
expect(values).not.to.contain(6);
|
||||
expect(values).to.contain(7);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user