[Gmp-commit] /var/hg/gmp: C++ random generator tests

mercurial at gmplib.org mercurial at gmplib.org
Sun May 1 11:57:20 CEST 2011


details:   /var/hg/gmp/rev/1c68ecf1885e
changeset: 14149:1c68ecf1885e
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun May 01 11:54:12 2011 +0200
description:
C++ random generator tests

diffstat:

 ChangeLog           |   1 +
 tests/cxx/t-rand.cc |  13 ++++++++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)

diffs (40 lines):

diff -r 12fcd37fbe9f -r 1c68ecf1885e ChangeLog
--- a/ChangeLog	Sun May 01 09:32:28 2011 +0200
+++ b/ChangeLog	Sun May 01 11:54:12 2011 +0200
@@ -9,6 +9,7 @@
 	* .bootstrap: Let libtoolize generate ltmain.sh.
 
 	* tests/cxx/t-ops2.cc: Add a couple tests.
+	* tests/cxx/t-rand.cc: Likewise.
 
 2011-04-28  Torbjorn Granlund  <tege at gmplib.org>
 
diff -r 12fcd37fbe9f -r 1c68ecf1885e tests/cxx/t-rand.cc
--- a/tests/cxx/t-rand.cc	Sun May 01 09:32:28 2011 +0200
+++ b/tests/cxx/t-rand.cc	Sun May 01 11:54:12 2011 +0200
@@ -113,13 +113,24 @@
     r.seed(a);
     mpf_class b;
     b = r.get_f();
+    mpf_class c(r.get_f());
+    ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
+    mpf_class d(r.get_f(),212);
+    ASSERT_ALWAYS (d.get_prec() >= 212);
   }
   {
     gmp_randclass r(gmp_randinit_default);
-    int a = 123, b = 128;
+    int a = 123, b = 198;
     r.seed(a);
     mpf_class c;
     c = r.get_f(b);
+    ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
+    mpf_class d(r.get_f(b));
+    ASSERT_ALWAYS (d.get_prec() >= 198);
+    mpf_class e(r.get_f(b)-r.get_f());
+    ASSERT_ALWAYS (e.get_prec() >= 198);
+    mpf_class f(r.get_f(60),300);
+    ASSERT_ALWAYS (f.get_prec() >= 300);
   }
 }
 


More information about the gmp-commit mailing list