summaryrefslogtreecommitdiff
path: root/tests/tset.c
diff options
context:
space:
mode:
authorthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-09 14:19:24 +0000
committerthevenyp <thevenyp@211d60ee-9f03-0410-a15a-8952a2c7a4e4>2009-03-09 14:19:24 +0000
commit679df9dd2196689b290daabcfeb28d70f0d6e970 (patch)
tree202acb5723ce047d8a93d43608bfc7ab7c4f0e6c /tests/tset.c
parent9eb9140afe10985de5373af6ec2a0b1b6af33c18 (diff)
downloadmpc-679df9dd2196689b290daabcfeb28d70f0d6e970.tar.gz
doc/mpc.texi src/get_str.c tests/tset.c: mpc_get_str now uses the decimal point of the current locale.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpc/trunk@448 211d60ee-9f03-0410-a15a-8952a2c7a4e4
Diffstat (limited to 'tests/tset.c')
-rw-r--r--tests/tset.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/tset.c b/tests/tset.c
index 9dac5fa..29da766 100644
--- a/tests/tset.c
+++ b/tests/tset.c
@@ -29,6 +29,10 @@ MA 02111-1307, USA. */
# endif
#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
#include "mpc-tests.h"
#include "mpc-impl.h"
@@ -270,6 +274,32 @@ check_set_str (mp_exp_t exp_max)
mpc_free_str (str);
}
+#ifdef HAVE_LOCALE_H
+ {
+ /* Check with ',' as a decimal point */
+ char *old_locale;
+
+ old_locale = setlocale (LC_ALL, "de_DE");
+ if (old_locale != NULL)
+ {
+ str = mpc_get_str (10, 0, expected, MPC_RNDNN);
+ if (mpc_set_str (got, str, 10, MPC_RNDNN) == -1
+ || mpc_cmp (got, expected) != 0)
+ {
+ printf ("Error: mpc_set_str o mpc_get_str != Id\n"
+ "with str=\"%s\"\n", str);
+ OUT (expected);
+ printf (" ");
+ OUT (got);
+ exit (1);
+ }
+ mpc_free_str (str);
+
+ setlocale (LC_ALL, old_locale);
+ }
+ }
+#endif /* HAVE_LOCALE_H */
+
/* the real part has a zero exponent in base ten (fixed in r439) */
mpc_set_prec (expected, 37);
mpc_set_prec (got, 37);