require "pry" require_relative "../base" require_relative "../../src/lib/set" class SetTest < Test::Unit::TestCase def test_base r = Roll::Set.parse("2d20+11d6 +6") assert_equal "2d20 + 11d6 + 6", r.to_s assert_equal "2d20+11d6+6", r.to_s(spaces: "") assert_nil r.result r.roll! assert r.result assert r.result.to_i assert r.result.to_s end def test_plus_prefix_parsing r = Roll::Set.parse("+2d20+11d6 -6") assert_equal "2d20 + 11d6 - 6", r.to_s assert_nil r.result r.roll! assert r.result end def test_less_prefix_parsing r = Roll::Set.parse("-2d20+11d6 -6") assert_equal "- 2d20 + 11d6 - 6", r.to_s assert_nil r.result r.roll! assert r.result end end