summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-07-25 15:34:52 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2007-07-25 15:34:52 +0000
commit9164d6d1a96a3754a18d4b8ce9adb42344f82d71 (patch)
treea6904cc8b88d7e70ab1683f246a876d9f6acc62b /tests
parenta2ac23f46673b004955503dbd29f8ec005256e3d (diff)
downloadmpfr-9164d6d1a96a3754a18d4b8ce9adb42344f82d71.tar.gz
No longer use MPFR_CHECK_ALL in tests. In '-dev' versions, assume
that the data files exist and return an error whenever a file cannot be opened. In the other versions, return silently if the file cannot be opened. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@4701 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests')
-rw-r--r--tests/tacos.c3
-rw-r--r--tests/tacosh.c3
-rw-r--r--tests/tasin.c3
-rw-r--r--tests/tasinh.c3
-rw-r--r--tests/tatan.c3
-rw-r--r--tests/tatanh.c3
-rw-r--r--tests/tcos.c3
-rw-r--r--tests/tcosh.c3
-rw-r--r--tests/terf.c7
-rw-r--r--tests/tests.c16
-rw-r--r--tests/texp.c3
-rw-r--r--tests/texp2.c3
-rw-r--r--tests/tgamma.c3
-rw-r--r--tests/tj0.c3
-rw-r--r--tests/tj1.c3
-rw-r--r--tests/tlgamma.c3
-rw-r--r--tests/tlog.c3
-rw-r--r--tests/tlog10.c3
-rw-r--r--tests/tmul.c3
-rw-r--r--tests/tpow.c3
-rw-r--r--tests/tsin.c3
-rw-r--r--tests/tsinh.c3
-rw-r--r--tests/tsqrt.c3
-rw-r--r--tests/ttan.c3
-rw-r--r--tests/ttanh.c3
-rw-r--r--tests/tui_div.c3
-rw-r--r--tests/ty0.c3
-rw-r--r--tests/ty1.c3
28 files changed, 42 insertions, 59 deletions
diff --git a/tests/tacos.c b/tests/tacos.c
index 5d3177a06..26a148937 100644
--- a/tests/tacos.c
+++ b/tests/tacos.c
@@ -179,8 +179,7 @@ main (void)
mpfr_clear (x);
mpfr_clear (y);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/acos", mpfr_acos, "mpfr_acos");
+ data_check ("data/acos", mpfr_acos, "mpfr_acos");
tests_end_mpfr ();
return 0;
diff --git a/tests/tacosh.c b/tests/tacosh.c
index b4f4e6772..75555fbf4 100644
--- a/tests/tacosh.c
+++ b/tests/tacosh.c
@@ -132,8 +132,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 25);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/acosh", mpfr_acosh, "mpfr_acosh");
+ data_check ("data/acosh", mpfr_acosh, "mpfr_acosh");
tests_end_mpfr ();
return 0;
diff --git a/tests/tasin.c b/tests/tasin.c
index 1fdd9cc33..3dd56c7e9 100644
--- a/tests/tasin.c
+++ b/tests/tasin.c
@@ -206,8 +206,7 @@ main (void)
tests_end_mpfr ();
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/asin", mpfr_asin, "mpfr_asin");
+ data_check ("data/asin", mpfr_asin, "mpfr_asin");
return 0;
}
diff --git a/tests/tasinh.c b/tests/tasinh.c
index ff15833f2..1b4412cf0 100644
--- a/tests/tasinh.c
+++ b/tests/tasinh.c
@@ -140,8 +140,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 25);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/asinh", mpfr_asinh, "mpfr_asinh");
+ data_check ("data/asinh", mpfr_asinh, "mpfr_asinh");
tests_end_mpfr ();
return 0;
diff --git a/tests/tatan.c b/tests/tatan.c
index ba8511bdd..acff7e46d 100644
--- a/tests/tatan.c
+++ b/tests/tatan.c
@@ -387,8 +387,7 @@ main (int argc, char *argv[])
test_generic_atan2 (2, 200, 17);
test_generic_atan2_neg (2, 200, 17);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/atan", mpfr_atan, "mpfr_atan");
+ data_check ("data/atan", mpfr_atan, "mpfr_atan");
tests_end_mpfr ();
return 0;
diff --git a/tests/tatanh.c b/tests/tatanh.c
index 0c146aa44..efd098c31 100644
--- a/tests/tatanh.c
+++ b/tests/tatanh.c
@@ -179,8 +179,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 25);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/atanh", mpfr_atanh, "mpfr_atanh");
+ data_check ("data/atanh", mpfr_atanh, "mpfr_atanh");
tests_end_mpfr ();
return 0;
diff --git a/tests/tcos.c b/tests/tcos.c
index 4a983132d..af153d22a 100644
--- a/tests/tcos.c
+++ b/tests/tcos.c
@@ -360,8 +360,7 @@ main (int argc, char *argv[])
mpfr_clear (x);
mpfr_clear (y);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/cos", mpfr_cos, "mpfr_cos");
+ data_check ("data/cos", mpfr_cos, "mpfr_cos");
tests_end_mpfr ();
return 0;
diff --git a/tests/tcosh.c b/tests/tcosh.c
index f1ce72fc1..5e797f8fb 100644
--- a/tests/tcosh.c
+++ b/tests/tcosh.c
@@ -194,8 +194,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 100);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/cosh", mpfr_cosh, "mpfr_cosh");
+ data_check ("data/cosh", mpfr_cosh, "mpfr_cosh");
tests_end_mpfr ();
return 0;
diff --git a/tests/terf.c b/tests/terf.c
index 847f0c00c..90f1be319 100644
--- a/tests/terf.c
+++ b/tests/terf.c
@@ -551,11 +551,8 @@ main (int argc, char *argv[])
test_generic_erf (2, 100, 15);
test_generic_erfc (2, 100, 15);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- {
- data_check ("data/erf", mpfr_erf, "mpfr_erf");
- data_check ("data/erfc", mpfr_erfc, "mpfr_erfc");
- }
+ data_check ("data/erf", mpfr_erf, "mpfr_erf");
+ data_check ("data/erfc", mpfr_erfc, "mpfr_erfc");
tests_end_mpfr ();
return 0;
diff --git a/tests/tests.c b/tests/tests.c
index bd0d23ad7..3dbff2fda 100644
--- a/tests/tests.c
+++ b/tests/tests.c
@@ -441,8 +441,20 @@ data_check (char *f, int (*foo) (), char *name)
fp = fopen (f, "r");
if (fp == NULL)
{
- printf ("Error: unable to open file '%s'\n", f);
- exit (1);
+ char *v = MPFR_VERSION_STRING;
+
+ /* In the '-dev' versions, assume that the data file exists and
+ return an error if the file cannot be opened to make sure
+ that such failures are detected. */
+ while (*v != '\0')
+ v++;
+ if (v[-4] == '-' && v[-3] == 'd' && v[-2] == 'e' && v[-1] == 'v')
+ {
+ printf ("Error: unable to open file '%s'\n", f);
+ exit (1);
+ }
+ else
+ return;
}
mpfr_init (x);
diff --git a/tests/texp.c b/tests/texp.c
index addd5c161..6a14cf743 100644
--- a/tests/texp.c
+++ b/tests/texp.c
@@ -642,8 +642,7 @@ main (int argc, char *argv[])
overflowed_exp0 ();
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/exp", mpfr_exp, "mpfr_exp");
+ data_check ("data/exp", mpfr_exp, "mpfr_exp");
tests_end_mpfr ();
return 0;
diff --git a/tests/texp2.c b/tests/texp2.c
index 6aaad33b3..09a40ed16 100644
--- a/tests/texp2.c
+++ b/tests/texp2.c
@@ -350,8 +350,7 @@ main (int argc, char *argv[])
overflowed_exp2_0 ();
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/exp2", mpfr_exp2, "mpfr_exp2");
+ data_check ("data/exp2", mpfr_exp2, "mpfr_exp2");
tests_end_mpfr ();
return 0;
diff --git a/tests/tgamma.c b/tests/tgamma.c
index b24751a2c..1e3f0ef33 100644
--- a/tests/tgamma.c
+++ b/tests/tgamma.c
@@ -440,8 +440,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 2);
gamma_integer ();
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
+ data_check ("data/gamma", mpfr_gamma, "mpfr_gamma");
tests_end_mpfr ();
return 0;
diff --git a/tests/tj0.c b/tests/tj0.c
index 5c820031f..0b444a07a 100644
--- a/tests/tj0.c
+++ b/tests/tj0.c
@@ -96,8 +96,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 10);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/j0", mpfr_j0, "mpfr_j0");
+ data_check ("data/j0", mpfr_j0, "mpfr_j0");
tests_end_mpfr ();
diff --git a/tests/tj1.c b/tests/tj1.c
index 8dd7b8da6..3dbc553a5 100644
--- a/tests/tj1.c
+++ b/tests/tj1.c
@@ -80,8 +80,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 10);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/j1", mpfr_j1, "mpfr_j1");
+ data_check ("data/j1", mpfr_j1, "mpfr_j1");
tests_end_mpfr ();
diff --git a/tests/tlgamma.c b/tests/tlgamma.c
index 55c5e851b..095204911 100644
--- a/tests/tlgamma.c
+++ b/tests/tlgamma.c
@@ -367,8 +367,7 @@ main (void)
special ();
test_generic (2, 100, 2);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma");
+ data_check ("data/lgamma", mpfr_lgamma1, "mpfr_lgamma");
tests_end_mpfr ();
return 0;
diff --git a/tests/tlog.c b/tests/tlog.c
index f08bcac67..d56500941 100644
--- a/tests/tlog.c
+++ b/tests/tlog.c
@@ -327,8 +327,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 40);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/log", mpfr_log, "mpfr_log");
+ data_check ("data/log", mpfr_log, "mpfr_log");
done:
tests_end_mpfr ();
diff --git a/tests/tlog10.c b/tests/tlog10.c
index c19780e02..ffdf28e58 100644
--- a/tests/tlog10.c
+++ b/tests/tlog10.c
@@ -114,8 +114,7 @@ main (int argc, char *argv[])
mpfr_clear (x);
mpfr_clear (y);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/log10", mpfr_log10, "mpfr_log10");
+ data_check ("data/log10", mpfr_log10, "mpfr_log10");
tests_end_mpfr ();
return 0;
diff --git a/tests/tmul.c b/tests/tmul.c
index 0dd7685d7..1495bcfe9 100644
--- a/tests/tmul.c
+++ b/tests/tmul.c
@@ -696,8 +696,7 @@ main (int argc, char *argv[])
check_regression ();
test_generic (2, 500, 100);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi");
+ data_check ("data/mulpi", mpfr_mulpi, "mpfr_mulpi");
tests_end_mpfr ();
return 0;
diff --git a/tests/tpow.c b/tests/tpow.c
index 74adabaa9..2395acea2 100644
--- a/tests/tpow.c
+++ b/tests/tpow.c
@@ -898,8 +898,7 @@ main (void)
test_generic_ui (2, 100, 100);
test_generic_si (2, 100, 100);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/pow275", mpfr_pow275, "mpfr_pow275");
+ data_check ("data/pow275", mpfr_pow275, "mpfr_pow275");
tests_end_mpfr ();
return 0;
diff --git a/tests/tsin.c b/tests/tsin.c
index 318a9cda4..633d97e90 100644
--- a/tests/tsin.c
+++ b/tests/tsin.c
@@ -360,8 +360,7 @@ main (int argc, char *argv[])
test_sign ();
check_tiny ();
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/sin", mpfr_sin, "mpfr_sin");
+ data_check ("data/sin", mpfr_sin, "mpfr_sin");
tests_end_mpfr ();
return 0;
diff --git a/tests/tsinh.c b/tests/tsinh.c
index 8a666c6eb..a4457f624 100644
--- a/tests/tsinh.c
+++ b/tests/tsinh.c
@@ -98,8 +98,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 100);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/sinh", mpfr_sinh, "mpfr_sinh");
+ data_check ("data/sinh", mpfr_sinh, "mpfr_sinh");
tests_end_mpfr ();
return 0;
diff --git a/tests/tsqrt.c b/tests/tsqrt.c
index 8f559773b..20f88ec18 100644
--- a/tests/tsqrt.c
+++ b/tests/tsqrt.c
@@ -672,8 +672,7 @@ main (void)
check4 ("72154663483843080704304789585920.0", GMP_RNDD,
"1.e2d9a51977e6d@13");
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt");
+ data_check ("data/sqrt", mpfr_sqrt, "mpfr_sqrt");
tests_end_mpfr ();
return 0;
diff --git a/tests/ttan.c b/tests/ttan.c
index e3ce8c11c..1f7befc42 100644
--- a/tests/ttan.c
+++ b/tests/ttan.c
@@ -155,8 +155,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 10);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/tan", mpfr_tan, "mpfr_tan");
+ data_check ("data/tan", mpfr_tan, "mpfr_tan");
tests_end_mpfr ();
return 0;
diff --git a/tests/ttanh.c b/tests/ttanh.c
index 2426d472f..a5f8683f3 100644
--- a/tests/ttanh.c
+++ b/tests/ttanh.c
@@ -127,8 +127,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 100);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/tanh", mpfr_tanh, "mpfr_tanh");
+ data_check ("data/tanh", mpfr_tanh, "mpfr_tanh");
tests_end_mpfr ();
return 0;
diff --git a/tests/tui_div.c b/tests/tui_div.c
index 80cdbe7c9..c037776ac 100644
--- a/tests/tui_div.c
+++ b/tests/tui_div.c
@@ -185,8 +185,7 @@ main (int argc, char *argv[])
"-6.8938315017943889615e-297");
/* inv is for 1/x */
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/inv", mpfr_inv, "mpfr_ui_div(1,x)");
+ data_check ("data/inv", mpfr_inv, "mpfr_ui_div(1,x)");
tests_end_mpfr ();
return 0;
diff --git a/tests/ty0.c b/tests/ty0.c
index 5f09c9ea9..a9230451a 100644
--- a/tests/ty0.c
+++ b/tests/ty0.c
@@ -90,8 +90,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 1);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/y0", mpfr_y0, "mpfr_y0");
+ data_check ("data/y0", mpfr_y0, "mpfr_y0");
tests_end_mpfr ();
diff --git a/tests/ty1.c b/tests/ty1.c
index bec334ca0..6d7d447b7 100644
--- a/tests/ty1.c
+++ b/tests/ty1.c
@@ -90,8 +90,7 @@ main (int argc, char *argv[])
test_generic (2, 100, 1);
- if (getenv ("MPFR_CHECK_ALL") != NULL)
- data_check ("data/y1", mpfr_y1, "mpfr_y1");
+ data_check ("data/y1", mpfr_y1, "mpfr_y1");
tests_end_mpfr ();