mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 00:10:10 +00:00
Update.
* string/tester.c: Add test of rawmemchr.
This commit is contained in:
parent
6dc0d457ec
commit
e0faeea74f
@ -1,5 +1,7 @@
|
|||||||
1999-05-03 Ulrich Drepper <drepper@cygnus.com>
|
1999-05-03 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* string/tester.c: Add test of rawmemchr.
|
||||||
|
|
||||||
* sysdeps/i386/bits/select.h (__FD_ZERO): Remove memory output
|
* sysdeps/i386/bits/select.h (__FD_ZERO): Remove memory output
|
||||||
specification. It's not necessary.
|
specification. It's not necessary.
|
||||||
|
|
||||||
|
@ -442,6 +442,33 @@ test_strchrnul (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
test_rawmemchr (void)
|
||||||
|
{
|
||||||
|
it = "rawmemchr";
|
||||||
|
(void) strcpy (one, "abcd");
|
||||||
|
check (rawmemchr (one, 'c') == one+2, 1); /* Basic test. */
|
||||||
|
check (rawmemchr (one, 'd') == one+3, 2); /* End of string. */
|
||||||
|
check (rawmemchr (one, 'a') == one, 3); /* Beginning. */
|
||||||
|
check (rawmemchr (one, '\0') == one+4, 4); /* Finding NUL. */
|
||||||
|
(void) strcpy (one, "ababa");
|
||||||
|
check (rawmemchr (one, 'b') == one+1, 5); /* Finding first. */
|
||||||
|
(void) strcpy (one, "");
|
||||||
|
check (rawmemchr (one, '\0') == one, 6); /* NUL in empty string. */
|
||||||
|
{
|
||||||
|
char buf[4096];
|
||||||
|
int i;
|
||||||
|
char *p;
|
||||||
|
for (i=0; i < 0x100; i++)
|
||||||
|
{
|
||||||
|
p = (char *) ((unsigned long int) (buf + 0xff) & ~0xff) + i;
|
||||||
|
strcpy (p, "OK");
|
||||||
|
strcpy (p+3, "BAD/WRONG");
|
||||||
|
check (rawmemchr (p, 'R') == p+8, 6+i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
test_index (void)
|
test_index (void)
|
||||||
{
|
{
|
||||||
@ -1099,6 +1126,9 @@ main (void)
|
|||||||
/* strchrnul. */
|
/* strchrnul. */
|
||||||
test_strchrnul ();
|
test_strchrnul ();
|
||||||
|
|
||||||
|
/* rawmemchr. */
|
||||||
|
test_rawmemchr ();
|
||||||
|
|
||||||
/* index - just like strchr. */
|
/* index - just like strchr. */
|
||||||
test_index ();
|
test_index ();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user