[Gmp-commit] /var/hg/gmp: Link C++ tests with -lm, so we can compare the resu...

mercurial at gmplib.org mercurial at gmplib.org
Sun Feb 17 11:15:14 CET 2013


details:   /var/hg/gmp/rev/6de9702a1bc7
changeset: 15450:6de9702a1bc7
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun Feb 17 11:15:11 2013 +0100
description:
Link C++ tests with -lm, so we can compare the result of mpf functions with libm functions.

diffstat:

 ChangeLog             |  3 +++
 tests/cxx/Makefile.am |  4 +++-
 tests/cxx/t-ops2.cc   |  2 ++
 3 files changed, 8 insertions(+), 1 deletions(-)

diffs (44 lines):

diff -r bf312e548a3a -r 6de9702a1bc7 ChangeLog
--- a/ChangeLog	Sun Feb 17 10:53:15 2013 +0100
+++ b/ChangeLog	Sun Feb 17 11:15:11 2013 +0100
@@ -3,6 +3,9 @@
 	* cxx/osdoprnti.cc: Use <stdarg.h> and <string.h> rather than <cstdarg>
 	and <cstring> (revert 2002-12-21).
 
+	* tests/cxx/Makefile.am: Link with libm.
+	* tests/cxx/t-ops2.cc: Comment about more tests.
+
 2013-02-16  Marc Glisse  <marc.glisse at inria.fr>
 
 	* gmpxx.h: Include <algorithm>.
diff -r bf312e548a3a -r 6de9702a1bc7 tests/cxx/Makefile.am
--- a/tests/cxx/Makefile.am	Sun Feb 17 10:53:15 2013 +0100
+++ b/tests/cxx/Makefile.am	Sun Feb 17 11:15:11 2013 +0100
@@ -22,12 +22,14 @@
 # 3.2 on itanium2-hp-hpux11.22.  Without this option, the libgmp.sl.6
 # required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
 # linker.  FIXME: Presumably libtool should do something about this itself.
+# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
 #
 INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
 LDADD = -L$(top_builddir)/.libs \
   $(top_builddir)/tests/libtests.la \
   $(top_builddir)/libgmpxx.la \
-  $(top_builddir)/libgmp.la
+  $(top_builddir)/libgmp.la \
+  -lm
 
 if WANT_CXX
 check_PROGRAMS = t-assign t-binary t-cast t-constr t-cxx11 \
diff -r bf312e548a3a -r 6de9702a1bc7 tests/cxx/t-ops2.cc
--- a/tests/cxx/t-ops2.cc	Sun Feb 17 10:53:15 2013 +0100
+++ b/tests/cxx/t-ops2.cc	Sun Feb 17 11:15:11 2013 +0100
@@ -184,6 +184,8 @@
   ASSERT_ALWAYS(sqrt(mpf_class(7))>2.64);
   ASSERT_ALWAYS(sqrt(mpf_class(7))<2.65);
   ASSERT_ALWAYS(sqrt(mpf_class(0))==0);
+  // TODO: add some consistency checks, as described in
+  // http://gmplib.org/list-archives/gmp-bugs/2013-February/002940.html
   CHECK1(mpf_class,1.9,trunc);
   CHECK1(mpf_class,1.9,floor);
   CHECK1(mpf_class,1.9,ceil);


More information about the gmp-commit mailing list