Use ALL_RM_TEST for more libm tests
diff mbox

Message ID Pine.LNX.4.64.1403191554030.14867@digraph.polyomino.org.uk
State New
Headers show

Commit Message

Joseph Myers March 19, 2014, 3:55 p.m. UTC
Continuing the move to using ALL_RM_TEST for tests in libm-test.inc,
this patch converts the tests of fdim, ldexp and scalb.  fdim and
scalb are cases where tests could depend on the rounding mode though
none of the present test inputs do; ldexp is such a case where the
function is equivalent to scalbn (for binary floating point) and the
tests used were a subset of those for scalbn, so this patch makes
ldexp testing use the scalbn tests, as done for other cases of libm
function aliases.

Tested x86_64 and x86.

2014-03-19  Joseph Myers  <joseph@codesourcery.com>

	* math/libm-test.inc (fdim_test): Use ALL_RM_TEST.
	(ldexp_test_data): Remove.
	(ldexp_test): Move to after scalbn_test.  Use ALL_RM_TEST with
	scalbn_test_data.
	(scalb_test): Use ALL_RM_TEST.

Comments

Andreas Jaeger March 19, 2014, 4:08 p.m. UTC | #1
On 03/19/2014 04:55 PM, Joseph S. Myers wrote:
> Continuing the move to using ALL_RM_TEST for tests in libm-test.inc,
> this patch converts the tests of fdim, ldexp and scalb.  fdim and
> scalb are cases where tests could depend on the rounding mode though
> none of the present test inputs do; ldexp is such a case where the
> function is equivalent to scalbn (for binary floating point) and the
> tests used were a subset of those for scalbn, so this patch makes
> ldexp testing use the scalbn tests, as done for other cases of libm
> function aliases.

nice, thanks,

Andreas

Patch
diff mbox

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 5ad0255..47c162f 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -7445,9 +7445,7 @@  static const struct test_ff_f_data fdim_test_data[] =
 static void
 fdim_test (void)
 {
-  START (fdim, 1);
-  RUN_TEST_LOOP_ff_f (fdim, fdim_test_data, );
-  END;
+  ALL_RM_TEST (fdim, 1, fdim_test_data, RUN_TEST_LOOP_ff_f, END);
 }
 
 
@@ -8169,31 +8167,6 @@  jn_test (void)
 }
 
 
-static const struct test_fi_f_data ldexp_test_data[] =
-  {
-    TEST_fi_f (ldexp, 0, 0, 0, NO_INEXACT_EXCEPTION),
-    TEST_fi_f (ldexp, minus_zero, 0, minus_zero, NO_INEXACT_EXCEPTION),
-
-    TEST_fi_f (ldexp, plus_infty, 1, plus_infty, NO_INEXACT_EXCEPTION),
-    TEST_fi_f (ldexp, minus_infty, 1, minus_infty, NO_INEXACT_EXCEPTION),
-    TEST_fi_f (ldexp, qnan_value, 1, qnan_value, NO_INEXACT_EXCEPTION),
-
-    TEST_fi_f (ldexp, 0.8L, 4, 12.8L, NO_INEXACT_EXCEPTION),
-    TEST_fi_f (ldexp, -0.854375L, 5, -27.34L, NO_INEXACT_EXCEPTION),
-
-    /* ldexp (x, 0) == x.  */
-    TEST_fi_f (ldexp, 1.0L, 0L, 1.0L, NO_INEXACT_EXCEPTION),
-  };
-
-static void
-ldexp_test (void)
-{
-  START (ldexp, 1);
-  RUN_TEST_LOOP_fi_f (ldexp, ldexp_test_data, );
-  END;
-}
-
-
 static const struct test_f_f1_data lgamma_test_data[] =
   {
     TEST_f_f1 (lgamma, plus_infty, plus_infty, 1),
@@ -9784,10 +9757,7 @@  static const struct test_ff_f_data scalb_test_data[] =
 static void
 scalb_test (void)
 {
-
-  START (scalb, 1);
-  RUN_TEST_LOOP_ff_f (scalb, scalb_test_data, );
-  END;
+  ALL_RM_TEST (scalb, 1, scalb_test_data, RUN_TEST_LOOP_ff_f, END);
 }
 
 
@@ -9830,6 +9800,13 @@  scalbn_test (void)
   ALL_RM_TEST (scalbn, 1, scalbn_test_data, RUN_TEST_LOOP_fi_f, END);
 }
 
+static void
+ldexp_test (void)
+{
+  /* ldexp uses the same test data as scalbn.  */
+  ALL_RM_TEST (ldexp, 1, scalbn_test_data, RUN_TEST_LOOP_fi_f, END);
+}
+
 
 static const struct test_fl_f_data scalbln_test_data[] =
   {