mirror of
https://sourceware.org/git/glibc.git
synced 2025-10-21 14:53:53 +03:00
Convert TEST_fI_f1 tests from code to data.
This commit is contained in:
@@ -1,5 +1,10 @@
|
|||||||
2013-05-14 Joseph Myers <joseph@codesourcery.com>
|
2013-05-14 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
|
* math/libm-test.inc (struct test_f_f1_data): Add comment.
|
||||||
|
(RUN_TEST_LOOP_fI_f1): New macro.
|
||||||
|
(frexp_test_data): New variable.
|
||||||
|
(frexp_test): Run tests with RUN_TEST_LOOP_fI_f1.
|
||||||
|
|
||||||
* math/libm-test.inc (struct test_fF_f1_data): New type.
|
* math/libm-test.inc (struct test_fF_f1_data): New type.
|
||||||
(RUN_TEST_LOOP_fF_f1): New macro.
|
(RUN_TEST_LOOP_fF_f1): New macro.
|
||||||
(modf_test_data): New variable.
|
(modf_test_data): New variable.
|
||||||
|
@@ -933,6 +933,7 @@ struct test_c_f_data
|
|||||||
FLOAT max_ulp;
|
FLOAT max_ulp;
|
||||||
int exceptions;
|
int exceptions;
|
||||||
};
|
};
|
||||||
|
/* Used for both RUN_TEST_LOOP_f_f1 and RUN_TEST_LOOP_fI_f1. */
|
||||||
struct test_f_f1_data
|
struct test_f_f1_data
|
||||||
{
|
{
|
||||||
const char *test_name;
|
const char *test_name;
|
||||||
@@ -1110,6 +1111,16 @@ struct test_c_c_data
|
|||||||
EXTRA_ULP, 0); \
|
EXTRA_ULP, 0); \
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
#define RUN_TEST_LOOP_fI_f1(FUNC_NAME, ARRAY, ROUNDING_MODE, EXTRA_VAR) \
|
||||||
|
IF_ROUND_INIT_ ## ROUNDING_MODE \
|
||||||
|
for (size_t i = 0; i < sizeof (ARRAY) / sizeof (ARRAY)[0]; i++) \
|
||||||
|
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); \
|
||||||
|
ROUND_RESTORE_ ## ROUNDING_MODE
|
||||||
#define RUN_TEST_ffI_f1(TEST_NAME, FUNC_NAME, ARG1, ARG2, EXPECTED, \
|
#define RUN_TEST_ffI_f1(TEST_NAME, FUNC_NAME, ARG1, ARG2, EXPECTED, \
|
||||||
MAX_ULP, EXCEPTIONS, \
|
MAX_ULP, EXCEPTIONS, \
|
||||||
EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \
|
EXTRA_NAME, EXTRA_VAR, EXTRA_INIT, EXTRA_TEST, \
|
||||||
@@ -9544,23 +9555,28 @@ fpclassify_test (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static const struct test_f_f1_data frexp_test_data[] =
|
||||||
|
{
|
||||||
|
START_DATA (frexp),
|
||||||
|
TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE),
|
||||||
|
TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE),
|
||||||
|
TEST_fI_f1 (frexp, qnan_value, qnan_value, IGNORE),
|
||||||
|
|
||||||
|
TEST_fI_f1 (frexp, 0.0, 0.0, 0.0),
|
||||||
|
TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0),
|
||||||
|
|
||||||
|
TEST_fI_f1 (frexp, 12.8L, 0.8L, 4),
|
||||||
|
TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5),
|
||||||
|
END_DATA (frexp)
|
||||||
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frexp_test (void)
|
frexp_test (void)
|
||||||
{
|
{
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
START (frexp);
|
START (frexp);
|
||||||
|
RUN_TEST_LOOP_fI_f1 (frexp, frexp_test_data, , x);
|
||||||
TEST_fI_f1 (frexp, plus_infty, plus_infty, IGNORE);
|
|
||||||
TEST_fI_f1 (frexp, minus_infty, minus_infty, IGNORE);
|
|
||||||
TEST_fI_f1 (frexp, qnan_value, qnan_value, IGNORE);
|
|
||||||
|
|
||||||
TEST_fI_f1 (frexp, 0.0, 0.0, 0.0);
|
|
||||||
TEST_fI_f1 (frexp, minus_zero, minus_zero, 0.0);
|
|
||||||
|
|
||||||
TEST_fI_f1 (frexp, 12.8L, 0.8L, 4);
|
|
||||||
TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5);
|
|
||||||
|
|
||||||
END (frexp);
|
END (frexp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user