diff options
Diffstat (limited to '__tests__/lexer.test.js')
-rw-r--r-- | __tests__/lexer.test.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/__tests__/lexer.test.js b/__tests__/lexer.test.js index db7ab50..0c615d5 100644 --- a/__tests__/lexer.test.js +++ b/__tests__/lexer.test.js @@ -121,6 +121,30 @@ describe('lex', () => { }) }) + describe('lexes division', () => { + it('1d6 / 1d4', () => { + expect(lex('1d6 / 1d4')).toEqual([ + { type: 'constant', value: 1 }, + { type: 'd' }, + { type: 'constant', value: 6 }, + { type: 'bigDivide' }, + { type: 'constant', value: 1 }, + { type: 'd' }, + { type: 'constant', value: 4 } + ]) + }) + + it('2d17 / 4', () => { + expect(lex('2d17 / 4')).toEqual([ + { type: 'constant', value: 2 }, + { type: 'd' }, + { type: 'constant', value: 17 }, + { type: 'bigDivide' }, + { type: 'constant', value: 4 } + ]) + }) + }) + describe('lexes parentheses', () => { it('(1d6)d6', () => { expect(lex('(1d6)d6')).toEqual([ |