aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-10-09 23:34:12 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-10-09 23:34:12 +0000
commit0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0 (patch)
treeeb4bb556b0ab6125abdb266a02d67e8f7da9cb76
parent7f82e4f470fd74ab3cef53941dc13bc005618759 (diff)
downloadglibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.zip
glibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.tar.gz
glibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.tar.bz2
Make libm-test.inc test comparison macros.
-rw-r--r--ChangeLog14
-rwxr-xr-xmath/gen-libm-test.pl4
-rw-r--r--math/libm-test.inc160
3 files changed, 176 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 49f9c6e..a3e846e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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,
diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl
index 67227c4..642fc98 100755
--- a/math/gen-libm-test.pl
+++ b/math/gen-libm-test.pl
@@ -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]) (";
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 2562bb1..0422e8e 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -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).
@@ -5138,6 +5138,56 @@ isfinite_test (void)
}
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)
{
START (isinf);
@@ -5154,6 +5204,81 @@ isinf_test (void)
}
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)
{
START (isnan);
@@ -5186,6 +5311,31 @@ isnormal_test (void)
}
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)
{
FLOAT s, c;
@@ -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 ();