import { expect, test } from 'bun:test'; import { damp } from './motion'; test('damp is frame-rate independent', () => { // two 1/120 s steps cover the same ground as one 1/60 s step const k60 = damp(8, 1 / 60); const k120 = damp(8, 1 / 120); expect(1 - (1 - k120) ** 2).toBeCloseTo(k60, 10); }); test('damp stays in [0, 1)', () => { expect(damp(8, 0)).toBe(0); expect(damp(8, 0.5)).toBeLessThan(1); expect(damp(8, 0.5)).toBeGreaterThan(0.98); });