aboutsummaryrefslogtreecommitdiff
path: root/math/libm-test.inc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2013-11-16 12:47:38 +0000
committerJoseph Myers <joseph@codesourcery.com>2013-11-16 12:47:38 +0000
commitee1466a953527d550bd0a7eed3ac46ba187ed65f (patch)
treedc41648dd9927d1184ee65b802020eaf4ce6caf6 /math/libm-test.inc
parent14407b7e60d8e8f74ba5751c321051f5f3341cd4 (diff)
downloadglibc-ee1466a953527d550bd0a7eed3ac46ba187ed65f.tar
glibc-ee1466a953527d550bd0a7eed3ac46ba187ed65f.tar.gz
glibc-ee1466a953527d550bd0a7eed3ac46ba187ed65f.tar.bz2
glibc-ee1466a953527d550bd0a7eed3ac46ba187ed65f.zip
Add libm-test support for ignored return value, add more lrint / llrint / lround / llround tests.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r--math/libm-test.inc61
1 files changed, 55 insertions, 6 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc
index cbc9996ed1..790fcc850f 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -178,6 +178,8 @@ struct ulp_data
#define ERRNO_UNCHANGED 0x1000
#define ERRNO_EDOM 0x2000
#define ERRNO_ERANGE 0x4000
+/* Flags generated by gen-libm-test.pl, not entered here manually. */
+#define IGNORE_RESULT 0x8000
/* Values underflowing only for float. */
#ifdef TEST_FLOAT
@@ -726,6 +728,8 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
+ if (exceptions & IGNORE_RESULT)
+ goto out;
FLOAT max_ulp = find_test_ulps (test_name);
if (issignaling (computed) && issignaling (expected))
ok = 1;
@@ -788,6 +792,7 @@ check_float_internal (const char *test_name, FLOAT computed, FLOAT expected,
}
update_stats (ok);
+ out:
fpstack_test (test_name);
errno = 0;
}
@@ -827,9 +832,9 @@ check_complex (const char *test_name, __complex__ FLOAT computed,
part_exp = __imag__ expected;
/* Don't check again for exceptions or errno, just pass through the
- zero/inf sign test. */
+ other relevant flags. */
check_float_internal (str, part_comp, part_exp,
- exception & IGNORE_ZERO_INF_SIGN,
+ exception & (IGNORE_ZERO_INF_SIGN | IGNORE_RESULT),
&imag_max_error);
free (str);
}
@@ -845,6 +850,8 @@ check_int (const char *test_name, int computed, int expected,
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
+ if (exceptions & IGNORE_RESULT)
+ goto out;
noTests++;
if (computed == expected)
ok = 1;
@@ -860,6 +867,7 @@ check_int (const char *test_name, int computed, int expected,
}
update_stats (ok);
+ out:
fpstack_test (test_name);
errno = 0;
}
@@ -875,6 +883,8 @@ check_long (const char *test_name, long int computed, long int expected,
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
+ if (exceptions & IGNORE_RESULT)
+ goto out;
noTests++;
if (computed == expected)
ok = 1;
@@ -890,6 +900,7 @@ check_long (const char *test_name, long int computed, long int expected,
}
update_stats (ok);
+ out:
fpstack_test (test_name);
errno = 0;
}
@@ -905,6 +916,8 @@ check_bool (const char *test_name, int computed, int expected,
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
+ if (exceptions & IGNORE_RESULT)
+ goto out;
noTests++;
if ((computed == 0) == (expected == 0))
ok = 1;
@@ -920,6 +933,7 @@ check_bool (const char *test_name, int computed, int expected,
}
update_stats (ok);
+ out:
fpstack_test (test_name);
errno = 0;
}
@@ -936,6 +950,8 @@ check_longlong (const char *test_name, long long int computed,
test_exceptions (test_name, exceptions);
test_errno (test_name, errno_value, exceptions);
+ if (exceptions & IGNORE_RESULT)
+ goto out;
noTests++;
if (computed == expected)
ok = 1;
@@ -951,6 +967,7 @@ check_longlong (const char *test_name, long long int computed,
}
update_stats (ok);
+ out:
fpstack_test (test_name);
errno = 0;
}
@@ -10112,7 +10129,9 @@ static const struct test_f_l_data lrint_test_data[] =
/* XXX this test is incomplete. We need to have a way to specifiy
the rounding method and test the critical cases. So far, only
unproblematic numbers are tested. */
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ TEST_f_l (lrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10144,6 +10163,9 @@ lrint_test (void)
static const struct test_f_l_data lrint_tonearest_test_data[] =
{
+ TEST_f_l (lrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10179,6 +10201,9 @@ lrint_test_tonearest (void)
static const struct test_f_l_data lrint_towardzero_test_data[] =
{
+ TEST_f_l (lrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10214,6 +10239,9 @@ lrint_test_towardzero (void)
static const struct test_f_l_data lrint_downward_test_data[] =
{
+ TEST_f_l (lrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10249,6 +10277,9 @@ lrint_test_downward (void)
static const struct test_f_l_data lrint_upward_test_data[] =
{
+ TEST_f_l (lrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_l (lrint, 0.2L, 1, INEXACT_EXCEPTION),
@@ -10287,7 +10318,9 @@ static const struct test_f_L_data llrint_test_data[] =
/* XXX this test is incomplete. We need to have a way to specifiy
the rounding method and test the critical cases. So far, only
unproblematic numbers are tested. */
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ TEST_f_L (llrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10423,6 +10456,9 @@ llrint_test (void)
static const struct test_f_L_data llrint_tonearest_test_data[] =
{
+ TEST_f_L (llrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10558,6 +10594,9 @@ llrint_test_tonearest (void)
static const struct test_f_L_data llrint_towardzero_test_data[] =
{
+ TEST_f_L (llrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10693,6 +10732,9 @@ llrint_test_towardzero (void)
static const struct test_f_L_data llrint_downward_test_data[] =
{
+ TEST_f_L (llrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, 0.2L, 0, INEXACT_EXCEPTION),
@@ -10824,6 +10866,9 @@ llrint_test_downward (void)
static const struct test_f_L_data llrint_upward_test_data[] =
{
+ TEST_f_L (llrint, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llrint, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llrint, 0.0, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, minus_zero, 0, NO_INEXACT_EXCEPTION),
TEST_f_L (llrint, 0.2L, 1, INEXACT_EXCEPTION),
@@ -11135,7 +11180,9 @@ logb_test_downward (void)
static const struct test_f_l_data lround_test_data[] =
{
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ TEST_f_l (lround, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lround, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_l (lround, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_l (lround, 0, 0),
TEST_f_l (lround, minus_zero, 0),
TEST_f_l (lround, 0.2L, 0.0),
@@ -11182,7 +11229,9 @@ lround_test (void)
static const struct test_f_L_data llround_test_data[] =
{
- /* TODO: missing +/-Inf as well as qNaN tests. */
+ TEST_f_L (llround, plus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llround, minus_infty, IGNORE, INVALID_EXCEPTION),
+ TEST_f_L (llround, qnan_value, IGNORE, INVALID_EXCEPTION),
TEST_f_L (llround, 0, 0),
TEST_f_L (llround, minus_zero, 0),
TEST_f_L (llround, 0.2L, 0.0),