-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_strdup.c
35 lines (32 loc) · 1.36 KB
/
test_strdup.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_strdup.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/02/28 22:18:36 by apuchill #+# #+# */
/* Updated: 2021/03/06 13:09:39 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
#include "tests.h"
int test_strdup(char *str)
{
static int test_nbr;
char *ret_lib;
char *ret_ft;
int ret;
test_nbr += 1;
print_test_title(test_nbr);
ret_lib = strdup(str);
ret_ft = ft_strdup(str);
printf("%sRETURN strdup :%s >|%s|<\n", C_TITLE, C_END, ret_lib);
printf("%sRETURN ft_strdup :%s >|%s|<\n", C_TITLE, C_END, ret_ft);
if (strcmp(ret_lib, ret_ft) == 0)
ret = print_test_passed();
else
ret = print_test_failed();
free(ret_lib);
free(ret_ft);
return (ret);
}