Use ol.math.clamp()

This commit is contained in:
Tim Schaub
2015-09-27 09:54:11 -06:00
parent 5cac9d61cc
commit f746cb7f57
12 changed files with 67 additions and 30 deletions

View File

@@ -1,6 +1,31 @@
goog.provide('ol.test.math');
describe('ol.math.clamp', function() {
it('returns the correct value at -Infinity', function() {
expect(ol.math.clamp(-Infinity, 10, 20)).to.eql(10);
});
it('returns the correct value at min', function() {
expect(ol.math.clamp(10, 10, 20)).to.eql(10);
});
it('returns the correct value at mid point', function() {
expect(ol.math.clamp(15, 10, 20)).to.eql(15);
});
it('returns the correct value at max', function() {
expect(ol.math.clamp(20, 10, 20)).to.eql(20);
});
it('returns the correct value at Infinity', function() {
expect(ol.math.clamp(Infinity, 10, 20)).to.eql(20);
});
});
describe('ol.math.cosh', function() {
it('returns the correct value at -Infinity', function() {