5 /* strncat( char *, const char *, size_t )
7 This file is part of the Public Domain C Library (PDCLib).
8 Permission is granted to use, modify, and / or redistribute at will.
15 char * strncat( char * _PDCLIB_restrict s1, const char * _PDCLIB_restrict s2, size_t n )
22 while ( n && ( *s1++ = *s2++ ) )
36 #include <_PDCLIB_test.h>
40 char s[] = "xx\0xxxxxx";
42 TESTCASE( strncat( s, abcde, 10 ) == s );
43 TESTCASE( s[2] == 'a' );
44 TESTCASE( s[6] == 'e' );
45 TESTCASE( s[7] == '\0' );
46 TESTCASE( s[8] == 'x' );
48 TESTCASE( strncat( s, abcdx, 10 ) == s );
49 TESTCASE( s[4] == 'x' );
50 TESTCASE( s[5] == '\0' );
51 TESTCASE( strncat( s, "\0", 10 ) == s );
52 TESTCASE( s[5] == '\0' );
53 TESTCASE( s[6] == 'e' );
54 TESTCASE( strncat( s, abcde, 0 ) == s );
55 TESTCASE( s[5] == '\0' );
56 TESTCASE( s[6] == 'e' );
57 TESTCASE( strncat( s, abcde, 3 ) == s );
58 TESTCASE( s[5] == 'a' );
59 TESTCASE( s[7] == 'c' );
60 TESTCASE( s[8] == '\0' );