Arthur Poulet
3a69460051
All checks were successful
continuous-integration/drone/push Build is passing
33 lines
740 B
Ruby
33 lines
740 B
Ruby
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
|