diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-03-15 11:23:25 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2011-03-15 11:23:25 +0000 |
commit | 3a593cc9f636de8f6d698e0f60d38e145d041a97 (patch) | |
tree | cf2d1e691ac96a784b17bed59fbb1b36e9b1b3b1 /tests/tgeneric.c | |
parent | af1087a7a9a4f42f22667597ee77e96716011af6 (diff) | |
download | mpfr-3a593cc9f636de8f6d698e0f60d38e145d041a97.tar.gz |
[tests/tgeneric.c] In failure messages, output the name of the
tested function. This is useful for programs that have generic
tests for several functions, such as terf.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@7571 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgeneric.c')
-rw-r--r-- | tests/tgeneric.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/tests/tgeneric.c b/tests/tgeneric.c index 6e560dc34..3cbdbb66a 100644 --- a/tests/tgeneric.c +++ b/tests/tgeneric.c @@ -50,6 +50,9 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., #define TGENERIC_SO_TEST 1 #endif +#define STR(F) #F +#define MAKE_STR(S) STR(S) + /* The (void *) below is needed to avoid a warning with gcc 4.2+ and functions * with 2 arguments. See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36299>. */ @@ -72,17 +75,20 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., } \ while (0) +#define TGENERIC_CHECK_AUX(S, EXPR, U) \ + do \ + if (!(EXPR)) \ + TGENERIC_FAIL (S " in " MAKE_STR(TEST_FUNCTION), x, U); \ + while (0) + #undef TGENERIC_CHECK #if defined(TWO_ARGS) || defined(DOUBLE_ARG1) || defined(DOUBLE_ARG2) -#define TGENERIC_CHECK(S, EXPR) \ - do if (!(EXPR)) TGENERIC_FAIL (S, x, u); while (0) +#define TGENERIC_CHECK(S, EXPR) TGENERIC_CHECK_AUX(S, EXPR, u) #else -#define TGENERIC_CHECK(S, EXPR) \ - do if (!(EXPR)) TGENERIC_FAIL (S, x, 0); while (0) +#define TGENERIC_CHECK(S, EXPR) TGENERIC_CHECK_AUX(S, EXPR, 0) #endif #ifdef DEBUG_TGENERIC -#define STR(F) #F #define TGENERIC_IAUX(F,P,X,U) \ do \ { \ @@ -299,7 +305,8 @@ test_generic (mpfr_prec_t p0, mpfr_prec_t p1, unsigned int N) SAME_SIGN (inexact, compare) && flags == oldflags)) { - printf ("Error in reduced exponent range [%" + printf ("Error in " MAKE_STR(TEST_FUNCTION) + ", reduced exponent range [%" MPFR_EXP_FSPEC "d,%" MPFR_EXP_FSPEC "d] on:\n", (mpfr_eexp_t) emin, (mpfr_eexp_t) emax); printf ("x = "); |