From b6fa94c45c06c7e340452d634301ee5c2c5b3181 Mon Sep 17 00:00:00 2001 From: Lumi Pakkanen Date: Thu, 13 Jun 2024 16:32:10 +0300 Subject: [PATCH] Move some tests under the correct suite --- src/parser/__tests__/expression.spec.ts | 73 ++++++++++++------------- 1 file changed, 36 insertions(+), 37 deletions(-) diff --git a/src/parser/__tests__/expression.spec.ts b/src/parser/__tests__/expression.spec.ts index 2388bb59..ca1aa93e 100644 --- a/src/parser/__tests__/expression.spec.ts +++ b/src/parser/__tests__/expression.spec.ts @@ -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'); @@ -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'); + }); +});