summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-03-06 11:23:55 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2021-03-06 11:23:55 +0000
commit6c0489c0e6862f097aa2daed30d3fbc410dd955b (patch)
tree83bf34aa2f6672ec3b8e187845c0e8f478a2c100 /tests
parent240ccca217bc37971e2be15137461b25bd264ae1 (diff)
downloadmpfr-6c0489c0e6862f097aa2daed30d3fbc410dd955b.tar.gz
Added tests of mpfr_get_prec and mpfr_get_exp macros.
Without MPFR_USE_NO_MACRO, the compilation of these tests in texceptions.c and tset_exp.c currently fails because the argument is not converted to mpfr_srcptr. git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14453 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/texceptions.c5
-rw-r--r--tests/tset_exp.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/tests/texceptions.c b/tests/texceptions.c
index 94a15bef4..48f4bbe0f 100644
--- a/tests/texceptions.c
+++ b/tests/texceptions.c
@@ -103,10 +103,13 @@ static void
check_get_prec (void)
{
mpfr_t x;
+ int i = 0;
mpfr_init2 (x, 17);
- if (mpfr_get_prec (x) != 17 || (mpfr_get_prec)(x) != 17)
+ if (mpfr_get_prec (x) != 17 || (mpfr_get_prec) (x) != 17 ||
+ mpfr_get_prec ((i++, (void *) x)) != 17)
PRINT_ERROR ("mpfr_get_prec");
+ MPFR_ASSERTN (i == 1);
mpfr_clear (x);
}
diff --git a/tests/tset_exp.c b/tests/tset_exp.c
index 15aba16cb..7eeb4eb0b 100644
--- a/tests/tset_exp.c
+++ b/tests/tset_exp.c
@@ -28,6 +28,7 @@ main (int argc, char *argv[])
mpfr_t x;
int ret;
mpfr_exp_t emin, emax, e;
+ int i = 0;
tests_start_mpfr ();
@@ -62,6 +63,9 @@ main (int argc, char *argv[])
MPFR_ASSERTN (e == emin);
e = (mpfr_get_exp) (x);
MPFR_ASSERTN (e == emin);
+ e = mpfr_get_exp ((i++, (void *) x));
+ MPFR_ASSERTN (e == emin);
+ MPFR_ASSERTN (i == 1);
ret = mpfr_set_exp (x, -1);
MPFR_ASSERTN (ret == 0 && mpfr_cmp_ui_2exp (x, 1, -2) == 0);