From 0d528cd7be88272ac9ce33641ab80a7fd0600f0a Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 12 Aug 2013 01:04:30 +0200 Subject: Let's at least add one modpow test. --- tests/test-BigInt.cc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test-BigInt.cc b/tests/test-BigInt.cc index df69e64..56f195b 100644 --- a/tests/test-BigInt.cc +++ b/tests/test-BigInt.cc @@ -16,5 +16,20 @@ void MainTask::Do() { TAssert(a.toString() == s); } + { + BigInt a, b, m, r, c; + + // random values; c is computed by wolfram alpha. + a.set("23475098273405987234905872394051923847902348567"); + b.set("3234057230495872034923458723049857203948572039485734598276345987"); + m.set("534287528093746598127364987236459872634587"); + + c.set("211833264233843026809053124694679687014311"); + + r = a.modpow(b, m); + + TAssert(r == c); + } + Printer::log(M_STATUS, "Test::BigInt passed."); } -- cgit v1.2.3