diff options
Diffstat (limited to 'tests/libc/test_strlcat.c')
-rw-r--r-- | tests/libc/test_strlcat.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/libc/test_strlcat.c b/tests/libc/test_strlcat.c new file mode 100644 index 0000000..074cb98 --- /dev/null +++ b/tests/libc/test_strlcat.c @@ -0,0 +1,19 @@ +#include "string.h" + +int main( void ) +{ + char *s1 = "test_string"; + char *s2 = "append"; + char d[15]; + size_t n; + + *d = '\0'; + n = strlcat( d, s1, 15 ); + if( n != 11 ) return 1; + if( strcmp( d, s1 ) != 0 ) return 1; + n = strlcat( d, s2, 15 ); + if( n != 14 ) return 1; + if( strcmp( d, "test_stringapp" ) != 0 ) return 1; + + return 0; +} |