diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-09-02 00:47:46 -0400 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-09-02 01:02:16 -0400 |
commit | 1cc6b80cfd4875f289837421cdbe81e3dfcf0ed1 (patch) | |
tree | 0fb04bc04f27620f6def5dc310953a637e22ae07 /__tests__/parser.test.js | |
parent | 650f7d82197cba35df3654abf548e07e213c1b14 (diff) |
Implement repeat
Diffstat (limited to '__tests__/parser.test.js')
-rw-r--r-- | __tests__/parser.test.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js index bef11c5..d696b3e 100644 --- a/__tests__/parser.test.js +++ b/__tests__/parser.test.js @@ -285,6 +285,22 @@ describe('parse', () => { }) }) + it('parses dice with repeat', () => { + expect(parse('1d6 x 1d4')).toEqual({ + type: 'repeat', + left: { + type: 'd', + left: { type: 'constant', value: 1 }, + right: { type: 'constant', value: 6 } + }, + right: { + type: 'd', + left: { type: 'constant', value: 1 }, + right: { type: 'constant', value: 4 } + } + }) + }) + describe('parsing parentheses', () => { test('(1d6)d6', () => { expect(parse('(1d6)d6')).toEqual({ |