This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Consistently use TEST_f_f1 in lgamma tests


Some of the lgamma tests in libm-test.inc use the standard
libm-test.inc facility (supported by gen-libm-test.pl) to check the
value of an implicitly set variable or something set through a pointer
(gen-libm-test.pl knows that in the lgamma case it's signgam that
needs testing).  Some others have manual check_int calls, while some
don't test the value of signgam at all.

For tests to go in data rather than code, it's desirable for all tests
of the same function to use the same mechanism.  This patch makes the
tests of lgamma all use TEST_f_f1, with the existing IGNORE mechanism
being used for the cases (-Inf, NaN, negative integers) where POSIX
says the resulting signgam value is unspecified.  Tested x86_64 and
x86.

After this patch, there are no manual check_* calls in the tests for
individual functions (most were eliminated by my patch that moved
errno tests to being specified by flags rather than manual check_int
calls).

2013-05-03  Joseph Myers  <joseph@codesourcery.com>

	* math/libm-test.inc (lgamma_test): Consistently use TEST_f_f1 to
	test signgam value.

diff --git a/math/libm-test.inc b/math/libm-test.inc
index 8feb0a6..90a21c1 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -9644,18 +9644,16 @@ lgamma_test (void)
 
   START (lgamma);
 
-  TEST_f_f (lgamma, plus_infty, plus_infty);
-  TEST_f_f (lgamma, 0, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
-  check_int ("signgam for lgamma(0) == 1", signgam, 1, 0, 0, 0);
-  TEST_f_f (lgamma, minus_zero, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
-  check_int ("signgam for lgamma(-0) == -1", signgam, -1, 0, 0, 0);
-  TEST_f_f (lgamma, qnan_value, qnan_value);
+  TEST_f_f1 (lgamma, plus_infty, plus_infty, 1);
+  TEST_f_f1 (lgamma, 0, plus_infty, 1, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f1 (lgamma, minus_zero, plus_infty, -1, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f1 (lgamma, qnan_value, qnan_value, IGNORE);
 
   /* lgamma (x) == +inf plus divide by zero exception for integer x <= 0.  */
-  TEST_f_f (lgamma, -3, plus_infty, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE);
-  TEST_f_f (lgamma, minus_infty, plus_infty);
-  TEST_f_f (lgamma, -max_value, plus_infty, DIVIDE_BY_ZERO_EXCEPTION);
-  TEST_f_f (lgamma, max_value, plus_infty, OVERFLOW_EXCEPTION);
+  TEST_f_f1 (lgamma, -3, plus_infty, IGNORE, DIVIDE_BY_ZERO_EXCEPTION|ERRNO_ERANGE);
+  TEST_f_f1 (lgamma, minus_infty, plus_infty, IGNORE);
+  TEST_f_f1 (lgamma, -max_value, plus_infty, IGNORE, DIVIDE_BY_ZERO_EXCEPTION);
+  TEST_f_f1 (lgamma, max_value, plus_infty, 1, OVERFLOW_EXCEPTION);
 
   TEST_f_f1 (lgamma, 1, 0, 1);
 

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]