Remove goog.math.modulo and goog.math.lerp

This commit is contained in:
Nicholas Latham
2016-04-04 19:43:24 +12:00
committed by Frédéric Junod
parent 19fd3d6987
commit 2ee1969de7
11 changed files with 82 additions and 23 deletions

View File

@@ -155,5 +155,41 @@ describe('ol.math.toRadians', function() {
});
});
describe('ol.math.modulo', function() {
it('256 / 8 returns 0', function() {
expect(ol.math.modulo(256, 8)).to.be(0);
});
it('positive and positive returns a positive ', function() {
expect(ol.math.modulo(7, 8)).to.be(7);
});
it('same Dividend and Divisor returns 0', function() {
expect(ol.math.modulo(4, 4)).to.be(0);
});
it('negative and positive returns positive', function() {
expect(ol.math.modulo(-3, 4)).to.be(1);
});
it('negative and negative returns negative', function() {
expect(ol.math.modulo(-4, -5)).to.be(-4);
expect(ol.math.modulo(-3, -4)).to.be(-3);
});
it('positive and negative returns negative', function() {
expect(ol.math.modulo(3, -4)).to.be(-1);
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);
});
});
});
goog.require('ol.math');