Simplify libm-test extra-output initialization.

This commit is contained in:
Joseph Myers 2013-05-17 19:02:19 +00:00
parent de407f79a2
commit a00bdcf0e0
3 changed files with 49 additions and 37 deletions

View File

@ -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.

View File

@ -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 {

View File

@ -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