summaryrefslogtreecommitdiff
path: root/tests/tfpif.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-11-29 14:59:03 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2017-11-29 14:59:03 +0000
commitc83e27e1a9a2a00f692dc1d92dd0cd1e5b277b41 (patch)
treeb19280b32609fabc7255daf1ffc66bb4968f53ac /tests/tfpif.c
parent4dd6e8019f85e6ccfe509f8c9a2e3a5a195621be (diff)
downloadmpfr-c83e27e1a9a2a00f692dc1d92dd0cd1e5b277b41.tar.gz
[tests/tfpif.c] For mpfr_fpif_import, check the precision too.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@11859 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tfpif.c')
-rw-r--r--tests/tfpif.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/tests/tfpif.c b/tests/tfpif.c
index bff6c4bd1..23bd2da2f 100644
--- a/tests/tfpif.c
+++ b/tests/tfpif.c
@@ -87,9 +87,19 @@ doit (int argc, char *argv[], mpfr_prec_t p1, mpfr_prec_t p2)
for (i = 0; i < 9; i++)
{
+ mpfr_prec_t px, py;
+
mpfr_init2 (y, 2);
mpfr_fpif_import (y, fh);
- /* TODO: also check that y has the expected precision. */
+ px = mpfr_get_prec (x[i]);
+ py = mpfr_get_prec (y);
+ if (px != py)
+ {
+ printf ("doit failed on written number %d: bad precision\n", i);
+ printf ("expected %ld\n", (long) px);
+ printf ("got %ld\n", (long) py);
+ exit (1);
+ }
if (! SAME_VAL (x[i], y))
{
printf ("doit failed on written number %d, exiting...\n", i);
@@ -113,10 +123,20 @@ doit (int argc, char *argv[], mpfr_prec_t p1, mpfr_prec_t p2)
/* the fixed file FILE_NAME_R assumes p1=130 and p2=2048 */
for (i = 0; i < 9 && (p1 == 130 && p2 == 2048); i++)
{
+ mpfr_prec_t px, py;
+
mpfr_init2 (y, 2);
pos = ftell (fh);
mpfr_fpif_import (y, fh);
- /* TODO: also check that y has the expected precision. */
+ px = mpfr_get_prec (x[i]);
+ py = mpfr_get_prec (y);
+ if (px != py)
+ {
+ printf ("doit failed on data number %d: bad precision\n", i);
+ printf ("expected %ld\n", (long) px);
+ printf ("got %ld\n", (long) py);
+ exit (1);
+ }
if (! SAME_VAL (x[i], y))
{
printf ("doit failed on data number %d at offset 0x%lx,"