Skip to content

Commit b747e6e

Browse files
committed
Create lerp.test.ts
1 parent 4fe3689 commit b747e6e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { expect } from '@open-wc/testing';
2+
import { lerp } from './math.js';
3+
4+
describe('lerp', () => {
5+
it('Interpolate between two values.', () => {
6+
expect(lerp(1, 20, 0.5)).to.equal(10.5);
7+
expect(lerp(1, 100, 0.2)).to.equal(20.8);
8+
expect(lerp(2, 23, 0.4)).to.equal(10.4);
9+
expect(lerp(50, 250, 0.8)).to.equal(210);
10+
});
11+
12+
it('Ensure alpha is clamped to the range [0, 1].', () => {
13+
expect(lerp(10, 20, 1.5)).to.equal(20);
14+
});
15+
});

0 commit comments

Comments
 (0)