[Gmp-commit] /var/hg/gmp: Test numeric_limits.

mercurial at gmplib.org mercurial at gmplib.org
Sat Jun 23 21:39:33 CEST 2012


details:   /var/hg/gmp/rev/7bd7a74c3c0d
changeset: 15057:7bd7a74c3c0d
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sat Jun 23 21:38:59 2012 +0200
description:
Test numeric_limits.

diffstat:

 ChangeLog           |   7 ++++---
 tests/cxx/t-misc.cc |  13 +++++++++++++
 2 files changed, 17 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 48b1b840fc8f -r 7bd7a74c3c0d ChangeLog
--- a/ChangeLog	Sat Jun 23 01:07:33 2012 +0200
+++ b/ChangeLog	Sat Jun 23 21:38:59 2012 +0200
@@ -1,9 +1,10 @@
 2012-06-23  Marc Glisse  <marc.glisse at inria.fr>
 
 	* gmpxx.h (numeric_limits): Make content public.
-	(cxx/limits.cc): New file, proper declarations.
-	(Makefile.am): List new file.
-	(cxx/Makefile.am): Likewise.
+	* cxx/limits.cc: New file, proper declarations.
+	* Makefile.am: List new file.
+	* cxx/Makefile.am: Likewise.
+	* cxx/t-misc.cc: Add minimal test for numeric_limits.
 
 2012-06-09  Marc Glisse  <marc.glisse at inria.fr>
 
diff -r 48b1b840fc8f -r 7bd7a74c3c0d tests/cxx/t-misc.cc
--- a/tests/cxx/t-misc.cc	Sat Jun 23 01:07:33 2012 +0200
+++ b/tests/cxx/t-misc.cc	Sat Jun 23 21:38:59 2012 +0200
@@ -370,6 +370,18 @@
   }
 }
 
+// std::numeric_limits
+void
+check_limits (void)
+{
+  // Check that the content is not private.
+  ASSERT_ALWAYS ( std::numeric_limits<mpz_class>::is_integer);
+  ASSERT_ALWAYS (!std::numeric_limits<mpf_class>::is_integer);
+
+  // Check that symbols are emitted.
+  ASSERT_ALWAYS (&std::numeric_limits<mpz_class>::is_integer
+	      != &std::numeric_limits<mpq_class>::is_integer);
+}
 
 int
 main (void)
@@ -379,6 +391,7 @@
   check_mpz();
   check_mpq();
   check_mpf();
+  check_limits();
 
   tests_end();
   return 0;


More information about the gmp-commit mailing list