require "test_helper" require "metal_adventures/dice/modifiers" module MetalAdventures class Dice class ModifiersTest < Minitest::Test def test_modifiers_init assert Dice::Modifiers.new(:sc).sc? refute Dice::Modifiers.new(:sc).SC? refute Dice::Modifiers.new(:sc, :sc).sc? assert Dice::Modifiers.new(:sc, :sc).SC? refute Dice::Modifiers.new(:pmf, :pmf).pmf? assert Dice::Modifiers.new(:pmf, :pmf).PMF? refute Dice::Modifiers.new(:sc, :sc, :sc).sc? assert Dice::Modifiers.new(:sc, :sc, :sc).SC? assert Dice::Modifiers.new(:sc, :sc, :e2f).sc? refute Dice::Modifiers.new(:sc, :sc, :e2f).SC? refute Dice::Modifiers.new(:sc, :sc, :e2f).e2f? assert Dice::Modifiers.new(:sc, :pmf, :e2f, priority: :pmf).pmf? assert Dice::Modifiers.new(:sc, :pmf, :e2f, priority: :sc).sc? assert Dice::Modifiers.new(:SC, :PMF, :e2f, priority: :pmf).PMF? assert Dice::Modifiers.new(:SC, :PMF, :e2f, priority: :sc).SC? assert Dice::Modifiers.new(:sc, :pmf, priority: :pmf).pmf? assert Dice::Modifiers.new(:sc, :pmf, priority: :sc).sc? assert Dice::Modifiers.new(:sc, :pmf, :pmf, priority: :sc).PMF? assert Dice::Modifiers.new(:E2F, :SC, :pmf, priority: :sc).sc? assert Dice::Modifiers.new(:SC, :pmf, :E2F, :E2F).e2f? assert Dice::Modifiers.new(:SC, :pmf, :E2F, :E2F, :e2f).E2F? assert Dice::Modifiers.new(:sc, :pmf, :PMF, :e2f).PMF? end def test_td_tf assert Dice::Modifiers.new(:td).td? refute Dice::Modifiers.new(:TD).td? assert Dice::Modifiers.new("td").td? assert Dice::Modifiers.new("TD").td? assert Dice::Modifiers.new(:tf).tf? refute Dice::Modifiers.new(:TF).tf? assert Dice::Modifiers.new("tf").tf? assert Dice::Modifiers.new("TF").tf? refute Dice::Modifiers.new(:td, :tf).td? refute Dice::Modifiers.new(:td, :tf).tf? assert Dice::Modifiers.new(:td, :tf, :td).td? refute Dice::Modifiers.new(:td, :tf, :td).tf? end def test_successes assert_equal 6..6, Dice::Modifiers.new(:td).successes assert_equal 2..6, Dice::Modifiers.new(:tf).successes assert_equal 4..6, Dice::Modifiers.new.successes end def test_roll assert Dice::Modifiers.new(:sc).roll(3) assert Dice::Modifiers.new(:SC).roll(3) assert Dice::Modifiers.new(:pmf).roll(3) assert Dice::Modifiers.new(:PMF).roll(3) assert Dice::Modifiers.new(:e2f).roll(3) assert Dice::Modifiers.new(:E2F).roll(3) end end end end