Skip to content

Commit

Permalink
Move some tests under the correct suite
Browse files Browse the repository at this point in the history
  • Loading branch information
frostburn committed Jun 13, 2024
1 parent 3e6082b commit b6fa94c
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions src/parser/__tests__/expression.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2138,44 +2138,7 @@ describe('SonicWeave expression evaluator', () => {
const strings = evaluate('keepUnique(["hello", "world", "hello"])');
expect(strings).toEqual(['hello', 'world']);
});
});

describe('Poor grammar / Fun with "<"', () => {
it('rejects nedji with trailing garbage', () => {
expect(() => evaluate('1\\2<3>4')).toThrow();
});

it('knows that sqrt(2) is smaller than 3 and that true is not larger than 4: (1°2 < 3) > 4', () => {
const no = evaluate('1 \\2<3>4');
expect(no).toBe(false);
});

it('knows that a double step is smaller than 3 etc. ((1° * 2) < 3) > 4', () => {
const no = evaluate('1\\ 2<3>4');
expect(no).toBe(false);
});

it('features the return of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2 <3>4');
expect(no).toBe(false);
});

it('features the persistence of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2< 3>4');
expect(no).toBe(false);
});

it('features the obstinence of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2<3 >4');
expect(no).toBe(false);
});

it('has quadruple semitwelfth', () => {
const {fraction} = parseSingle('1\\2<3> 4');
expect(fraction).toBe('9');
});

// TODO: Move under the correct heading.
it('multiplies a monzo from the left', () => {
const {fraction} = parseSingle('2 [2 -1>');
expect(fraction).toBe('16/9');
Expand Down Expand Up @@ -2443,3 +2406,39 @@ describe('Poor grammar / Fun with "<"', () => {
expect(interval.totalCents()).toBe(-1500);
});
});

describe('Poor grammar / Fun with "<"', () => {
it('rejects nedji with trailing garbage', () => {
expect(() => evaluate('1\\2<3>4')).toThrow();
});

it('knows that sqrt(2) is smaller than 3 and that true is not larger than 4: (1°2 < 3) > 4', () => {
const no = evaluate('1 \\2<3>4');
expect(no).toBe(false);
});

it('knows that a double step is smaller than 3 etc. ((1° * 2) < 3) > 4', () => {
const no = evaluate('1\\ 2<3>4');
expect(no).toBe(false);
});

it('features the return of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2 <3>4');
expect(no).toBe(false);
});

it('features the persistence of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2< 3>4');
expect(no).toBe(false);
});

it('features the obstinence of (1°2 < 3) > 4', () => {
const no = evaluate('1\\2<3 >4');
expect(no).toBe(false);
});

it('has quadruple semitwelfth', () => {
const {fraction} = parseSingle('1\\2<3> 4');
expect(fraction).toBe('9');
});
});

0 comments on commit b6fa94c

Please sign in to comment.