File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66#include <string.h>
77
88int main () {
9- // 1. Basic functionality tests
109 char * str = (char * )malloc (20 );
1110 assert (str != NULL );
12- strcpy (str , "42helloworld" );
11+ ft_strlcpy (str , "42helloworld" , 20 );
1312 assert (strcmp (str , "42helloworld" ) == 0 );
13+ ft_bzero (str , 20 );
1414 free (str );
1515
1616 int * arr = (int * )calloc (5 , sizeof (int ));
1717 assert (arr != NULL );
1818 for (int i = 0 ; i < 5 ; i ++ ) {
1919 assert (arr [i ] == 0 );
2020 }
21+ ft_bzero (arr , 5 * sizeof (int ));
2122 free (arr );
2223
2324 char * dynstr = (char * )malloc (5 );
2425 assert (dynstr != NULL );
25- strcpy (dynstr , "Test" );
26+ ft_strlcpy (dynstr , "Test" , 5 );
2627 dynstr = realloc (dynstr , 10 );
27- strcat (dynstr , "1234" );
28- assert (strcmp (dynstr , "Test1234" ) == 0 );
28+ ft_strlcat (dynstr , "1234" , 10 );
29+ assert (ft_strcmp (dynstr , "Test1234" ) == 0 );
30+ ft_bzero (dynstr , 10 );
2931 free (dynstr );
3032
3133 void * edge1 = malloc (0 );
3234 free (edge1 );
3335
3436 char * edge2 = (char * )malloc (5 );
37+ ft_bzero (edge2 , 5 );
3538 edge2 = realloc (edge2 , 0 );
3639 assert (edge2 == NULL );
3740
You can’t perform that action at this time.
0 commit comments