diff options
Diffstat (limited to 'string/tester.c')
-rw-r--r-- | string/tester.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/string/tester.c b/string/tester.c index 23d0af8..0e65442 100644 --- a/string/tester.c +++ b/string/tester.c @@ -107,6 +107,19 @@ main (void) (void) strcpy (one, ""); equal (one, "", 7); /* Boundary condition. */ + /* A closely related function is stpcpy. */ + it = "stpcpy"; + check ((stpcpy (one, "abcde") - one) == 5, 1); + equal (one, "abcde", 2); + + check ((stpcpy (one, "x") - one) == 1, 3); + equal (one, "x", 4); /* Writeover. */ + equal (one+2, "cde", 5); /* Wrote too much? */ + + check ((stpcpy (stpcpy (stpcpy (one, "a"), "b"), "c") - one) == 3, 6); + equal (one, "abc", 7); + equal (one + 4, "e", 8); + /* stpncpy. */ it = "stpncpy"; |