diff options
author | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 11:11:31 +0000 |
---|---|---|
committer | zimmerma <zimmerma@280ebfd0-de03-0410-8827-d642c229c3f4> | 2004-02-14 11:11:31 +0000 |
commit | f095a6c8a44a63379841097ddfbf4682e56e4036 (patch) | |
tree | ff27c1422f6c4e9e704d35ffc9953571a796f11c /tests/tlog2.c | |
parent | aedeae287d6c8de47317f93227626653a622d3ee (diff) | |
download | mpfr-f095a6c8a44a63379841097ddfbf4682e56e4036.tar.gz |
improved coverage test
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2713 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tlog2.c')
-rw-r--r-- | tests/tlog2.c | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/tests/tlog2.c b/tests/tlog2.c index 5f6be8d35..8ecf1a574 100644 --- a/tests/tlog2.c +++ b/tests/tlog2.c @@ -1,6 +1,6 @@ /* Test file for mpfr_log2. -Copyright 2001, 2002 Free Software Foundation. +Copyright 2001, 2002, 2004 Free Software Foundation. Adapted from tsinh.c. This file is part of the MPFR Library. @@ -28,11 +28,51 @@ MA 02111-1307, USA. */ #define TEST_FUNCTION mpfr_log2 #include "tgeneric.c" +static void +special (void) +{ + mpfr_t x; + + mpfr_init (x); + + mpfr_set_nan (x); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_nan_p (x)); + + mpfr_set_inf (x, -1); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_nan_p (x)); + + mpfr_set_inf (x, 1); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) > 0); + + mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); + mpfr_set_ui (x, 0, GMP_RNDN); + mpfr_neg (x, x, GMP_RNDN); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_inf_p (x) && mpfr_sgn (x) < 0); + + mpfr_set_si (x, -1, GMP_RNDN); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_nan_p (x)); + + mpfr_set_si (x, 1, GMP_RNDN); + mpfr_log2 (x, x, GMP_RNDN); + MPFR_ASSERTN(mpfr_cmp_ui (x, 0) == 0 && MPFR_IS_POS(x)); + + mpfr_clear (x); +} + int main (int argc, char *argv[]) { tests_start_mpfr (); + special (); + test_generic (2, 100, 30); tests_end_mpfr (); |