Skip to content

Commit

Permalink
Add test for negative real quantities
Browse files Browse the repository at this point in the history
  • Loading branch information
frostburn committed Apr 18, 2024
1 parent 66a4540 commit bc0460e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/parser/__tests__/expression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1851,4 +1851,14 @@ describe('SonicWeave expression evaluator', () => {
expect(interval.steps).toBe(1);
expect(interval.toString()).toBe('linear([1 0 1>@1°.2..)');
});

it('has universal formatting for negative real quantities', () => {
const interval = evaluate('monzo(-3.14r)') as Interval;
expect(interval.toString()).toBe('[1 1980.917470940283>@-1.rc');
});

it('parses negative real monzos', () => {
const interval = evaluate('[1 1980.917470940283>@-1.rc') as Interval;
expect(interval.valueOf()).toBeCloseTo(-3.14);
});
});

0 comments on commit bc0460e

Please sign in to comment.