diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-12-31 02:32:11 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2007-12-31 02:32:11 +0000 |
commit | d33c60c935a20bdfe8a0765c512a903ddeefbb8d (patch) | |
tree | ff93483f124f9ddc95e9bbe0d42048b4c64a5f3c /tests/tstrtofr.c | |
parent | 81c3bb31486ccee10da7f9f4a70792559342d63b (diff) | |
download | mpfr-d33c60c935a20bdfe8a0765c512a903ddeefbb8d.tar.gz |
tstrtofr.c: added test of -42P17 with base = 0 and 16. This currently
fails with base = 16 (-42P17 is parsed as -0x42P17 instead of -42 with
the remaining characters "P17"), but we could alternatively regard the
mpfr_strtofr specification (in mpfr.texi) as incorrect.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@5149 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tstrtofr.c')
-rw-r--r-- | tests/tstrtofr.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/tstrtofr.c b/tests/tstrtofr.c index 04793887a..90ec2589a 100644 --- a/tests/tstrtofr.c +++ b/tests/tstrtofr.c @@ -632,6 +632,20 @@ check_parse (void) mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); exit (1); } + mpfr_strtofr (x, "-42P17", &s, 0, GMP_RNDN); + if (mpfr_cmp_str (x, "-42", 10, GMP_RNDN) || strcmp (s, "P17")) + { + printf ("Failed parsing '-42P17' (base = 0)\n S='%s'\n X=", s); + mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + exit (1); + } + mpfr_strtofr (x, "-42P17", &s, 16, GMP_RNDN); + if (mpfr_cmp_str (x, "-42", 16, GMP_RNDN) || strcmp (s, "P17")) + { + printf ("Failed parsing '-42P17' (base = 16)\n S='%s'\n X=", s); + mpfr_out_str (stdout, 10, 0, x, GMP_RNDN); putchar ('\n'); + exit (1); + } mpfr_strtofr (x, " 0b0101.011@42", &s, 0, GMP_RNDN); if (mpfr_cmp_str (x, "0101.011@42", 2, GMP_RNDN) || *s != 0) { |