summaryrefslogtreecommitdiff
path: root/tests/libc/test_strlcat.c
blob: 5a1bfc9bdfec445a8d448535925c79426b806832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "string.h"
#include "stdlib.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 ) exit( 1 );
	if( strcmp( d, s1 ) != 0 ) exit( 1 );
	n = strlcat( d, s2, 15 );
	if( n != 14 ) exit( 1 );
	if( strcmp( d, "test_stringapp" ) != 0 ) exit( 1 );
		
	exit( 0 );
}