Make libm-test.inc test comparison macros.

This commit is contained in:
Joseph Myers 2012-10-09 23:34:12 +00:00
parent 7f82e4f470
commit 0e8e0c1c93
3 changed files with 176 additions and 2 deletions

View File

@ -1,3 +1,17 @@
2012-10-09 Joseph Myers <joseph@codesourcery.com>
* math/gen-libm-test.pl (parse_args): Handle comparison macros as
type-generic.
* math/libm-test.inc: Update comment listing what functions and
macros are tested.
(isgreater_test): New function.
(isgreaterequal_test): Likewise.
(isless_test): Likewise.
(islessequal_test): Likewise.
(islessgreater_test): Likewise.
(isunordered_test): Likewise.
(main): Call the new functions.
2012-10-09 Roland McGrath <roland@hack.frob.com>
* aclocal.m4 (GLIBC_PROVIDES): Provide _AS_BASENAME_PREPARE,

View File

@ -320,7 +320,9 @@ sub parse_args {
}
# Special handling for some macros:
$cline .= " (\"$str\", ";
if ($args[0] =~ /fpclassify|isnormal|isfinite|isinf|isnan|signbit/) {
if ($args[0] =~ /fpclassify|isnormal|isfinite|isinf|isnan|signbit
|isgreater|isgreaterequal|isless|islessequal
|islessgreater|isunordered/x) {
$c_call = "$args[0] (";
} else {
$c_call = " FUNC($args[0]) (";

View File

@ -43,6 +43,7 @@
fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
frexp, gamma, hypot,
ilogb, isfinite, isinf, isnan, isnormal,
isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
j0, j1, jn,
ldexp, lgamma, log, log10, log1p, log2, logb,
modf, nearbyint, nextafter, nexttoward,
@ -58,7 +59,6 @@
At the moment the following functions and macros aren't tested:
drem (alias for remainder),
isless, islessequal, isgreater, isgreaterequal, islessgreater, isunordered,
lgamma_r,
nan,
pow10 (alias for exp10).
@ -5137,6 +5137,56 @@ isfinite_test (void)
END (isfinite);
}
static void
isgreater_test (void)
{
START (isgreater);
TEST_ff_i (isgreater, minus_zero, minus_zero, 0);
TEST_ff_i (isgreater, minus_zero, plus_zero, 0);
TEST_ff_i (isgreater, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreater, minus_zero, nan_value, 0);
TEST_ff_i (isgreater, plus_zero, minus_zero, 0);
TEST_ff_i (isgreater, plus_zero, plus_zero, 0);
TEST_ff_i (isgreater, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreater, plus_zero, nan_value, 0);
TEST_ff_i (isgreater, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (isgreater, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (isgreater, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isgreater, (FLOAT) 1, nan_value, 0);
TEST_ff_i (isgreater, nan_value, minus_zero, 0);
TEST_ff_i (isgreater, nan_value, plus_zero, 0);
TEST_ff_i (isgreater, nan_value, (FLOAT) 1, 0);
TEST_ff_i (isgreater, nan_value, nan_value, 0);
END (isgreater);
}
static void
isgreaterequal_test (void)
{
START (isgreaterequal);
TEST_ff_i (isgreaterequal, minus_zero, minus_zero, 1);
TEST_ff_i (isgreaterequal, minus_zero, plus_zero, 1);
TEST_ff_i (isgreaterequal, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreaterequal, minus_zero, nan_value, 0);
TEST_ff_i (isgreaterequal, plus_zero, minus_zero, 1);
TEST_ff_i (isgreaterequal, plus_zero, plus_zero, 1);
TEST_ff_i (isgreaterequal, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isgreaterequal, plus_zero, nan_value, 0);
TEST_ff_i (isgreaterequal, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, (FLOAT) 1, 1);
TEST_ff_i (isgreaterequal, (FLOAT) 1, nan_value, 0);
TEST_ff_i (isgreaterequal, nan_value, minus_zero, 0);
TEST_ff_i (isgreaterequal, nan_value, plus_zero, 0);
TEST_ff_i (isgreaterequal, nan_value, (FLOAT) 1, 0);
TEST_ff_i (isgreaterequal, nan_value, nan_value, 0);
END (isgreaterequal);
}
static void
isinf_test (void)
{
@ -5153,6 +5203,81 @@ isinf_test (void)
END (isinf);
}
static void
isless_test (void)
{
START (isless);
TEST_ff_i (isless, minus_zero, minus_zero, 0);
TEST_ff_i (isless, minus_zero, plus_zero, 0);
TEST_ff_i (isless, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (isless, minus_zero, nan_value, 0);
TEST_ff_i (isless, plus_zero, minus_zero, 0);
TEST_ff_i (isless, plus_zero, plus_zero, 0);
TEST_ff_i (isless, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (isless, plus_zero, nan_value, 0);
TEST_ff_i (isless, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (isless, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (isless, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isless, (FLOAT) 1, nan_value, 0);
TEST_ff_i (isless, nan_value, minus_zero, 0);
TEST_ff_i (isless, nan_value, plus_zero, 0);
TEST_ff_i (isless, nan_value, (FLOAT) 1, 0);
TEST_ff_i (isless, nan_value, nan_value, 0);
END (isless);
}
static void
islessequal_test (void)
{
START (islessequal);
TEST_ff_i (islessequal, minus_zero, minus_zero, 1);
TEST_ff_i (islessequal, minus_zero, plus_zero, 1);
TEST_ff_i (islessequal, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessequal, minus_zero, nan_value, 0);
TEST_ff_i (islessequal, plus_zero, minus_zero, 1);
TEST_ff_i (islessequal, plus_zero, plus_zero, 1);
TEST_ff_i (islessequal, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessequal, plus_zero, nan_value, 0);
TEST_ff_i (islessequal, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (islessequal, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (islessequal, (FLOAT) 1, (FLOAT) 1, 1);
TEST_ff_i (islessequal, (FLOAT) 1, nan_value, 0);
TEST_ff_i (islessequal, nan_value, minus_zero, 0);
TEST_ff_i (islessequal, nan_value, plus_zero, 0);
TEST_ff_i (islessequal, nan_value, (FLOAT) 1, 0);
TEST_ff_i (islessequal, nan_value, nan_value, 0);
END (islessequal);
}
static void
islessgreater_test (void)
{
START (islessgreater);
TEST_ff_i (islessgreater, minus_zero, minus_zero, 0);
TEST_ff_i (islessgreater, minus_zero, plus_zero, 0);
TEST_ff_i (islessgreater, minus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessgreater, minus_zero, nan_value, 0);
TEST_ff_i (islessgreater, plus_zero, minus_zero, 0);
TEST_ff_i (islessgreater, plus_zero, plus_zero, 0);
TEST_ff_i (islessgreater, plus_zero, (FLOAT) 1, 1);
TEST_ff_i (islessgreater, plus_zero, nan_value, 0);
TEST_ff_i (islessgreater, (FLOAT) 1, minus_zero, 1);
TEST_ff_i (islessgreater, (FLOAT) 1, plus_zero, 1);
TEST_ff_i (islessgreater, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (islessgreater, (FLOAT) 1, nan_value, 0);
TEST_ff_i (islessgreater, nan_value, minus_zero, 0);
TEST_ff_i (islessgreater, nan_value, plus_zero, 0);
TEST_ff_i (islessgreater, nan_value, (FLOAT) 1, 0);
TEST_ff_i (islessgreater, nan_value, nan_value, 0);
END (islessgreater);
}
static void
isnan_test (void)
{
@ -5185,6 +5310,31 @@ isnormal_test (void)
END (isnormal);
}
static void
isunordered_test (void)
{
START (isunordered);
TEST_ff_i (isunordered, minus_zero, minus_zero, 0);
TEST_ff_i (isunordered, minus_zero, plus_zero, 0);
TEST_ff_i (isunordered, minus_zero, (FLOAT) 1, 0);
TEST_ff_i (isunordered, minus_zero, nan_value, 1);
TEST_ff_i (isunordered, plus_zero, minus_zero, 0);
TEST_ff_i (isunordered, plus_zero, plus_zero, 0);
TEST_ff_i (isunordered, plus_zero, (FLOAT) 1, 0);
TEST_ff_i (isunordered, plus_zero, nan_value, 1);
TEST_ff_i (isunordered, (FLOAT) 1, minus_zero, 0);
TEST_ff_i (isunordered, (FLOAT) 1, plus_zero, 0);
TEST_ff_i (isunordered, (FLOAT) 1, (FLOAT) 1, 0);
TEST_ff_i (isunordered, (FLOAT) 1, nan_value, 1);
TEST_ff_i (isunordered, nan_value, minus_zero, 1);
TEST_ff_i (isunordered, nan_value, plus_zero, 1);
TEST_ff_i (isunordered, nan_value, (FLOAT) 1, 1);
TEST_ff_i (isunordered, nan_value, nan_value, 1);
END (isunordered);
}
static void
j0_test (void)
{
@ -9818,6 +9968,14 @@ main (int argc, char **argv)
fma_test_downward ();
fma_test_upward ();
/* Comparison macros: */
isgreater_test ();
isgreaterequal_test ();
isless_test ();
islessequal_test ();
islessgreater_test ();
isunordered_test ();
/* Complex functions: */
cabs_test ();
cacos_test ();