mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Update.
2000-01-03 Andreas Jaeger <aj@suse.de> * include/resolv.h: Remove declarations for __ns_name_ntop and __ns_name_unpack since those are available in resolv/arpa/nameser.h. 2000-01-03 Andreas Jaeger <aj@suse.de> * time/tst-strptime.c (test_tm): Add tests for all fields of struct tm. 2000-01-03 Ulrich Drepper <drepper@cygnus.com> * string/bits/string2.h (__strsep_g): Don't handle empty __S special. 2000-01-03 Andreas Jaeger <aj@suse.de> * string/tester.c (test_strsep): Add one more test. 2000-01-03 Philip Blundell <philb@gnu.org> * string/tester.c (test_mempcpy): New function. (main): Call it. (test_memcpy): Test unaligned cases too. * sysdeps/arm/bits/string.h (_HAVE_STRING_ARCH_mempcpy): Define. * sysdeps/arm/fpu/bits/mathdef.h: New file. * nss/Makefile: Add rules to build makedb.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/* Tester for string functions.
|
||||
Copyright (C) 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995-1999, 2000 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -928,6 +928,13 @@ test_strsep (void)
|
||||
equal(ptr, "", 83);
|
||||
check(ptr == one, 84);
|
||||
check(cp == NULL, 85);
|
||||
|
||||
*one = '\0'; /* Empty string and no token. */
|
||||
cp = one;
|
||||
ptr = strsep(&cp, "");
|
||||
equal(ptr, "", 86);
|
||||
check(ptr == one , 87);
|
||||
check(cp == NULL, 88);
|
||||
}
|
||||
|
||||
void
|
||||
@ -990,6 +997,7 @@ test_memchr (void)
|
||||
void
|
||||
test_memcpy (void)
|
||||
{
|
||||
int i;
|
||||
it = "memcpy";
|
||||
check(memcpy(one, "abc", 4) == one, 1); /* Returned value. */
|
||||
equal(one, "abc", 2); /* Did the copy go right? */
|
||||
@ -1007,6 +1015,57 @@ test_memcpy (void)
|
||||
(void) memcpy(two, one, 9);
|
||||
equal(two, "hi there", 5); /* Just paranoia. */
|
||||
equal(one, "hi there", 6); /* Stomped on source? */
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
strcpy (one, x);
|
||||
check (memcpy (one + i, "hi there", 9) == one + i,
|
||||
7 + (i * 6)); /* Unaligned destination. */
|
||||
check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */
|
||||
equal (one + i, "hi there", 9 + (i * 6));
|
||||
check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */
|
||||
check (memcpy (two, one + i, 9) == two,
|
||||
11 + (i * 6)); /* Unaligned source. */
|
||||
equal (two, "hi there", 12 + (i * 6));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
test_mempcpy (void)
|
||||
{
|
||||
int i;
|
||||
it = "mempcpy";
|
||||
check(mempcpy(one, "abc", 4) == one + 4, 1); /* Returned value. */
|
||||
equal(one, "abc", 2); /* Did the copy go right? */
|
||||
|
||||
(void) strcpy(one, "abcdefgh");
|
||||
(void) mempcpy(one+1, "xyz", 2);
|
||||
equal(one, "axydefgh", 3); /* Basic test. */
|
||||
|
||||
(void) strcpy(one, "abc");
|
||||
(void) mempcpy(one, "xyz", 0);
|
||||
equal(one, "abc", 4); /* Zero-length copy. */
|
||||
|
||||
(void) strcpy(one, "hi there");
|
||||
(void) strcpy(two, "foo");
|
||||
(void) mempcpy(two, one, 9);
|
||||
equal(two, "hi there", 5); /* Just paranoia. */
|
||||
equal(one, "hi there", 6); /* Stomped on source? */
|
||||
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
const char *x = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
|
||||
strcpy (one, x);
|
||||
check (mempcpy (one + i, "hi there", 9) == one + i + 9,
|
||||
7 + (i * 6)); /* Unaligned destination. */
|
||||
check (memcmp (one, x, i) == 0, 8 + (i * 6)); /* Wrote under? */
|
||||
equal (one + i, "hi there", 9 + (i * 6));
|
||||
check (one[i + 9] == 'x', 10 + (i * 6)); /* Wrote over? */
|
||||
check (mempcpy (two, one + i, 9) == two + 9,
|
||||
11 + (i * 6)); /* Unaligned source. */
|
||||
equal (two, "hi there", 12 + (i * 6));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -1295,6 +1354,9 @@ main (void)
|
||||
/* memmove - must work on overlap. */
|
||||
test_memmove ();
|
||||
|
||||
/* mempcpy */
|
||||
test_mempcpy ();
|
||||
|
||||
/* memccpy. */
|
||||
test_memccpy ();
|
||||
|
||||
|
Reference in New Issue
Block a user