diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 23:05:51 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 23:05:51 +0000 |
commit | 6e5ffc68a8061e42a2680dd99455f89e2f4f8ca9 (patch) | |
tree | 3150eedf9dc6ae8d160042147ff46ac533e723dd /tests/tset_si.c | |
parent | f095a6c8a44a63379841097ddfbf4682e56e4036 (diff) | |
download | mpfr-6e5ffc68a8061e42a2680dd99455f89e2f4f8ca9.tar.gz |
new coverage tests
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2714 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tset_si.c')
-rw-r--r-- | tests/tset_si.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/tset_si.c b/tests/tset_si.c index b880fe363..e3e1fb85f 100644 --- a/tests/tset_si.c +++ b/tests/tset_si.c @@ -37,6 +37,7 @@ main (int argc, char *argv[]) unsigned long zl, dl; int inex; mp_rnd_t r; + mp_exp_t emax; tests_start_mpfr (); @@ -152,6 +153,7 @@ main (int argc, char *argv[]) } /* check potential bug in case mp_limb_t is unsigned */ + emax = mpfr_get_emax (); mpfr_set_emax (0); mpfr_set_si (x, -1, GMP_RNDN); if (mpfr_sgn (x) >= 0) @@ -159,7 +161,9 @@ main (int argc, char *argv[]) printf ("mpfr_set_si (x, -1) fails\n"); exit (1); } + mpfr_set_emax (emax); + emax = mpfr_get_emax (); mpfr_set_emax (5); mpfr_set_prec (x, 2); mpfr_set_si (x, -31, GMP_RNDN); @@ -168,6 +172,7 @@ main (int argc, char *argv[]) printf ("mpfr_set_si (x, -31) fails\n"); exit (1); } + mpfr_set_emax (emax); /* test for get_ui */ mpfr_set_ui (x, 0, GMP_RNDN); @@ -176,6 +181,19 @@ main (int argc, char *argv[]) mpfr_nextabove (x); mpfr_get_ui (x, GMP_RNDU); + /* coverage tests */ + mpfr_set_prec (x, 2); + mpfr_set_si (x, -7, GMP_RNDD); + MPFR_ASSERTN(mpfr_cmp_si (x, -8) == 0); + mpfr_set_prec (x, 2); + mpfr_set_ui (x, 7, GMP_RNDU); + MPFR_ASSERTN(mpfr_cmp_ui (x, 8) == 0); + emax = mpfr_get_emax (); + mpfr_set_emax (3); + mpfr_set_ui (x, 7, GMP_RNDU); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); + mpfr_set_emax (emax); + mpfr_clear (x); tests_end_mpfr (); |