diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-10-09 23:34:12 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-10-09 23:34:12 +0000 |
commit | 0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0 (patch) | |
tree | eb4bb556b0ab6125abdb266a02d67e8f7da9cb76 /math/libm-test.inc | |
parent | 7f82e4f470fd74ab3cef53941dc13bc005618759 (diff) | |
download | glibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.tar.gz glibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.tar.xz glibc-0e8e0c1c9328a68259fe94b8080fdce7f72e9fa0.zip |
Make libm-test.inc test comparison macros.
Diffstat (limited to 'math/libm-test.inc')
-rw-r--r-- | math/libm-test.inc | 160 |
1 files changed, 159 insertions, 1 deletions
diff --git a/math/libm-test.inc b/math/libm-test.inc index 2562bb124a..0422e8e8b4 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 (); |