summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2005-07-09 17:52:53 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2005-07-09 17:52:53 +0000
commit10c97aa064f4c984fcb4d4b6848d5a9f0dea5b01 (patch)
treec2a20b03b0521656cd20cbb2a95b6de10e299968
parent064a058e75d4d0b75a3805f87127da8643bd8e58 (diff)
downloadmpfr-10c97aa064f4c984fcb4d4b6848d5a9f0dea5b01.tar.gz
In the tests, set the locale to the current one. This allows to test
MPFR under various locales, showing a bug in the parse_string function due to the use of the strncasecmp function ('i' and 'I' don't match with LC_ALL="tr_TR.ISO8859-9"). git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@3670 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r--BUGS3
-rw-r--r--acinclude.m42
-rw-r--r--tests/tests.c11
3 files changed, 15 insertions, 1 deletions
diff --git a/BUGS b/BUGS
index f883cc873..d5ffe6f69 100644
--- a/BUGS
+++ b/BUGS
@@ -29,6 +29,9 @@ Known bugs:
exceeds the hardware limit (2^30 for a 32 bits CPU, and 2^62 for a 64 bits
CPU).
+* The mpfr_strtofr function may fail under some locales, e.g. with
+ LC_ALL="tr_TR.ISO8859-9".
+
Potential bugs:
* Possible integer overflows on some machines.
diff --git a/acinclude.m4 b/acinclude.m4
index 12e96a34d..08b56a041 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -55,7 +55,7 @@ AC_CHECK_HEADERS([sys/time.h sys/fpu.h])
dnl FIXME: strtol is really needed. Maybe create another function?
dnl gettimeofday is not defined for MinGW
-AC_CHECK_FUNCS([memset strtol gettimeofday])
+AC_CHECK_FUNCS([memset setlocale strtol gettimeofday])
AC_REPLACE_FUNCS(strcasecmp strncasecmp)
diff --git a/tests/tests.c b/tests/tests.c
index b27028353..158e544f3 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -30,6 +30,10 @@ MA 02110-1301, USA. */
#include <string.h>
#include <float.h>
+#if HAVE_SETLOCALE
+#include <locale.h>
+#endif
+
#if TIME_WITH_SYS_TIME
# include <sys/time.h> /* for struct timeval */
# include <time.h>
@@ -62,6 +66,13 @@ tests_start_mpfr (void)
/* don't buffer, so output is not lost if a test causes a segv etc */
setbuf (stdout, NULL);
+#if HAVE_SETLOCALE
+ /* Added on 2005-07-09. This allows to test MPFR under various
+ locales. New bugs will probably be found, in particular with
+ LC_ALL="tr_TR.ISO8859-9" because of the i/I character... */
+ setlocale (LC_ALL, "");
+#endif
+
tests_memory_start ();
tests_rand_start ();
}