libupdate
This commit is contained in:
parent
427358cc5e
commit
a1de7069c5
8
libft/.gitignore
vendored
Normal file
8
libft/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
*.pdf
|
||||
*.o
|
||||
*.a
|
||||
LICENSE
|
||||
obj
|
||||
tests/tmp
|
||||
.git
|
||||
.ccls-cache
|
@ -1,18 +1,18 @@
|
||||
# **************************************************************************** #
|
||||
# #
|
||||
# :::::::: #
|
||||
# Makefile :+: :+: :+: #
|
||||
# Makefile |o_o || | #
|
||||
# +:+ #
|
||||
# By: djonker <marvin@codam.nl> +#+ #
|
||||
# +#+ #
|
||||
# Created: 2020/10/27 15:02:02 by djonker #+# #+# #
|
||||
# Updated: 2023/02/07 00:49:35 by houtworm ### ########.fr #
|
||||
# Updated: 2023/02/23 15:40:38 by houtworm \___)=(___/ #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
NAME =libft.a
|
||||
CC =gcc
|
||||
FC =-Wall -Werror -Wextra# -fsanitize=address
|
||||
FC =-Wall -Werror -Wextra -fsanitize=address
|
||||
FAR =ar -rs
|
||||
RM =rm -f
|
||||
SRC =src/ft_atoi.c \
|
||||
@ -136,7 +136,9 @@ SRC =src/ft_atoi.c \
|
||||
src/ft_lftoi.c \
|
||||
src/ft_lftoa.c \
|
||||
src/ft_islneg.c \
|
||||
src/ft_ldeclen.c
|
||||
src/ft_ldeclen.c \
|
||||
src/ft_isallbyte.c \
|
||||
src/ft_getpwd.c
|
||||
BSRC =src/ft_lstadd_back.c \
|
||||
src/ft_lstadd_front.c \
|
||||
src/ft_lstclear.c \
|
||||
@ -170,7 +172,7 @@ fclean: clean
|
||||
re: fclean all
|
||||
|
||||
$(COBJ): $(CSRC)
|
||||
@mkdir -p obj
|
||||
@mkdir -p $(dir $@)
|
||||
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
||||
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
||||
|
||||
|
10
libft/Readme.md
Normal file
10
libft/Readme.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Functions
|
||||
## striteri
|
||||
void ft_striteri(char *s, void (*f)(unsigned int, char*));
|
||||
|
||||
# Tester
|
||||
## general
|
||||
check for -Wall -Werror -Wextra
|
||||
Think of more edge cases for all functions
|
||||
## add tests extra
|
||||
check if function exists in .h and run the tests for that fucntion
|
@ -6,7 +6,7 @@
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/11 16:02:53 by djonker #+# #+# */
|
||||
/* Updated: 2022/12/16 04:05:31 by djonker \___)=(___/ */
|
||||
/* Updated: 2023/03/05 20:30:31 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -47,7 +47,6 @@ int ft_toupper(int c);
|
||||
int ft_tolower(int c);
|
||||
void *ft_calloc(size_t count, size_t size);
|
||||
char *ft_strdup(const char *s);
|
||||
|
||||
char *ft_substr(char const *s, unsigned int start, size_t len);
|
||||
char *ft_strjoin(char const *s1, char const *s2);
|
||||
char *ft_strtrim(char const *s1, char const *set);
|
||||
@ -114,8 +113,6 @@ long long ft_atol(char *str);
|
||||
unsigned long long ft_atou(char *str);
|
||||
double ft_atof(char *str);
|
||||
long double ft_atodec(char *str);
|
||||
char *ft_itoa(int n);
|
||||
char *ft_itoa(int n);
|
||||
int ft_itob(int d);
|
||||
char *ft_itoba(unsigned long long d, size_t e);
|
||||
int ft_btoi(int i, int e);
|
||||
@ -161,5 +158,7 @@ char *ft_lftoa(long double n);
|
||||
int ft_ldeclen(long double n);
|
||||
int ft_islneg(long long n);
|
||||
char *ft_dtoa(long double n);
|
||||
int ft_isallbyte(char *str, char byte);
|
||||
char *ft_getpwd(char **envp, int slash);
|
||||
|
||||
#endif
|
||||
|
@ -21,14 +21,13 @@ int ft_atoi(char *str)
|
||||
r = 0;
|
||||
c = 0;
|
||||
n = 1;
|
||||
if (str == NULL)
|
||||
return (0);
|
||||
while ((str[c] == 32) || (str[c] > 8 && str[c] < 14))
|
||||
c++;
|
||||
if (str[c] == '-' || str[c] == '+')
|
||||
{
|
||||
if (str[c] == '-')
|
||||
if (str[c++] == '-')
|
||||
n = -1;
|
||||
c++;
|
||||
}
|
||||
while (str[c] >= '0' && str[c] <= '9')
|
||||
{
|
||||
r = 10 * r + (str[c] - '0');
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_atou.c :+: :+: :+: */
|
||||
/* ft_atou.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 19:08:11 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:36:46 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/05 21:13:18 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -26,5 +26,6 @@ unsigned long long ft_atou(char *str)
|
||||
r = 10 * r + (str[c] - '0');
|
||||
c++;
|
||||
}
|
||||
free (str);
|
||||
return (r);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_bzero.c :+: :+: :+: */
|
||||
/* ft_bzero.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:35:25 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:36:47 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/22 02:01:25 by djonker \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,6 +16,8 @@ void ft_bzero(void *s, size_t n)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!s || n <= 0)
|
||||
return ;
|
||||
p = s;
|
||||
while (n)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_calloc.c :+: :+: :+: */
|
||||
/* ft_calloc.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 21:20:32 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:36:47 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/25 16:18:01 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -1,24 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* ft_cntarg.c :+: :+: :+: */
|
||||
/* ft_cntarg.c |o_o || | */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: houtworm <codam@houtworm.net> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/07 00:38:26 by houtworm #+# #+# */
|
||||
/* Updated: 2023/02/07 00:38:34 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/21 01:43:17 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
|
||||
int ft_cntarg(char **argv)
|
||||
int ft_cntarg(char **argv)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (argv[i])
|
||||
i++;
|
||||
return i;
|
||||
return (i);
|
||||
}
|
||||
|
||||
|
@ -16,13 +16,13 @@ void *ft_frearr(char **s)
|
||||
{
|
||||
int n;
|
||||
|
||||
n = 1;
|
||||
n = 0;
|
||||
while (s[n] != NULL)
|
||||
n++;
|
||||
while (n > 0)
|
||||
while (n >= 0)
|
||||
{
|
||||
n--;
|
||||
free(s[n]);
|
||||
n--;
|
||||
}
|
||||
free(s);
|
||||
return (NULL);
|
||||
|
36
libft/src/ft_getpwd.c
Normal file
36
libft/src/ft_getpwd.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* .--. _ */
|
||||
/* ft_getpwd.c |o_o || | */
|
||||
/* |:_/ || |_ _ ___ __ */
|
||||
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
|
||||
/* (| | )|_| |_| |> < */
|
||||
/* Created: 2023/02/17 02:40:22 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
|
||||
/* Updated: 2023/02/17 02:55:28 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
|
||||
char *ft_getpwd(char **envp, int slash)
|
||||
{
|
||||
char *pwd;
|
||||
char *temp;
|
||||
int i;
|
||||
|
||||
i = -1;
|
||||
while (envp[++i])
|
||||
if (ft_strncmp(envp[i], "PWD=", 4) == 0)
|
||||
break ;
|
||||
if (!envp[i])
|
||||
return (NULL);
|
||||
temp = ft_substr(envp[i], 4, ft_strlen(envp[i]));
|
||||
if (!temp)
|
||||
return (NULL);
|
||||
if (slash)
|
||||
pwd = ft_strjoin(temp, "/");
|
||||
else
|
||||
pwd = ft_strjoin(temp, NULL);
|
||||
free(temp);
|
||||
return (pwd);
|
||||
}
|
22
libft/src/ft_isallbyte.c
Normal file
22
libft/src/ft_isallbyte.c
Normal file
@ -0,0 +1,22 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* .--. _ */
|
||||
/* ft_isallbyte.c |o_o || | */
|
||||
/* |:_/ || |_ _ ___ __ */
|
||||
/* By: houtworm <codam@houtworm.net> // \ \ __| | | \ \/ / */
|
||||
/* (| | )|_| |_| |> < */
|
||||
/* Created: 2023/02/21 01:43:42 by houtworm /'\_ _/`\__|\__,_/_/\_\ */
|
||||
/* Updated: 2023/02/21 01:43:44 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../libft.h"
|
||||
|
||||
int ft_isallbyte(char *str, char byte)
|
||||
{
|
||||
while (*str == byte)
|
||||
str++;
|
||||
if (!*str)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_itob.c :+: :+: :+: */
|
||||
/* ft_itob.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2021/01/04 04:42:54 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:06 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/07 05:07:51 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -28,5 +28,6 @@ int ft_itob(int d)
|
||||
s[i] = '\0';
|
||||
r = ft_revstr(s);
|
||||
i = ft_atoi(r);
|
||||
free(r);
|
||||
return (i);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_itoh.c :+: :+: :+: */
|
||||
/* ft_itoh.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:09 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/05 20:33:06 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_itozh.c :+: :+: :+: */
|
||||
/* ft_itozh.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2021/01/31 03:00:29 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:26 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/07 05:15:26 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstadd_back.c :+: :+: :+: */
|
||||
/* ft_lstadd_back.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 18:48:54 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 19:09:28 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,7 +16,7 @@ void ft_lstadd_back(t_list **lst, t_list *new)
|
||||
{
|
||||
t_list *l;
|
||||
|
||||
if (lst)
|
||||
if (lst && new)
|
||||
{
|
||||
if (*lst)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstadd_front.c :+: :+: :+: */
|
||||
/* ft_lstadd_front.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 04:38:37 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 16:12:15 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
void ft_lstadd_front(t_list **lst, t_list *new)
|
||||
{
|
||||
if (lst)
|
||||
if (lst && new)
|
||||
{
|
||||
if (*lst)
|
||||
new->next = *lst;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstclear.c :+: :+: :+: */
|
||||
/* ft_lstclear.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 19:12:41 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:30 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/04 01:50:59 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,25 +15,15 @@
|
||||
void ft_lstclear(t_list **lst, void (*del)(void*))
|
||||
{
|
||||
t_list *t;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
t = NULL;
|
||||
if (!del)
|
||||
if (lst)
|
||||
{
|
||||
while (t->next != NULL)
|
||||
while (*lst)
|
||||
{
|
||||
free(lst[i]);
|
||||
i++;
|
||||
t = (*lst)->next;
|
||||
ft_lstdelone(*lst, del);
|
||||
*lst = t;
|
||||
}
|
||||
free(t);
|
||||
}
|
||||
if (!del || !lst || !*lst)
|
||||
return ;
|
||||
while (lst && *lst)
|
||||
{
|
||||
t = (*lst)->next;
|
||||
ft_lstdelone(*lst, del);
|
||||
*lst = t;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstiter.c :+: :+: :+: */
|
||||
/* ft_lstiter.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 19:15:47 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/04 15:30:35 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
|
||||
void ft_lstiter(t_list *lst, void (*f)(void *))
|
||||
{
|
||||
if (!f)
|
||||
if (!f || lst == NULL)
|
||||
return ;
|
||||
while (lst)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstlast.c :+: :+: :+: */
|
||||
/* ft_lstlast.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 18:45:02 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 18:08:43 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstmap.c :+: :+: :+: */
|
||||
/* ft_lstmap.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 19:30:13 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:34 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/04 16:07:56 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -20,7 +20,7 @@ t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *))
|
||||
|
||||
r = NULL;
|
||||
t = NULL;
|
||||
while (lst)
|
||||
while (lst && f)
|
||||
{
|
||||
if (f(lst->content))
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_lstsize.c :+: :+: :+: */
|
||||
/* ft_lstsize.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 18:27:52 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:35 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 17:20:28 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:38:54 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:38 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/24 20:52:37 by houtworm ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,6 +18,10 @@ void *ft_memccpy(void *dst, const void *src, int c, size_t n)
|
||||
unsigned const char *s;
|
||||
unsigned char u;
|
||||
|
||||
if (!dst || !src)
|
||||
return (NULL);
|
||||
if (u > ft_strlen(dst))
|
||||
u = ft_strlen(dst);
|
||||
d = dst;
|
||||
s = src;
|
||||
u = c;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_memchr.c :+: :+: :+: */
|
||||
/* ft_memchr.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:35:56 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/27 05:12:02 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,8 @@ void *ft_memchr(const void *s, int c, size_t n)
|
||||
unsigned char *p;
|
||||
unsigned char t;
|
||||
|
||||
if (!s)
|
||||
return (NULL);
|
||||
t = (unsigned char)c;
|
||||
p = (unsigned char *)s;
|
||||
while (n > 0)
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_memcmp.c :+: :+: :+: */
|
||||
/* ft_memcmp.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:41:32 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/28 15:22:59 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,10 @@ int ft_memcmp(const void *s1, const void *s2, size_t n)
|
||||
const unsigned char *p1;
|
||||
const unsigned char *p2;
|
||||
|
||||
if (!s1 && !s2)
|
||||
return (0);
|
||||
if (!s1 || !s2)
|
||||
return (1);
|
||||
p1 = s1;
|
||||
p2 = s2;
|
||||
while (n)
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_memcpy.c :+: :+: :+: */
|
||||
/* ft_memcpy.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/11 16:13:52 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/01 18:06:11 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,16 +18,20 @@ void *ft_memcpy(void *dst, const void *src, size_t n)
|
||||
const char *s;
|
||||
long unsigned int i;
|
||||
|
||||
i = 0;
|
||||
if (!dst)
|
||||
return (dst);
|
||||
d = dst;
|
||||
s = src;
|
||||
if (dst != NULL || src != NULL)
|
||||
if (!src)
|
||||
{
|
||||
while (n > i)
|
||||
{
|
||||
d[i] = s[i];
|
||||
i++;
|
||||
}
|
||||
*d = '\0';
|
||||
return (dst);
|
||||
}
|
||||
s = src;
|
||||
i = 0;
|
||||
while (n > i)
|
||||
{
|
||||
d[i] = s[i];
|
||||
i++;
|
||||
}
|
||||
return (dst);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_memmove.c :+: :+: :+: */
|
||||
/* ft_memmove.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:45:04 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 12:19:05 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,7 +18,7 @@ void *ft_memmove(void *dst, const void *src, size_t len)
|
||||
const char *s;
|
||||
int i;
|
||||
|
||||
if (dst == NULL && src == NULL)
|
||||
if (dst == NULL || src == NULL)
|
||||
return ((void *)dst);
|
||||
i = 0;
|
||||
d = dst;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_memset.c :+: :+: :+: */
|
||||
/* ft_memset.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 08:42:45 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:39 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/28 20:13:47 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,6 +16,8 @@ void *ft_memset(void *s, int c, size_t n)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!s)
|
||||
return (s);
|
||||
p = s;
|
||||
while (n > 0)
|
||||
{
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_putendl.c :+: :+: :+: */
|
||||
/* ft_putendl.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/13 04:00:47 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:43 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/02/23 20:14:17 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_revstr.c :+: :+: :+: */
|
||||
/* ft_revstr.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2021/01/18 11:54:50 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:48 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/05 20:39:52 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,10 +14,11 @@
|
||||
|
||||
char *ft_revstr(char *s)
|
||||
{
|
||||
char r[1000];
|
||||
char *r;
|
||||
int is;
|
||||
int ir;
|
||||
|
||||
r = ft_calloc(8 * (ft_strlen(s) + 1), 1);
|
||||
is = ft_strlen(s) - 1;
|
||||
ir = 0;
|
||||
while (is >= 0)
|
||||
@ -28,5 +29,5 @@ char *ft_revstr(char *s)
|
||||
}
|
||||
r[ir] = '\0';
|
||||
s = r;
|
||||
return (s);
|
||||
return (r);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* .--. _ */
|
||||
/* ft_strchr.c :+: :+: :+: */
|
||||
/* ft_strchr.c |o_o || | */
|
||||
/* |:_/ || |_ _ ___ __ */
|
||||
/* By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / */
|
||||
/* (| | )|_| |_| |> < */
|
||||
/* Created: 2022/11/22 13:34:05 by djonker /'\_ _/`\__|\__,_/_/\_\ */
|
||||
/* Updated: 2023/02/07 00:40:50 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/01 06:08:13 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,6 +14,8 @@
|
||||
|
||||
char *ft_strchr(const char *s, int c)
|
||||
{
|
||||
if (!s)
|
||||
return (0);
|
||||
while (*s)
|
||||
{
|
||||
if (c == *s)
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strjoin.c :+: :+: :+: */
|
||||
/* ft_strjoin.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/11 16:17:34 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:50 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 13:40:55 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -18,8 +18,10 @@ char *ft_strjoin(char const *s1, char const *s2)
|
||||
int c2;
|
||||
char *r;
|
||||
|
||||
c1 = 0;
|
||||
c2 = 0;
|
||||
c1 = -1;
|
||||
c2 = -1;
|
||||
if (s1 == NULL && s2 == NULL)
|
||||
return (NULL);
|
||||
if (s1 == NULL)
|
||||
return (ft_malstr((char *)s2, '\0'));
|
||||
if (s2 == NULL)
|
||||
@ -27,16 +29,10 @@ char *ft_strjoin(char const *s1, char const *s2)
|
||||
r = ft_calloc(ft_strlen((char *)s1) + ft_strlen((char *)s2) + 1, 1);
|
||||
if (r == NULL)
|
||||
return (r);
|
||||
while (c1 < (int)ft_strlen((char *)s1))
|
||||
{
|
||||
while (++c1 < (int)ft_strlen((char *)s1))
|
||||
r[c1] = s1[c1];
|
||||
c1++;
|
||||
}
|
||||
while (c2 < (int)ft_strlen((char *)s2))
|
||||
{
|
||||
while (++c2 < (int)ft_strlen((char *)s2))
|
||||
r[c1 + c2] = s2[c2];
|
||||
c2++;
|
||||
}
|
||||
r[c1 + c2] = '\0';
|
||||
return (r);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strlcat.c :+: :+: :+: */
|
||||
/* ft_strlcat.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 09:55:53 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:40:51 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 13:56:46 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -23,6 +23,8 @@ size_t ft_strlcat(char *dst, const char *src, size_t dstsize)
|
||||
sl = 0;
|
||||
if (dstsize == 0)
|
||||
return (r);
|
||||
if (!src)
|
||||
return (dl);
|
||||
if (dstsize < dl)
|
||||
r = r + dstsize;
|
||||
else
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strncmp.c :+: :+: :+: */
|
||||
/* ft_strncmp.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/01 19:09:01 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:41:12 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 14:28:11 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,6 +14,10 @@
|
||||
|
||||
int ft_strncmp(char *s1, char *s2, unsigned int n)
|
||||
{
|
||||
if (s1 == NULL && s2 == NULL)
|
||||
return (0);
|
||||
if (s1 == NULL || s2 == NULL)
|
||||
return (1);
|
||||
if (n == 0)
|
||||
return (0);
|
||||
while (n)
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strnstr.c :+: :+: :+: */
|
||||
/* ft_strnstr.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/11 16:14:33 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 14:31:13 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -17,6 +17,8 @@ char *ft_strnstr(const char *h, const char *n, size_t len)
|
||||
long unsigned int ih;
|
||||
int in;
|
||||
|
||||
if (h == NULL || n == NULL)
|
||||
return (NULL);
|
||||
ih = 0;
|
||||
if (!*n)
|
||||
return ((char *)&h[ih]);
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strrchr.c :+: :+: :+: */
|
||||
/* ft_strrchr.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/11 16:14:50 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/03 14:52:43 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,13 +16,13 @@ char *ft_strrchr(const char *s, int c)
|
||||
{
|
||||
char *p;
|
||||
|
||||
p = (char *) 0;
|
||||
while (1)
|
||||
if (!s)
|
||||
return (NULL);
|
||||
p = NULL;
|
||||
while (*s != '\0')
|
||||
{
|
||||
if (*s == c)
|
||||
p = (char *)s;
|
||||
if (*s == 0)
|
||||
break ;
|
||||
s++;
|
||||
}
|
||||
return (p);
|
||||
|
@ -1,12 +1,12 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* ft_strupp.c :+: :+: :+: */
|
||||
/* ft_strupp.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <marvin@codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2021/01/31 05:49:38 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/07 00:41:13 by houtworm ### ########.fr */
|
||||
/* Updated: 2023/03/05 20:46:08 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -14,16 +14,16 @@
|
||||
|
||||
char *ft_strupp(char *s)
|
||||
{
|
||||
char r[5000];
|
||||
char *r;
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
r = ft_calloc(8 * (ft_strlen(s) + 1), 1);
|
||||
while (s[i])
|
||||
{
|
||||
r[i] = ft_toupper(s[i]);
|
||||
i++;
|
||||
}
|
||||
r[i] = '\0';
|
||||
s = r;
|
||||
return (s);
|
||||
free(s);
|
||||
return (r);
|
||||
}
|
||||
|
1132
libft/test.sh
Executable file
1132
libft/test.sh
Executable file
File diff suppressed because it is too large
Load Diff
35
libft/tests/bonus/lstadd_back/test1.c
Normal file
35
libft/tests/bonus/lstadd_back/test1.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/27 01:03:32 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
r = 0;
|
||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
40
libft/tests/bonus/lstadd_back/test2.c
Normal file
40
libft/tests/bonus/lstadd_back/test2.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 18:52:35 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
r = 0;
|
||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
if (strncmp(element[1]->next->content, "Hallo3", 6))
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
38
libft/tests/bonus/lstadd_back/test3.c
Normal file
38
libft/tests/bonus/lstadd_back/test3.c
Normal file
@ -0,0 +1,38 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 02:09:08 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstdelone(element[1], &free);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
r = 0;
|
||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
34
libft/tests/bonus/lstadd_back/test4.c
Normal file
34
libft/tests/bonus/lstadd_back/test4.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 01:11:14 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = NULL;
|
||||
ft_lstadd_back(list, element[0]);
|
||||
r = 0;
|
||||
if (list)
|
||||
r = 1;
|
||||
free (str[0]);
|
||||
free (element[0]);
|
||||
return (r);
|
||||
}
|
33
libft/tests/bonus/lstadd_back/test5.c
Normal file
33
libft/tests/bonus/lstadd_back/test5.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 19:04:41 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[0]);
|
||||
r = 0;
|
||||
if (element[0]->next)
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
35
libft/tests/bonus/lstadd_front/test1.c
Normal file
35
libft/tests/bonus/lstadd_front/test1.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/27 01:03:39 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[1];
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
if (strncmp(element[0]->next->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
40
libft/tests/bonus/lstadd_front/test2.c
Normal file
40
libft/tests/bonus/lstadd_front/test2.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 15:48:12 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[2];
|
||||
ft_lstadd_front(list, element[1]);
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
if (strncmp((*list)->next->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
41
libft/tests/bonus/lstadd_front/test3.c
Normal file
41
libft/tests/bonus/lstadd_front/test3.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 18:35:12 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[2];
|
||||
ft_lstadd_front(list, element[1]);
|
||||
list = &element[2];
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
if (strncmp((*list)->next->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
if (strncmp((*list)->next->next->content, "Hallo3", 6))
|
||||
r = 1;
|
||||
ft_lstclear(list, &free);
|
||||
return (r);
|
||||
}
|
34
libft/tests/bonus/lstadd_front/test4.c
Normal file
34
libft/tests/bonus/lstadd_front/test4.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 18:56:02 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = NULL;
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
if (list)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(element[0]);
|
||||
return (r);
|
||||
}
|
34
libft/tests/bonus/lstadd_front/test5.c
Normal file
34
libft/tests/bonus/lstadd_front/test5.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 16:05:17 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
ft_lstadd_front(list, NULL);
|
||||
r = 0;
|
||||
if (element[0]->next)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(element[0]);
|
||||
return (r);
|
||||
}
|
33
libft/tests/bonus/lstclear/test1.c
Normal file
33
libft/tests/bonus/lstclear/test1.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 02:09:57 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
r = 0;
|
||||
ft_lstclear(list, NULL);
|
||||
if (*list != NULL)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
return (r);
|
||||
}
|
37
libft/tests/bonus/lstclear/test2.c
Normal file
37
libft/tests/bonus/lstclear/test2.c
Normal file
@ -0,0 +1,37 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:52:32 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[1];
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
ft_lstclear(list, NULL);
|
||||
if (*list != NULL)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
return (r);
|
||||
}
|
39
libft/tests/bonus/lstclear/test3.c
Normal file
39
libft/tests/bonus/lstclear/test3.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 01:40:00 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[2];
|
||||
ft_lstadd_front(list, element[1]);
|
||||
ft_lstadd_front(list, element[0]);
|
||||
ft_lstdelone(element[1], NULL);
|
||||
r = 0;
|
||||
ft_lstclear(list, NULL);
|
||||
if (*list != NULL)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
35
libft/tests/bonus/lstclear/test4.c
Normal file
35
libft/tests/bonus/lstclear/test4.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/27 05:14:21 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[1];
|
||||
ft_lstadd_front(list, element[0]);
|
||||
r = 0;
|
||||
ft_lstclear(list, &free);
|
||||
if (*list != NULL)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
28
libft/tests/bonus/lstclear/test5.c
Normal file
28
libft/tests/bonus/lstclear/test5.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 01:58:06 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
|
||||
list = NULL;
|
||||
r = 0;
|
||||
ft_lstclear(list, &free);
|
||||
if (list != NULL)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
50
libft/tests/bonus/lstdelone/test1.c
Normal file
50
libft/tests/bonus/lstdelone/test1.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 02:09:32 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int compare(void *a, void *b)
|
||||
{
|
||||
if (a == NULL && b == NULL)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[4];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
element[3] = NULL;
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
r = 0;
|
||||
ft_lstdelone(element[2], NULL);
|
||||
r = compare(element[2], element[3]);
|
||||
free (str[0]);
|
||||
free (str[1]);
|
||||
free (str[2]);
|
||||
free (element[0]);
|
||||
free (element[1]);
|
||||
return (r);
|
||||
}
|
50
libft/tests/bonus/lstdelone/test2.c
Normal file
50
libft/tests/bonus/lstdelone/test2.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 00:07:41 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int compare(void *a, void *b)
|
||||
{
|
||||
if (a == NULL && b == NULL)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[4];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
element[3] = NULL;
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
r = 0;
|
||||
ft_lstdelone(element[0], NULL);
|
||||
r = compare(element[0], element[3]);
|
||||
free (str[0]);
|
||||
free (str[1]);
|
||||
free (str[2]);
|
||||
free (element[1]);
|
||||
free (element[2]);
|
||||
return (r);
|
||||
}
|
50
libft/tests/bonus/lstdelone/test3.c
Normal file
50
libft/tests/bonus/lstdelone/test3.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 00:10:48 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int compare(void *a, void *b)
|
||||
{
|
||||
if (a == NULL && b == NULL)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[4];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
element[3] = NULL;
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
r = 0;
|
||||
r = compare(element[1], element[3]);
|
||||
ft_lstdelone((*list)->next, NULL);
|
||||
free (str[0]);
|
||||
free (str[1]);
|
||||
free (str[2]);
|
||||
free (element[0]);
|
||||
free (element[2]);
|
||||
return (r);
|
||||
}
|
31
libft/tests/bonus/lstdelone/test4.c
Normal file
31
libft/tests/bonus/lstdelone/test4.c
Normal file
@ -0,0 +1,31 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 19:40:55 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
r = 0;
|
||||
ft_lstdelone(element[0], NULL);
|
||||
free(str[0]);
|
||||
return (r);
|
||||
}
|
30
libft/tests/bonus/lstdelone/test5.c
Normal file
30
libft/tests/bonus/lstdelone/test5.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 19:39:44 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
r = 0;
|
||||
ft_lstdelone(element[0], &free);
|
||||
return (r);
|
||||
}
|
39
libft/tests/bonus/lstiter/test1.c
Normal file
39
libft/tests/bonus/lstiter/test1.c
Normal file
@ -0,0 +1,39 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:52:52 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
ft_lstiter(*list, &func);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
44
libft/tests/bonus/lstiter/test2.c
Normal file
44
libft/tests/bonus/lstiter/test2.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:53:15 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstiter(*list, &func);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6) || strncmp(str[1], "aaalo2", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
48
libft/tests/bonus/lstiter/test3.c
Normal file
48
libft/tests/bonus/lstiter/test3.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 15:31:09 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
ft_lstdelone(element[1], &free);
|
||||
ft_lstiter(*list, &func);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6) || strncmp(str[2], "Hallo3", 6))
|
||||
r = 1;
|
||||
free(element[0]);
|
||||
free(element[2]);
|
||||
free(str[0]);
|
||||
free(str[2]);
|
||||
return (r);
|
||||
}
|
34
libft/tests/bonus/lstiter/test4.c
Normal file
34
libft/tests/bonus/lstiter/test4.c
Normal file
@ -0,0 +1,34 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:53:35 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
ft_lstiter(*list, NULL);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "Hallo1", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
33
libft/tests/bonus/lstiter/test5.c
Normal file
33
libft/tests/bonus/lstiter/test5.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 15:32:29 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list *list;
|
||||
|
||||
list = NULL;
|
||||
ft_lstiter(list, &func);
|
||||
r = 0;
|
||||
if (list)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
40
libft/tests/bonus/lstlast/test1.c
Normal file
40
libft/tests/bonus/lstlast/test1.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:51:42 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
t_list *last;
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
last = ft_lstlast(*list);
|
||||
r = 0;
|
||||
if (strncmp(last->content, "Hallo2", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free(last);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
44
libft/tests/bonus/lstlast/test2.c
Normal file
44
libft/tests/bonus/lstlast/test2.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 17:42:42 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
t_list *last;
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
ft_lstdelone(element[1], &free);
|
||||
last = ft_lstlast(*list);
|
||||
r = 0;
|
||||
if (strncmp(last->content, "Hallo3", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[2]);
|
||||
free(*list);
|
||||
free(last);
|
||||
return (r);
|
||||
}
|
35
libft/tests/bonus/lstlast/test3.c
Normal file
35
libft/tests/bonus/lstlast/test3.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:52:00 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[1];
|
||||
t_list *last;
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
last = ft_lstlast(*list);
|
||||
r = 0;
|
||||
if (strncmp(last->content, "Hallo1", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
28
libft/tests/bonus/lstlast/test4.c
Normal file
28
libft/tests/bonus/lstlast/test4.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 17:50:22 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *last;
|
||||
|
||||
last = ft_lstlast(*list);
|
||||
r = 0;
|
||||
if (last)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
29
libft/tests/bonus/lstlast/test5.c
Normal file
29
libft/tests/bonus/lstlast/test5.c
Normal file
@ -0,0 +1,29 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 17:51:23 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *last;
|
||||
|
||||
list = NULL;
|
||||
last = ft_lstlast(*list);
|
||||
r = 0;
|
||||
if (last)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
42
libft/tests/bonus/lstmap/test1.c
Normal file
42
libft/tests/bonus/lstmap/test1.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 18:23:40 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *copy;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
copy = ft_lstmap(*list, &func, &free);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(*list);
|
||||
free(copy);
|
||||
return (r);
|
||||
}
|
48
libft/tests/bonus/lstmap/test2.c
Normal file
48
libft/tests/bonus/lstmap/test2.c
Normal file
@ -0,0 +1,48 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:54:21 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *copy;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
copy = ft_lstmap(*list, &func, &free);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6) || strncmp(str[1], "aaalo2", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
free(copy->next);
|
||||
free(copy);
|
||||
return (r);
|
||||
}
|
50
libft/tests/bonus/lstmap/test3.c
Normal file
50
libft/tests/bonus/lstmap/test3.c
Normal file
@ -0,0 +1,50 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 15:41:56 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *copy;
|
||||
t_list *element[3];
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
ft_lstdelone(element[1], &free);
|
||||
copy = ft_lstmap(*list, &func, &free);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6) || strncmp(str[2], "aaalo3", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[2]);
|
||||
free(element[0]);
|
||||
free(element[2]);
|
||||
return (r);
|
||||
}
|
46
libft/tests/bonus/lstmap/test4.c
Normal file
46
libft/tests/bonus/lstmap/test4.c
Normal file
@ -0,0 +1,46 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:54:35 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *copy;
|
||||
t_list *element[2];
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
copy = ft_lstmap(*list, NULL, &free);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "Hallo1", 6) || strncmp(str[1], "Hallo2", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
35
libft/tests/bonus/lstmap/test5.c
Normal file
35
libft/tests/bonus/lstmap/test5.c
Normal file
@ -0,0 +1,35 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 16:14:04 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list *list;
|
||||
t_list *copy;
|
||||
|
||||
list = NULL;
|
||||
copy = ft_lstmap(list, &func, &free);
|
||||
r = 0;
|
||||
if (copy)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
42
libft/tests/bonus/lstmap/test6.c
Normal file
42
libft/tests/bonus/lstmap/test6.c
Normal file
@ -0,0 +1,42 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test6.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:54:49 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
void *func(void *content)
|
||||
{
|
||||
memset(content, 'a', 3);
|
||||
return (content);
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *copy;
|
||||
t_list *element[1];
|
||||
char *str[1];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
list = &element[0];
|
||||
copy = ft_lstmap(*list, &func, NULL);
|
||||
r = 0;
|
||||
if (strncmp(str[0], "aaalo1", 6))
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(*list);
|
||||
free(copy);
|
||||
return (r);
|
||||
}
|
28
libft/tests/bonus/lstnew/test1.c
Normal file
28
libft/tests/bonus/lstnew/test1.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/02/23 13:57:30 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list *list;
|
||||
|
||||
r = 0;
|
||||
list = ft_lstnew("Hallo");
|
||||
if (strncmp(list->content, "Hallo", 5))
|
||||
r = 1;
|
||||
free (list);
|
||||
return (r);
|
||||
}
|
30
libft/tests/bonus/lstnew/test2.c
Normal file
30
libft/tests/bonus/lstnew/test2.c
Normal file
@ -0,0 +1,30 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 15:37:25 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
int *p;
|
||||
t_list *list;
|
||||
|
||||
r = 0;
|
||||
p = &r;
|
||||
list = ft_lstnew(p);
|
||||
if ((int *)list->content != p)
|
||||
r = 1;
|
||||
free (list);
|
||||
return (r);
|
||||
}
|
28
libft/tests/bonus/lstnew/test3.c
Normal file
28
libft/tests/bonus/lstnew/test3.c
Normal file
@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 15:13:04 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list *list;
|
||||
|
||||
r = 0;
|
||||
list = ft_lstnew(NULL);
|
||||
if (list->content)
|
||||
r = 1;
|
||||
free (list);
|
||||
return (r);
|
||||
}
|
40
libft/tests/bonus/lstsize/test1.c
Normal file
40
libft/tests/bonus/lstsize/test1.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test1.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:50:43 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
int size;
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
size = ft_lstsize(*list);
|
||||
r = 0;
|
||||
if (size != 2)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
43
libft/tests/bonus/lstsize/test2.c
Normal file
43
libft/tests/bonus/lstsize/test2.c
Normal file
@ -0,0 +1,43 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test2.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 17:00:15 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
int size;
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
size = ft_lstsize(*list);
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free(str[2]);
|
||||
free((*list)->next->next);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
if (size != 3)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
40
libft/tests/bonus/lstsize/test3.c
Normal file
40
libft/tests/bonus/lstsize/test3.c
Normal file
@ -0,0 +1,40 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test3.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/04 17:51:07 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[2];
|
||||
int size;
|
||||
char *str[2];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
size = ft_lstsize(element[1]);
|
||||
r = 0;
|
||||
if (size != 1)
|
||||
r = 1;
|
||||
free(str[0]);
|
||||
free(str[1]);
|
||||
free((*list)->next);
|
||||
free(*list);
|
||||
return (r);
|
||||
}
|
41
libft/tests/bonus/lstsize/test4.c
Normal file
41
libft/tests/bonus/lstsize/test4.c
Normal file
@ -0,0 +1,41 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test4.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 17:46:02 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
t_list **list;
|
||||
t_list *element[3];
|
||||
int size;
|
||||
char *str[3];
|
||||
|
||||
str[0] = strdup("Hallo1");
|
||||
str[1] = strdup("Hallo2");
|
||||
str[2] = strdup("Hallo3");
|
||||
element[0] = ft_lstnew(str[0]);
|
||||
element[1] = ft_lstnew(str[1]);
|
||||
element[2] = ft_lstnew(str[2]);
|
||||
list = &element[0];
|
||||
ft_lstadd_back(list, element[1]);
|
||||
ft_lstadd_back(list, element[2]);
|
||||
ft_lstdelone(element[1], &free);
|
||||
size = ft_lstsize(*list);
|
||||
ft_lstdelone(element[0], &free);
|
||||
ft_lstdelone(element[2], &free);
|
||||
if (size != 3)
|
||||
return (1);
|
||||
return (0);
|
||||
}
|
27
libft/tests/bonus/lstsize/test5.c
Normal file
27
libft/tests/bonus/lstsize/test5.c
Normal file
@ -0,0 +1,27 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* :::::::: */
|
||||
/* test5.c |o_o || | */
|
||||
/* +:+ */
|
||||
/* By: djonker <djonker@student.codam.nl> +#+ */
|
||||
/* +#+ */
|
||||
/* Created: 2020/11/14 21:06:17 by djonker #+# #+# */
|
||||
/* Updated: 2023/03/03 16:57:08 by houtworm \___)=(___/ */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../tmp/libft.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int r;
|
||||
int size;
|
||||
|
||||
size = ft_lstsize(NULL);
|
||||
r = 0;
|
||||
if (size != 0)
|
||||
r = 1;
|
||||
return (r);
|
||||
}
|
1
libft/tests/expected/mandatory/putchar_fd/test1
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test1
Normal file
@ -0,0 +1 @@
|
||||
a
|
1
libft/tests/expected/mandatory/putchar_fd/test10
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test10
Normal file
@ -0,0 +1 @@
|
||||
|
1
libft/tests/expected/mandatory/putchar_fd/test11
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test11
Normal file
@ -0,0 +1 @@
|
||||
|
BIN
libft/tests/expected/mandatory/putchar_fd/test12
Normal file
BIN
libft/tests/expected/mandatory/putchar_fd/test12
Normal file
Binary file not shown.
1
libft/tests/expected/mandatory/putchar_fd/test13
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test13
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
1
libft/tests/expected/mandatory/putchar_fd/test14
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test14
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
1
libft/tests/expected/mandatory/putchar_fd/test15
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test15
Normal file
@ -0,0 +1 @@
|
||||
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€亗儎厗噲墛媽崕彁憭摂晼棙櫄洔潪煚、¥ウЖ┆<D096><E29486><EFBFBD>辈炒刀犯购患骄坷谅媚牌侨墒颂臀闲岩釉罩棕仝圮蒉哙徕沅彐<E6B285>
|
1
libft/tests/expected/mandatory/putchar_fd/test16
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test16
Normal file
@ -0,0 +1 @@
|
||||
a
|
1
libft/tests/expected/mandatory/putchar_fd/test17
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test17
Normal file
@ -0,0 +1 @@
|
||||
.
|
1
libft/tests/expected/mandatory/putchar_fd/test18
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test18
Normal file
@ -0,0 +1 @@
|
||||
|
1
libft/tests/expected/mandatory/putchar_fd/test19
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test19
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
1
libft/tests/expected/mandatory/putchar_fd/test2
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test2
Normal file
@ -0,0 +1 @@
|
||||
z
|
1
libft/tests/expected/mandatory/putchar_fd/test20
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test20
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
1
libft/tests/expected/mandatory/putchar_fd/test3
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test3
Normal file
@ -0,0 +1 @@
|
||||
1
|
1
libft/tests/expected/mandatory/putchar_fd/test4
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test4
Normal file
@ -0,0 +1 @@
|
||||
0
|
1
libft/tests/expected/mandatory/putchar_fd/test5
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test5
Normal file
@ -0,0 +1 @@
|
||||
|
1
libft/tests/expected/mandatory/putchar_fd/test6
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test6
Normal file
@ -0,0 +1 @@
|
||||
|
1
libft/tests/expected/mandatory/putchar_fd/test7
Normal file
1
libft/tests/expected/mandatory/putchar_fd/test7
Normal file
@ -0,0 +1 @@
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user