Remove ol.DEBUG

This commit is contained in:
Tim Schaub
2016-12-29 09:09:24 -07:00
parent 7b9690a691
commit 137cdc04c8
128 changed files with 309 additions and 2027 deletions

View File

@@ -27,7 +27,6 @@ describe('ol.math.clamp', function() {
});
describe('ol.math.cosh', function() {
it('returns the correct value at -Infinity', function() {
@@ -52,7 +51,6 @@ describe('ol.math.cosh', function() {
});
describe('ol.math.roundUpToPowerOfTwo', function() {
it('raises an exception when x is negative', function() {
@@ -92,8 +90,8 @@ describe('ol.math.roundUpToPowerOfTwo', function() {
});
describe('ol.math.solveLinearSystem', function() {
it('calculates correctly', function() {
var result = ol.math.solveLinearSystem([
[2, 1, 3, 1],
@@ -104,6 +102,7 @@ describe('ol.math.solveLinearSystem', function() {
expect(result[1]).to.roughlyEqual(0.4, 1e-9);
expect(result[2]).to.roughlyEqual(0, 1e-9);
});
it('can handle singular matrix', function() {
var result = ol.math.solveLinearSystem([
[2, 1, 3, 1],
@@ -112,33 +111,9 @@ describe('ol.math.solveLinearSystem', function() {
]);
expect(result).to.be(null);
});
it('raises an exception when the matrix is malformed', function() {
var origAssert = console.assert;
console.assert = function(assertion, message) {
if (!assertion) {
throw new Error(message);
}
};
expect(function() {
ol.math.solveLinearSystem([
[2, 1, 3, 1],
[2, 6, 8, 3],
[6, 8, 18]
]);
}).to.throwException();
expect(function() {
ol.math.solveLinearSystem([
[2, 1, 3, 1],
[2, 6, 8, 3],
[6, 8, 18, 5, 0]
]);
}).to.throwException();
console.assert = origAssert;
});
});
describe('ol.math.toDegrees', function() {
it('returns the correct value at -π', function() {
expect(ol.math.toDegrees(-Math.PI)).to.be(-180);
@@ -151,7 +126,6 @@ describe('ol.math.toDegrees', function() {
});
});
describe('ol.math.toRadians', function() {
it('returns the correct value at -180', function() {
expect(ol.math.toRadians(-180)).to.be(-Math.PI);
@@ -186,16 +160,16 @@ describe('ol.math.modulo', function() {
expect(ol.math.modulo(1, -5)).to.be(-4);
expect(ol.math.modulo(6, -5)).to.be(-4);
});
});
describe('ol.math.lerp', function() {
it('correctly interpolated numbers', function() {
expect(ol.math.lerp(0, 0, 0)).to.be(0);
expect(ol.math.lerp(0, 1, 0)).to.be(0);
expect(ol.math.lerp(1, 11, 5)).to.be(51);
});
it('correctly interpolates floats', function() {
expect(ol.math.lerp(0, 1, 0.5)).to.be(0.5);
expect(ol.math.lerp(0.25, 0.75, 0.5)).to.be(0.5);
});
describe('ol.math.lerp', function() {
it('correctly interpolated numbers', function() {
expect(ol.math.lerp(0, 0, 0)).to.be(0);
expect(ol.math.lerp(0, 1, 0)).to.be(0);
expect(ol.math.lerp(1, 11, 5)).to.be(51);
});
it('correctly interpolates floats', function() {
expect(ol.math.lerp(0, 1, 0.5)).to.be(0.5);
expect(ol.math.lerp(0.25, 0.75, 0.5)).to.be(0.5);
});
});

View File

@@ -26,27 +26,12 @@ describe('ol.structs.PriorityQueue', function() {
console.assert = origAssert;
});
it('is valid', function() {
expect(function() {
pq.assertValid();
}).not.to.throwException();
});
it('is empty', function() {
expect(pq.isEmpty()).to.be(true);
});
it('dequeue raises an exception', function() {
expect(function() {
pq.dequeue();
}).to.throwException();
});
it('enqueue adds an element', function() {
var added = pq.enqueue(0);
expect(function() {
pq.assertValid();
}).not.to.throwException();
expect(added).to.be(true);
expect(pq.elements_).to.eql([0]);
expect(pq.priorities_).to.eql([0]);
@@ -54,24 +39,11 @@ describe('ol.structs.PriorityQueue', function() {
it('do not enqueue element with DROP priority', function() {
var added = pq.enqueue(Infinity);
expect(function() {
pq.assertValid();
}).not.to.throwException();
expect(added).to.be(false);
expect(pq.elements_).to.eql([]);
expect(pq.priorities_).to.eql([]);
});
it('maintains the pq property while elements are enqueued', function() {
var i;
for (i = 0; i < 32; ++i) {
pq.enqueue(Math.random());
expect(function() {
pq.assertValid();
}).not.to.throwException();
}
});
});
describe('when populated', function() {

View File

@@ -117,27 +117,6 @@ describe('ol.structs.RBush', function() {
});
describe('#insert', function() {
it('throws an exception if called while iterating over all values',
function() {
expect(function() {
rBush.forEach(function(value) {
rBush.insert([0, 0, 1, 1], {});
});
}).to.throwException();
});
it('throws an exception if called while iterating over an extent',
function() {
expect(function() {
rBush.forEachInExtent([-10, -10, 10, 10], function(value) {
rBush.insert([0, 0, 1, 1], {});
});
}).to.throwException();
});
});
describe('#isEmpty', function() {
it('returns false', function() {
@@ -157,45 +136,6 @@ describe('ol.structs.RBush', function() {
}
});
it('throws an exception if called while iterating over all values',
function() {
expect(function() {
rBush.forEach(function(value) {
rBush.remove(value);
});
}).to.throwException();
});
it('throws an exception if called while iterating over an extent',
function() {
expect(function() {
rBush.forEachInExtent([-10, -10, 10, 10], function(value) {
rBush.remove(value);
});
}).to.throwException();
});
});
describe('#update', function() {
it('throws an exception if called while iterating over all values',
function() {
expect(function() {
rBush.forEach(function(value) {
rBush.update([0, 0, 1, 1], objs[1]);
});
}).to.throwException();
});
it('throws an exception if called while iterating over an extent',
function() {
expect(function() {
rBush.forEachInExtent([-10, -10, 10, 10], function(value) {
rBush.update([0, 0, 1, 1], objs[1]);
});
}).to.throwException();
});
});
});

View File

@@ -95,9 +95,6 @@ describe('ol.TileQueue', function() {
addRandomPriorityTiles(tq, 100);
tq.heapify_();
expect(function() {
tq.assertValid();
}).not.to.throwException();
});
});
@@ -123,9 +120,6 @@ describe('ol.TileQueue', function() {
tq.reprioritize();
expect(tq.elements_.length).to.eql(50);
expect(tq.priorities_.length).to.eql(50);
expect(function() {
tq.assertValid();
}).not.to.throwException();
});
});