require "minitest/autorun"
require "modularexponent"

# a unit test for modular exponentiation
class TestModularExponent < MiniTest::Test
  def test_modexp
    t = 1998286638065473057944506344030256054916203227381748916180906390214373930105605405985818224246280726328877245115163209963634633681313092395058312190549
    p = 3117669354341343983299795755233093030121263419399456069461857093013377786581355434120522026479521394652584595093999769488992372529197823784149324456563
    g = 5
    assert_equal(299305359716739514081489065401035859463562587472149502673752032637854521707543606739420594370374704775617985314754263691561207864706808335328454749954, g.modexp(t, p))
  end

end
