import { assert } from 'chai'; import { radians, degrees } from '../../../lib/math/units'; import { DOUBLE_EPSILON, fuzzyEqual } from '../../../lib/math/float'; describe('math.units', () => { describe('radians', () => { test.each([ [0, 0], [1, Math.PI / 180], [90, Math.PI / 2], [-180, -Math.PI], ])('radians#%#', (deg: number, result: number) => { assert.isTrue(fuzzyEqual(radians(deg), result, DOUBLE_EPSILON)); }); }); describe('degrees', () => { test.each([ [0, 0], [1, 180 / Math.PI], [Math.PI / 2, 90], [-Math.PI, -180], ])('degrees#%#', (rad: number, result: number) => { assert.isTrue(fuzzyEqual(degrees(rad), result, DOUBLE_EPSILON)); }); }); });