diff options
author | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 18:38:54 -0400 |
---|---|---|
committer | Marcin Chrzanowski <marcin.j.chrzanowski@gmail.com> | 2017-08-22 18:38:54 -0400 |
commit | 5e435ad92cb7ae3d05c54d9e35020580a0459ded (patch) | |
tree | c60a9804330747c90a2b7779b57fe382b7e74eef /__tests__ | |
parent | 1426322eb4898cd49310c1dc30cdfc8ad8e73402 (diff) |
Increase bonus binding power
Diffstat (limited to '__tests__')
-rw-r--r-- | __tests__/parser.test.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js index 54e1da7..fc47576 100644 --- a/__tests__/parser.test.js +++ b/__tests__/parser.test.js @@ -175,6 +175,30 @@ describe('parse', () => { }) }) + test('bonus binds stronger than addition', () => { + expect(parse('2d6 + 2d6+2d6')).toEqual({ + type: 'add', + left: { + type: 'd', + left: { type: 'constant', value: 2 }, + right: { type: 'constant', value: 6 } + }, + right: { + type: 'bonusAdd', + left: { + type: 'd', + left: { type: 'constant', value: 2 }, + right: { type: 'constant', value: 6 } + }, + right: { + type: 'd', + left: { type: 'constant', value: 2 }, + right: { type: 'constant', value: 6 } + } + } + }) + }) + describe('parsing parentheses', () => { test('(1d6)d6', () => { expect(parse('(1d6)d6')).toEqual({ |