aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-09 18:10:15 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-09 18:10:15 +0000
commitc13f651e0fdaecc0b3fd858d6ae681084aa7588c (patch)
treeb59fda1f4ca4ee7ef3947bdc482d07ee17a1c743
parent1d5c2feb1c7dbefca171fb4bae4949b3acdf1ef5 (diff)
downloadglibc-c13f651e0fdaecc0b3fd858d6ae681084aa7588c.zip
glibc-c13f651e0fdaecc0b3fd858d6ae681084aa7588c.tar.gz
glibc-c13f651e0fdaecc0b3fd858d6ae681084aa7588c.tar.bz2
Update.
* string/stratcliff.c: Add tests for stpncpy, memcpy, and mempcpy.
-rw-r--r--ChangeLog2
-rw-r--r--string/stratcliff.c42
2 files changed, 44 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 3cb4aa8..7da4825 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/string/stratcliff.c b/string/stratcliff.c
index bd95a2c..43ca355 100644
--- a/string/stratcliff.c
+++ b/string/stratcliff.c
@@ -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;