mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-24 12:37:58 +01:00
18 lines
531 B
TypeScript
18 lines
531 B
TypeScript
|
import { lerp } from '../lerp';
|
||
|
|
||
|
describe('Linear interpolation', () => {
|
||
|
describe('lerp', () => {
|
||
|
it('should interpolate the min-max range based on a delta', () => {
|
||
|
expect(lerp(0.5, 0, 100)).toEqual(50);
|
||
|
expect(lerp(0.75, 0, 100)).toEqual(75);
|
||
|
});
|
||
|
|
||
|
it('should clamp the value between min and max', () => {
|
||
|
expect(lerp(-999, 0, 100)).toEqual(0);
|
||
|
expect(lerp(0, 0, 100)).toEqual(0);
|
||
|
expect(lerp(999, 0, 100)).toEqual(100);
|
||
|
expect(lerp(1, 0, 100)).toEqual(100);
|
||
|
});
|
||
|
});
|
||
|
});
|