From 83983efa99d910a97a72fc8b00dd9d7eb8829368 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Tue, 5 Sep 2017 22:29:24 -0400 Subject: Implement multiplicative bonuses --- __tests__/parser.test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to '__tests__/parser.test.js') diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js index d696b3e..5580b4c 100644 --- a/__tests__/parser.test.js +++ b/__tests__/parser.test.js @@ -153,6 +153,18 @@ describe('parse', () => { }) }) + it('parses multiplicative bonuses', () => { + expect(parse('3d4*1')).toEqual({ + type: 'bonusMultiply', + left: { + type: 'd', + left: { type: 'constant', value: 3 }, + right: { type: 'constant', value: 4 } + }, + right: { type: 'constant', value: 1 } + }) + }) + test('bonus binds stronger than addition', () => { expect(parse('2d6 + 2d6+2d6')).toEqual({ type: 'add', -- cgit v1.2.3