aboutsummaryrefslogtreecommitdiff
path: root/string/test-strchr.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-10-05 13:32:07 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-10-05 13:32:07 -0700
commit03759f47db62930f2dddf1c9733ef89b9d99e2da (patch)
treeff23ba8b81b00366f0cbc0c890e9e7487b4497ae /string/test-strchr.c
parentfb228a2d94a130eda38c8794b0f264aa9f0e4714 (diff)
downloadglibc-03759f47db62930f2dddf1c9733ef89b9d99e2da.tar
glibc-03759f47db62930f2dddf1c9733ef89b9d99e2da.tar.gz
glibc-03759f47db62930f2dddf1c9733ef89b9d99e2da.tar.bz2
glibc-03759f47db62930f2dddf1c9733ef89b9d99e2da.zip
Test strcasestr/strchr/strstr under all implementations
Diffstat (limited to 'string/test-strchr.c')
-rw-r--r--string/test-strchr.c27
1 files changed, 24 insertions, 3 deletions
diff --git a/string/test-strchr.c b/string/test-strchr.c
index e544aa7158..161ac458c1 100644
--- a/string/test-strchr.c
+++ b/string/test-strchr.c
@@ -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);