diff options
author | Joseph Myers <joseph@codesourcery.com> | 2013-05-17 19:02:19 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2013-05-17 19:02:19 +0000 |
commit | a00bdcf0e059a6bdb0a258a624437e326cde49e4 (patch) | |
tree | 78c6cbe5dd03e2fcb1a3b69994833ffdbc2535b7 | |
parent | de407f79a20659fd11cc3b4e30ff9f1e349b5b93 (diff) | |
download | glibc-a00bdcf0e059a6bdb0a258a624437e326cde49e4.tar.gz glibc-a00bdcf0e059a6bdb0a258a624437e326cde49e4.tar.xz glibc-a00bdcf0e059a6bdb0a258a624437e326cde49e4.zip |
Simplify libm-test extra-output initialization.
-rw-r--r-- | ChangeLog | 19 | ||||
-rwxr-xr-x | math/gen-libm-test.pl | 8 | ||||
-rw-r--r-- | math/libm-test.inc | 59 |
3 files changed, 49 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog index 36e0da57df..cec25f7a15 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,24 @@ 2013-05-17 Joseph Myers <joseph@codesourcery.com> + * math/libm-test.inc (struct test_f_f1_data): Remove field + extra_init. + (struct test_fF_f1_data): Likewise. + (struct test_ffI_f1_data): Likewise. + (RUN_TEST_f_f1): Remove argument EXTRA_INIT. Initialize EXTRA_VAR + based on value of EXTRA_EXPECTED. + (RUN_TEST_LOOP_f_f1): Update call to RUN_TEST_f_f1. + (RUN_TEST_fF_f1): Remove argument EXTRA_INIT. Initialize + EXTRA_VAR based on value of EXTRA_EXPECTED. + (RUN_TEST_LOOP_fF_f1): Update call to RUN_TEST_fF_f1. + (RUN_TEST_fI_f1): Remove argument EXTRA_INIT. Initialize + EXTRA_VAR based on value of EXTRA_EXPECTED. + (RUN_TEST_LOOP_fI_f1): Update call to RUN_TEST_fI_f1. + (RUN_TEST_ffI_f1): Remove argument EXTRA_INIT. Initialize + EXTRA_VAR based on value of EXTRA_EXPECTED. + (RUN_TEST_LOOP_ffI_f1): Update call to RUN_TEST_ffI_f1. + * math/gen-libm-test.pl (parse_args): Don't output initializers + for extra output values. + * math/libm-test.inc (check_int): Expect result to be exactly equal to expected value and do not handle ulps. (check_long): Likewise. diff --git a/math/gen-libm-test.pl b/math/gen-libm-test.pl index 217d74d2d2..2217948aba 100755 --- a/math/gen-libm-test.pl +++ b/math/gen-libm-test.pl @@ -345,7 +345,7 @@ sub parse_args { $str = ""; $extra_expected = "0"; } - $cline .= ", \"$str\", 123456789, $run_extra, $extra_expected"; + $cline .= ", \"$str\", $run_extra, $extra_expected"; if ($run_extra) { $cline .= &new_test ($str, undef, 0); } else { @@ -361,7 +361,7 @@ sub parse_args { $str = ""; $extra_expected = "0"; } - $cline .= ", \"$str\", 0, $run_extra, $extra_expected"; + $cline .= ", \"$str\", $run_extra, $extra_expected"; if ($run_extra) { $cline .= &new_test ($str, undef, 0); } else { @@ -377,7 +377,7 @@ sub parse_args { $str = ""; $extra_expected = "0"; } - $cline .= ", \"$str\", 123.456789, $run_extra, $extra_expected"; + $cline .= ", \"$str\", $run_extra, $extra_expected"; if ($run_extra) { $cline .= &new_test ($str, undef, 0); } else { @@ -393,7 +393,7 @@ sub parse_args { $str = ""; $extra_expected = "0"; } - $cline .= ", \"$str\", 123456789, $run_extra, $extra_expected"; + $cline .= ", \"$str\", $run_extra, $extra_expected"; if ($run_extra) { $cline .= &new_test ($str, undef, 0); } else { diff --git a/math/libm-test.inc b/math/libm-test.inc index 1d478ed8d2..360112c1e3 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -928,7 +928,6 @@ struct test_f_f1_data FLOAT max_ulp; int exceptions; const char *extra_name; - int extra_init; int extra_test; int extra_expected; int extra_ulp; @@ -941,7 +940,6 @@ struct test_fF_f1_data FLOAT max_ulp; int exceptions; const char *extra_name; - FLOAT extra_init; int extra_test; FLOAT extra_expected; FLOAT extra_ulp; @@ -954,7 +952,6 @@ struct test_ffI_f1_data FLOAT max_ulp; int exceptions; const char *extra_name; - int extra_init; int extra_test; int extra_expected; int extra_ulp; @@ -1101,19 +1098,19 @@ struct test_sincos_data (ARRAY)[i].argc, (ARRAY)[i].expected, \ (ARRAY)[i].max_ulp, (ARRAY)[i].exceptions); \ ROUND_RESTORE_ ## ROUNDING_MODE -#define RUN_TEST_f_f1(TEST_NAME, FUNC_NAME, ARG, EXPECTED, \ - MAX_ULP, EXCEPTIONS, \ - EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \ - EXTRA_EXPECTED, EXTRA_ULP) \ - do \ - { \ - (EXTRA_VAR) = (EXTRA_INIT); \ - check_float (TEST_NAME, FUNC (FUNC_NAME) (ARG), EXPECTED, \ - MAX_ULP, EXCEPTIONS); \ - if (EXTRA_TEST) \ - check_int (EXTRA_NAME, EXTRA_VAR, EXTRA_EXPECTED, \ - EXTRA_ULP, 0); \ - } \ +#define RUN_TEST_f_f1(TEST_NAME, FUNC_NAME, ARG, EXPECTED, \ + MAX_ULP, EXCEPTIONS, \ + EXTRA_NAME, EXTRA_VAR, EXTRA_TEST, \ + EXTRA_EXPECTED, EXTRA_ULP) \ + do \ + { \ + (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ + check_float (TEST_NAME, FUNC (FUNC_NAME) (ARG), EXPECTED, \ + MAX_ULP, EXCEPTIONS); \ + if (EXTRA_TEST) \ + check_int (EXTRA_NAME, EXTRA_VAR, EXTRA_EXPECTED, \ + EXTRA_ULP, 0); \ + } \ while (0) #define RUN_TEST_LOOP_f_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \ IF_ROUND_INIT_ ## ROUNDING_MODE \ @@ -1121,17 +1118,16 @@ struct test_sincos_data RUN_TEST_f_f1 ((ARRAY)[i].test_name, FUNC_NAME, (ARRAY)[i].arg, \ (ARRAY)[i].expected, (ARRAY)[i].max_ulp, \ (ARRAY)[i].exceptions, (ARRAY)[i].extra_name, \ - EXTRA_VAR, (ARRAY)[i].extra_init, \ - (ARRAY)[i].extra_test, (ARRAY)[i].extra_expected, \ - (ARRAY)[i].extra_ulp); \ + EXTRA_VAR, (ARRAY)[i].extra_test, \ + (ARRAY)[i].extra_expected, (ARRAY)[i].extra_ulp); \ ROUND_RESTORE_ ## ROUNDING_MODE #define RUN_TEST_fF_f1(TEST_NAME, FUNC_NAME, ARG, EXPECTED, \ MAX_ULP, EXCEPTIONS, \ - EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \ + EXTRA_NAME, EXTRA_VAR, EXTRA_TEST, \ EXTRA_EXPECTED, EXTRA_ULP) \ do \ { \ - (EXTRA_VAR) = (EXTRA_INIT); \ + (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ check_float (TEST_NAME, FUNC (FUNC_NAME) (ARG, &(EXTRA_VAR)), \ EXPECTED, MAX_ULP, EXCEPTIONS); \ if (EXTRA_TEST) \ @@ -1145,17 +1141,16 @@ struct test_sincos_data RUN_TEST_fF_f1 ((ARRAY)[i].test_name, FUNC_NAME, (ARRAY)[i].arg, \ (ARRAY)[i].expected, (ARRAY)[i].max_ulp, \ (ARRAY)[i].exceptions, (ARRAY)[i].extra_name, \ - EXTRA_VAR, (ARRAY)[i].extra_init, \ - (ARRAY)[i].extra_test, (ARRAY)[i].extra_expected, \ - (ARRAY)[i].extra_ulp); \ + EXTRA_VAR, (ARRAY)[i].extra_test, \ + (ARRAY)[i].extra_expected, (ARRAY)[i].extra_ulp); \ ROUND_RESTORE_ ## ROUNDING_MODE #define RUN_TEST_fI_f1(TEST_NAME, FUNC_NAME, ARG, EXPECTED, \ MAX_ULP, EXCEPTIONS, \ - EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \ + EXTRA_NAME, EXTRA_VAR, EXTRA_TEST, \ EXTRA_EXPECTED, EXTRA_ULP) \ do \ { \ - (EXTRA_VAR) = (EXTRA_INIT); \ + (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ check_float (TEST_NAME, FUNC (FUNC_NAME) (ARG, &(EXTRA_VAR)), \ EXPECTED, MAX_ULP, EXCEPTIONS); \ if (EXTRA_TEST) \ @@ -1169,17 +1164,16 @@ struct test_sincos_data RUN_TEST_fI_f1 ((ARRAY)[i].test_name, FUNC_NAME, (ARRAY)[i].arg, \ (ARRAY)[i].expected, (ARRAY)[i].max_ulp, \ (ARRAY)[i].exceptions, (ARRAY)[i].extra_name, \ - EXTRA_VAR, (ARRAY)[i].extra_init, \ - (ARRAY)[i].extra_test, (ARRAY)[i].extra_expected, \ - (ARRAY)[i].extra_ulp); \ + EXTRA_VAR, (ARRAY)[i].extra_test, \ + (ARRAY)[i].extra_expected, (ARRAY)[i].extra_ulp); \ ROUND_RESTORE_ ## ROUNDING_MODE #define RUN_TEST_ffI_f1(TEST_NAME, FUNC_NAME, ARG1, ARG2, EXPECTED, \ MAX_ULP, EXCEPTIONS, \ - EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \ + EXTRA_NAME, EXTRA_VAR, EXTRA_TEST, \ EXTRA_EXPECTED, EXTRA_ULP) \ do \ { \ - (EXTRA_VAR) = (EXTRA_INIT); \ + (EXTRA_VAR) = (EXTRA_EXPECTED) == 0 ? 1 : 0; \ check_float (TEST_NAME, \ FUNC (FUNC_NAME) (ARG1, ARG2, &(EXTRA_VAR)), \ EXPECTED, MAX_ULP, EXCEPTIONS); \ @@ -1196,8 +1190,7 @@ struct test_sincos_data (ARRAY)[i].arg1, (ARRAY)[i].arg2, \ (ARRAY)[i].expected, (ARRAY)[i].max_ulp, \ (ARRAY)[i].exceptions, (ARRAY)[i].extra_name, \ - EXTRA_VAR, (ARRAY)[i].extra_init, \ - (ARRAY)[i].extra_test, \ + EXTRA_VAR, (ARRAY)[i].extra_test, \ (ARRAY)[i].extra_expected, \ (ARRAY)[i].extra_ulp); \ ROUND_RESTORE_ ## ROUNDING_MODE |