rmmh / skybot

Python IRC bot
https://github.com/rmmh/skybot/wiki
The Unlicense
249 stars 170 forks source link

fix subtraction in dice plugin #187

Closed imnotjames closed 6 years ago

imnotjames commented 6 years ago

in the example 2d20-d5+4 the outhput was incorrect because4 the output was 10 because it the plugin parsed it as "2D20" + "1D5" + "4"parsed it as "2D20" + "1D5" + "4"

instead, it needs to be parsed as "2D20" + "-1D5" + "4"

rmmh commented 6 years ago

Can you add a unit test here? Follow the format used in bf.py

imnotjames commented 6 years ago

Sure, I took a crack at doing this without bringing in a separate mocking library to patch random.randint like I did in the other tests for this.