mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Test strcasestr/strchr/strstr under all implementations
This commit is contained in:
@ -79,8 +79,8 @@ IMPL (stupid_STRCHR, 0)
|
||||
IMPL (simple_STRCHR, 0)
|
||||
IMPL (STRCHR, 1)
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
|
||||
static int
|
||||
check_result (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
|
||||
{
|
||||
CHAR *res = CALL (impl, s, c);
|
||||
if (res != exp_res)
|
||||
@ -88,8 +88,16 @@ do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
|
||||
error (0, 0, "Wrong result in function %s %#x %p %p", impl->name,
|
||||
c, res, exp_res);
|
||||
ret = 1;
|
||||
return;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
do_one_test (impl_t *impl, const CHAR *s, int c, const CHAR *exp_res)
|
||||
{
|
||||
if (check_result (impl, s, c, exp_res) < 0)
|
||||
return;
|
||||
|
||||
if (HP_TIMING_AVAIL)
|
||||
{
|
||||
@ -224,6 +232,17 @@ do_random_tests (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
check1 (void)
|
||||
{
|
||||
char s[] __attribute__((aligned(16))) = "\xff";
|
||||
char c = '\xfe';
|
||||
char *exp_result = stupid_STRCHR (s, c);
|
||||
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
check_result (impl, s, c, exp_result);
|
||||
}
|
||||
|
||||
int
|
||||
test_main (void)
|
||||
{
|
||||
@ -231,6 +250,8 @@ test_main (void)
|
||||
|
||||
test_init ();
|
||||
|
||||
check1 ();
|
||||
|
||||
printf ("%20s", "");
|
||||
FOR_EACH_IMPL (impl, 0)
|
||||
printf ("\t%s", impl->name);
|
||||
|
Reference in New Issue
Block a user