* string/stratcliff.c: Add tests for stpncpy, memcpy, and mempcpy.
This commit is contained in:
Ulrich Drepper 2000-12-09 18:10:15 +00:00
parent 1d5c2feb1c
commit c13f651e0f
2 changed files with 44 additions and 0 deletions

View File

@ -1,5 +1,7 @@
2000-12-09 Ulrich Drepper <drepper@redhat.com>
* string/stratcliff.c: Add tests for stpncpy, memcpy, and mempcpy.
* Makeconfig (default_cflags): Make -O2 the default for stable
releases.

View File

@ -209,6 +209,48 @@ main (int argc, char *argv[])
adr[inner] = 'T';
}
}
/* stpncpy test */
for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
{
for (middle = MAX (outer, size - 64); middle < size; ++middle)
{
adr[middle] = '\0';
for (inner = 0; inner < size - outer; ++ inner)
{
if ((stpncpy (dest, &adr[outer], inner) - dest)
!= MIN (inner, middle - outer))
{
printf ("stpncpy flunked for outer = %d, middle = %d, "
"inner = %d\n", outer, middle, inner);
result = 1;
}
}
adr[middle] = 'T';
}
}
/* memcpy test */
for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
for (inner = 0; inner < size - outer; ++inner)
if (memcpy (dest, &adr[outer], inner) != dest)
{
printf ("memcpy flunked for outer = %d, inner = %d\n",
outer, inner);
result = 1;
}
/* mempcpy test */
for (outer = size - 1; outer >= MAX (0, size - 128); --outer)
for (inner = 0; inner < size - outer; ++inner)
if (mempcpy (dest, &adr[outer], inner) != dest + inner)
{
printf ("mempcpy flunked for outer = %d, inner = %d\n",
outer, inner);
result = 1;
}
}
return result;