diff options
Diffstat (limited to 'tests/tzeta.c')
-rw-r--r-- | tests/tzeta.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/tzeta.c b/tests/tzeta.c index b23902f2f..56c25c4d9 100644 --- a/tests/tzeta.c +++ b/tests/tzeta.c @@ -26,10 +26,13 @@ static void test1 (void) { mpfr_t x, y; + int inex; mpfr_init2 (x, 32); mpfr_init2 (y, 42); + mpfr_clear_flags (); + mpfr_set_str_binary (x, "1.1111111101000111011010010010100e-1"); mpfr_zeta (y, x, MPFR_RNDN); /* shouldn't crash */ @@ -91,18 +94,29 @@ test1 (void) mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui_2exp (y, 3, -1) == 0); - mpfr_set_nan (x); - mpfr_zeta (y, x, MPFR_RNDN); - MPFR_ASSERTN(mpfr_nan_p (y)); + /* yet another coverage test (case beta <= 0.0) */ + mpfr_set_prec (x, 10); + mpfr_set_ui (x, 23, MPFR_RNDN); + mpfr_set_prec (y, 15); + inex = mpfr_zeta (y, x, MPFR_RNDN); + MPFR_ASSERTN(inex < 0); + MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); mpfr_set_inf (x, 1); mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_cmp_ui (y, 1) == 0); + /* Since some tests don't really check that the result is not NaN... */ + MPFR_ASSERTN (! mpfr_nanflag_p ()); + mpfr_set_inf (x, -1); mpfr_zeta (y, x, MPFR_RNDN); MPFR_ASSERTN(mpfr_nan_p (y)); + mpfr_set_nan (x); + mpfr_zeta (y, x, MPFR_RNDN); + MPFR_ASSERTN(mpfr_nan_p (y)); + mpfr_clear (x); mpfr_clear (y); } |