-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstdelone_test.c
36 lines (33 loc) · 1.49 KB
/
ft_lstdelone_test.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
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstdelone_test.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: abenamar <abenamar@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/19 20:48:20 by abenamar #+# #+# */
/* Updated: 2022/12/28 22:38:58 by abenamar ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft_test.h"
void ft_lstdelone_test(void)
{
t_list *lst;
t_list *item;
printf(RESET "\nft_lstdelone\t");
lst = ft_lstnew(strdup("0"));
ft_lstdelone(lst, NULL);
ft_assert(1, !strcmp(lst->content, "0"));
ft_lstdelone(lst, &free);
printf(BOLDGREEN "2. OK\t");
lst = ft_lstnew(strdup("0"));
ft_lstadd_front(&lst, ft_lstnew(strdup("1")));
ft_lstdelone(lst->next, &free);
ft_assert(3, !strcmp(lst->content, "1"));
ft_lstadd_front(&lst, ft_lstnew(strdup("2")));
item = lst->next;
ft_lstdelone(lst, &free);
ft_assert(4, !strcmp(item->content, "1"));
ft_lstdelone(item, &free);
printf(BOLDGREEN "5. OK\t");
}