Now with GNU MultiPrecision (GMP) integers
[ipdf/code.git] / src / tests / arbint_vs_gmpint.cpp
diff --git a/src/tests/arbint_vs_gmpint.cpp b/src/tests/arbint_vs_gmpint.cpp
new file mode 100644 (file)
index 0000000..2393d3a
--- /dev/null
@@ -0,0 +1,37 @@
+#include <gmp.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "log.h"
+
+#include "gmpint.h"
+#include "arbint.h"
+
+#define TEST_CASES 100
+
+using namespace IPDF;
+
+int main(int argc, char ** argv)
+{
+       for (unsigned i = 0; i < TEST_CASES; ++i)
+       {
+               uint64_t a = rand();
+       
+               Arbint arb_a(a);
+               Gmpint gmp_a(a);
+               
+               uint64_t b = rand();
+               
+               for (unsigned j = 0; j < 5; ++j)
+               {
+                       arb_a *= b;
+                       gmp_a *= b;
+                       
+                       Debug("Arbint - %s", arb_a.Str().c_str());
+                       Debug("Gmpint - %s", gmp_a.Str().c_str());
+               }
+               
+               
+       }
+       return 0;
+}

UCC git Repository :: git.ucc.asn.au