diff options
Diffstat (limited to 'tests/test_strlcpy.c')
-rw-r--r-- | tests/test_strlcpy.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_strlcpy.c b/tests/test_strlcpy.c new file mode 100644 index 0000000..a23a5bc --- /dev/null +++ b/tests/test_strlcpy.c @@ -0,0 +1,15 @@ +#include "string.h" + +int main( void ) +{ + char *s = "test_string"; + char d[8]; + size_t n; + + // copy into too small string + n = strlcpy( d, s, 4 ); + if( n != 11 ) return 1; + if( strcmp( d, "tes" ) ) return 1; + + return 0; +} |