summaryrefslogtreecommitdiff
path: root/tests/port/test_strdup.c
blob: d8e5959a9fd79aaa1acd4ec43736b57c6496399b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "port/sys.h"

#define TEST_STRDUP
#include "port/string.c"	/* for strdup */

#include <stdlib.h>		/* for exit, EXIT_SUCCESS, free */

int main( void ) {
	const char *s = "test";
	char *d = strdup( s );
	char *d2 = wolf_port_strdup( s );
	
	if( strcmp( s, d ) != 0 ) return EXIT_FAILURE;
	if( strcmp( d, d2 ) != 0 ) return EXIT_FAILURE;
	free( d );
	free( d2 );

	return EXIT_SUCCESS;
}