summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-12 01:04:30 +0200
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-08-12 01:25:43 +0200
commit0d528cd7be88272ac9ce33641ab80a7fd0600f0a (patch)
treebceb8840ff73f7e76bd4df0bd69851592ee9197c
parent0bea5c6d944beaa8fc880f646be207b03d1486fd (diff)
Let's at least add one modpow test.
-rw-r--r--tests/test-BigInt.cc15
1 files changed, 15 insertions, 0 deletions
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.");
}