aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile24
-rw-r--r--include/ft_ctype.h35
-rw-r--r--include/ft_get_next_line.h (renamed from include/get_next_line.h)10
-rw-r--r--include/ft_io.h (renamed from src/io/ft_printf.c)27
-rw-r--r--include/ft_lst.h36
-rw-r--r--include/ft_mem.h31
-rw-r--r--include/ft_printf.h27
-rw-r--r--include/ft_str.h66
-rw-r--r--include/ft_types.h26
-rw-r--r--include/libft.h150
-rw-r--r--src/io/ft_get_next_line.c (renamed from src/io/get_next_line/get_next_line.c)18
-rw-r--r--src/io/ft_printf/ft_asprintf.c (renamed from src/io/ft_asprintf.c)0
-rw-r--r--src/io/ft_printf/ft_dprintf.c (renamed from src/io/ft_dprintf.c)0
-rw-r--r--src/io/ft_printf/ft_printf.c88
-rw-r--r--src/io/ft_printf/ft_snprintf.c (renamed from src/io/ft_snprintf.c)0
-rw-r--r--src/io/ft_printf/ft_sprintf.c (renamed from src/io/ft_sprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vasprintf.c (renamed from src/io/ft_vasprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vdprintf.c (renamed from src/io/ft_vdprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vprintf.c (renamed from src/io/ft_vprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vsnprintf.c (renamed from src/io/ft_vsnprintf.c)0
-rw-r--r--src/io/ft_printf/ft_vsprintf.c (renamed from src/io/ft_vsprintf.c)0
-rw-r--r--src/io/ft_printf/internals/convert.c (renamed from src/io/ft_printf/convert.c)0
-rw-r--r--src/io/ft_printf/internals/convert_char.c (renamed from src/io/ft_printf/convert_char.c)0
-rw-r--r--src/io/ft_printf/internals/convert_hex.c (renamed from src/io/ft_printf/convert_hex.c)0
-rw-r--r--src/io/ft_printf/internals/convert_int.c (renamed from src/io/ft_printf/convert_int.c)0
-rw-r--r--src/io/ft_printf/internals/convert_none.c (renamed from src/io/ft_printf/convert_none.c)0
-rw-r--r--src/io/ft_printf/internals/convert_percent.c (renamed from src/io/ft_printf/convert_percent.c)0
-rw-r--r--src/io/ft_printf/internals/convert_ptr.c (renamed from src/io/ft_printf/convert_ptr.c)0
-rw-r--r--src/io/ft_printf/internals/convert_str.c (renamed from src/io/ft_printf/convert_str.c)0
-rw-r--r--src/io/ft_printf/internals/convert_uint.c (renamed from src/io/ft_printf/convert_uint.c)0
-rw-r--r--src/io/ft_printf/internals/convert_written.c (renamed from src/io/ft_printf/convert_written.c)0
-rw-r--r--src/io/ft_printf/internals/extract.c (renamed from src/io/ft_printf/extract.c)0
-rw-r--r--src/io/ft_printf/internals/length_modifier.c (renamed from src/io/ft_printf/length_modifier.c)0
-rw-r--r--src/io/ft_printf/internals/list.c (renamed from src/io/ft_printf/list.c)0
-rw-r--r--src/io/ft_printf/internals/parse.c (renamed from src/io/ft_printf/parse.c)0
-rw-r--r--src/io/ft_printf/internals/utils.c (renamed from src/io/ft_printf/utils.c)0
-rw-r--r--src/lst/ft_lstreverse_ret.c3
-rw-r--r--src/mem/ft_memccpy.c12
-rw-r--r--src/mem/ft_memchr.c8
-rw-r--r--src/mem/ft_memcmp.c12
-rw-r--r--src/mem/ft_memcpy.c4
-rw-r--r--src/mem/ft_memmove.c4
-rw-r--r--src/mem/ft_memset.c4
-rw-r--r--src/str/ft_atoi_strict.c3
-rw-r--r--src/str/ft_strncpy.c4
-rw-r--r--src/str/ft_strtol.c4
m---------test/ctest0
-rw-r--r--test/str/ft_strlen_test.c17
-rw-r--r--test/test_libft.h1
49 files changed, 334 insertions, 280 deletions
diff --git a/Makefile b/Makefile
index 76765dc..f7e97c6 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,7 @@
# By: cacharle <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/10/08 15:45:53 by cacharle #+# #+# #
-# Updated: 2020/01/16 10:23:07 by cacharle ### ########.fr #
+# Updated: 2020/01/17 10:51:24 by cacharle ### ########.fr #
# #
# **************************************************************************** #
@@ -26,30 +26,36 @@ TEST_DIR = test
# AVAILABLE_FEATURES = get_next_line ft_printf ft_lst
CONF_FILE = libft.conf
-# ifndef (FEATURES)
-# endif
+ifndef (FEATURES)
+endif
ifeq ($(wildcard $(CONF_FILE)),)
$(warning "No configuration file found with name $(CONF_FILE), using default")
FEATURES = get_next_line
+ CCFLAGS += -D FT_FEATURES_FT_GET_NEXT_LINE
else
FEATURES = $(shell sed -n 's/FEATURES=//p' $(CONF_FILE))
endif
ifeq ($(findstring get_next_line,$(FEATURES)),)
- FIND_ARGS += -not -path "*get_next_line*"
+ FIND_ARGS += -not -name "ft_get_next_line.c"
+else
+ CCFLAGS += -D FT_FEATURES_FT_GET_NEXT_LINE
endif
ifeq ($(findstring ft_printf,$(FEATURES)),)
FIND_ARGS += -not -path "*printf*"
+else
+ CCFLAGS += -D FT_FEATURES_FT_PRINTF
endif
ifeq ($(findstring ft_lst,$(FEATURES)),)
- FIND_ARGS += -not -name "ft_lst*"
+ FIND_ARGS += -not -name "ft_lst*.c"
+else
+ CCFLAGS += -D FT_FEATURES_FT_LST
endif
-SRC = $(shell find $(SRC_DIR) $(FIND_ARGS) -name *.c)
+SRC = $(shell find $(SRC_DIR) $(FIND_ARGS) -name "*.c")
OBJ = $(SRC:$(SRC_DIR)/%.c=$(BUILD_DIR)/%.o)
-HEADER_FILES = libft.h get_next_line.h
-HEADER = $(addprefix $(INCLUDE_DIR)/,$(HEADER_FILES))
+HEADER = $(shell find $(INCLUDE_DIR) -name "*.h")
all: make_build_dirs $(NAME)
@@ -67,7 +73,7 @@ make_build_dirs:
$(NAME): $(OBJ) $(HEADER)
@echo "Linking: $@"
- @$(LIB) $(NAME) $(OBJ)
+ @$(LIB) $@ $(OBJ)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
@echo "Compiling: $@"
diff --git a/include/ft_ctype.h b/include/ft_ctype.h
new file mode 100644
index 0000000..44e88b8
--- /dev/null
+++ b/include/ft_ctype.h
@@ -0,0 +1,35 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_ctype.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 09:59:10 by cacharle #+# #+# */
+/* Updated: 2020/01/17 10:00:13 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_CTYPE_H
+# define FT_CTYPE_H
+
+/*
+** assertion
+*/
+
+int ft_isalpha(int c);
+int ft_isdigit(int c);
+int ft_isalnum(int c);
+int ft_isascii(int c);
+int ft_isprint(int c);
+int ft_isspace(int c);
+
+/*
+** conversion
+*/
+
+int ft_toupper(int c);
+int ft_tolower(int c);
+int ft_todigit(int c);
+
+#endif
diff --git a/include/get_next_line.h b/include/ft_get_next_line.h
index 9d15202..03bf344 100644
--- a/include/get_next_line.h
+++ b/include/ft_get_next_line.h
@@ -6,20 +6,20 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/09 13:52:59 by cacharle #+# #+# */
-/* Updated: 2020/01/15 07:22:07 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:53:43 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#ifndef GET_NEXT_LINE_H
-# define GET_NEXT_LINE_H
+#ifndef FT_GET_NEXT_LINE_H
+# define FT_GET_NEXT_LINE_H
# include <unistd.h>
# include <stdlib.h>
# include <limits.h>
# include "libft.h"
-# ifndef BUFFER_SIZE
-# define BUFFER_SIZE 32
+# ifndef GNL_BUFFER_SIZE
+# define GNL_BUFFER_SIZE 32
# endif
# define GNL_STATUS_LINE 1
diff --git a/src/io/ft_printf.c b/include/ft_io.h
index 1b92bb2..8c633fb 100644
--- a/src/io/ft_printf.c
+++ b/include/ft_io.h
@@ -1,24 +1,25 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
-/* ft_printf.c :+: :+: :+: */
+/* ft_io.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/11/21 02:31:32 by cacharle #+# #+# */
-/* Updated: 2019/11/21 03:41:54 by cacharle ### ########.fr */
+/* Created: 2020/01/17 09:47:14 by cacharle #+# #+# */
+/* Updated: 2020/01/17 10:07:47 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include "libft.h"
+#ifndef FT_IO_H
+# define FT_IO_H
-int ft_printf(const char *format, ...)
-{
- int ret;
- va_list ap;
+void ft_putendl(char *s);
+void ft_putchar(char c);
+void ft_putstr(char const *s);
+void ft_putnbr(int n);
+void ft_putchar_fd(char c, int fd);
+void ft_putstr_fd(char *s, int fd);
+void ft_putendl_fd(char *s, int fd);
+void ft_putnbr_fd(int n, int fd);
- va_start(ap, format);
- ret = ft_vprintf(format, ap);
- va_end(ap);
- return (ret);
-}
+#endif
diff --git a/include/ft_lst.h b/include/ft_lst.h
new file mode 100644
index 0000000..134df71
--- /dev/null
+++ b/include/ft_lst.h
@@ -0,0 +1,36 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_lst.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 09:58:02 by cacharle #+# #+# */
+/* Updated: 2020/01/17 09:58:45 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_LST_H
+# define FT_LST_H
+
+typedef struct s_list
+{
+ void *content;
+ struct s_list *next;
+} t_list;
+
+t_list *ft_lstnew(void const *content);
+void ft_lstadd_front(t_list **alst, t_list *new);
+int ft_lstsize(t_list *lst);
+t_list *ft_lstlast(t_list *lst);
+void ft_lstadd_back(t_list **alst, t_list *new);
+void ft_lstdelone(t_list *lst, void (*del)(void *));
+void ft_lstclear(t_list **lst, void (*del)(void *));
+void ft_lstiter(t_list *lst, void (*f)(void *));
+t_list *ft_lstmap(t_list *lst, void *(*f)(void *),
+ void (*del)(void *));
+void ft_lstpop_front(t_list **lst, void (*del)(void *));
+t_list *ft_lstreverse_ret(t_list *lst);
+void ft_lstreverse(t_list **lst);
+
+#endif
diff --git a/include/ft_mem.h b/include/ft_mem.h
new file mode 100644
index 0000000..d1e47f6
--- /dev/null
+++ b/include/ft_mem.h
@@ -0,0 +1,31 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_mem.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 09:56:20 by cacharle #+# #+# */
+/* Updated: 2020/01/17 09:57:54 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_MEM_H
+# define FT_MEM_H
+
+void ft_bzero(void *s, size_t n);
+void *ft_memset(void *s, int c, size_t n);
+void *ft_memcpy(void *dest, const void *src, size_t n);
+void *ft_memccpy(void *dest, const void *src, int c, size_t n);
+void *ft_memmove(void *dst, const void *src, size_t len);
+void *ft_memchr(const void *s, int c, size_t n);
+int ft_memcmp(const void *s1, const void *s2, size_t n);
+void *ft_calloc(size_t count, size_t size);
+
+/*
+** bloat ?
+*/
+
+void ft_memdel(void **ap);
+
+#endif
diff --git a/include/ft_printf.h b/include/ft_printf.h
new file mode 100644
index 0000000..615039b
--- /dev/null
+++ b/include/ft_printf.h
@@ -0,0 +1,27 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_printf.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 10:05:59 by cacharle #+# #+# */
+/* Updated: 2020/01/17 10:10:18 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_PRINTF_H
+# define FT_PRINTF_H
+
+int ft_printf(const char *format, ...);
+int ft_sprintf(char *str, const char *format, ...);
+int ft_snprintf(char *str, size_t size, const char *format, ...);
+int ft_asprintf(char **ret, const char *format, ...);
+int ft_dprintf(int fd, const char *format, ...);
+int ft_vprintf(const char *format, va_list ap);
+int ft_vsprintf(char *str, const char *format, va_list ap);
+int ft_vsnprintf(char *str, size_t size, const char *format, va_list ap);
+int ft_vasprintf(char **ret, const char *format, va_list ap);
+int ft_vdprintf(int fd, const char *format, va_list ap);
+
+#endif
diff --git a/include/ft_str.h b/include/ft_str.h
new file mode 100644
index 0000000..105da79
--- /dev/null
+++ b/include/ft_str.h
@@ -0,0 +1,66 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_str.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 09:50:14 by cacharle #+# #+# */
+/* Updated: 2020/01/17 10:22:38 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_STR_H
+# define FT_STR_H
+
+/*
+** std
+*/
+
+size_t ft_strlen(const char *s);
+char *ft_strcpy(char *dest, const char *src);
+char *ft_strncpy(char *dest, const char *src, size_t n);
+char *ft_strdup(const char *s);
+char *ft_strndup(const char *s1, size_t n);
+char *ft_strcat(char *dest, const char *src);
+char *ft_strncat(char *dest, const char *src, size_t n);
+size_t ft_strlcat(char *dst, const char *src, size_t size);
+size_t ft_strlcpy(char *dst, const char *src, size_t size);
+char *ft_strchr(const char *s, int c);
+char *ft_strrchr(const char *s, int c);
+char *ft_strstr(const char *haystack, const char *needle);
+char *ft_strnstr(const char *haystack, const char *needle, size_t len);
+int ft_strcmp(const char *s1, const char *s2);
+int ft_strncmp(const char *s1, const char *s2, size_t n);
+int ft_atoi(const char *nptr);
+
+/*
+** extra
+*/
+
+void ft_striter(char *s, void (*f)(char *));
+void ft_striteri(char *s, void (*f)(unsigned int, char *));
+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);
+char **ft_split(char const *s, char c);
+char *ft_strjoin_free(char const *s1, char const *s2, int free_nb);
+char *ft_strjoin_free_snd(char const *s1, char const *s2);
+int ft_strcount(char *str, char c);
+char *ft_itoa(int n);
+int ft_strict_atoi(const char *s);
+long ft_strtol(const char *s, char **endptr, int base);
+
+/*
+** bloat ?
+*/
+
+char *ft_strnew(size_t size);
+void ft_strdel(char **as);
+void ft_strclr(char *s);
+char *ft_strmap(char const *s, char (*f)(char));
+char *ft_strmapi(char *s, char (*f)(unsigned int, char));
+int ft_strequ(char const *s1, char const *s2);
+int ft_strnequ(char const *s1, char const *s2, size_t n);
+
+#endif
diff --git a/include/ft_types.h b/include/ft_types.h
new file mode 100644
index 0000000..948e33d
--- /dev/null
+++ b/include/ft_types.h
@@ -0,0 +1,26 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* ft_types.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/01/17 09:59:15 by cacharle #+# #+# */
+/* Updated: 2020/01/17 10:16:14 by cacharle ### ########.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef FT_TYPES_H
+# define FT_TYPES_H
+
+typedef unsigned char t_ftbyte;
+typedef int t_ftbool;
+
+typedef char t_ftchar;
+typedef unsigned char t_ftuchar;
+typedef int t_ftint;
+typedef unsigned int t_ftuint;
+typedef long int t_ftlong;
+typedef unsigned long int t_ftulong;
+
+#endif
diff --git a/include/libft.h b/include/libft.h
index d7dc175..0b4d608 100644
--- a/include/libft.h
+++ b/include/libft.h
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:45:02 by cacharle #+# #+# */
-/* Updated: 2020/01/16 10:25:57 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:51:40 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,148 +18,32 @@
# include <stdlib.h>
# include <stddef.h>
# include <limits.h>
-
# include <errno.h>
+# include "ft_types.h"
+# include "ft_ctype.h"
+# include "ft_io.h"
+# include "ft_mem.h"
+# include "ft_str.h"
+
+# ifdef FT_FEATURES_FT_LST
+# include "ft_lst.h"
+# endif
+
+# ifdef FT_FEATURES_FT_GET_NEXT_LINE
+# include "ft_get_next_line.h"
+# endif
-# include "get_next_line.h"
+# ifdef FT_FEATURES_FT_PRINTF
+# include "ft_printf.h"
+# endif
# ifdef __linux__
# include <stdio.h>
# define OPEN_MAX FOPEN_MAX
# endif
-# define MIN(x, y) ((x) < (y) ? (x) : (y))
-# define MAX(x, y) ((x) > (y) ? (x) : (y))
-
-typedef unsigned char t_byte;
-typedef int t_bool;
-
# define TRUE 1
# define FALSE 0
-/*
-** ctype
-*/
-
-int ft_isalpha(int c);
-int ft_isdigit(int c);
-int ft_isalnum(int c);
-int ft_isascii(int c);
-int ft_isprint(int c);
-int ft_isspace(int c);
-int ft_toupper(int c);
-int ft_tolower(int c);
-int ft_todigit(int c);
-
-/*
-** io
-*/
-
-void ft_putendl(char *s);
-void ft_putchar(char c);
-void ft_putstr(char const *s);
-void ft_putnbr(int n);
-void ft_putchar_fd(char c, int fd);
-void ft_putstr_fd(char *s, int fd);
-void ft_putendl_fd(char *s, int fd);
-void ft_putnbr_fd(int n, int fd);
-char *ft_strndup(const char *s1, size_t n);
-int ft_printf(const char *format, ...);
-int ft_sprintf(char *str, const char *format, ...);
-int ft_snprintf(char *str, size_t size,
- const char *format, ...);
-int ft_asprintf(char **ret, const char *format, ...);
-int ft_dprintf(int fd, const char *format, ...);
-
-int ft_vprintf(const char *format, va_list ap);
-int ft_vsprintf(char *str, const char *format, va_list ap);
-int ft_vsnprintf(char *str, size_t size, const char *format,
- va_list ap);
-int ft_vasprintf(char **ret, const char *format, va_list ap);
-int ft_vdprintf(int fd, const char *format, va_list ap);
-
-/*
-** lst
-*/
-
-typedef struct s_list
-{
- void *content;
- struct s_list *next;
-} t_list;
-
-t_list *ft_lstnew(void const *content);
-void ft_lstadd_front(t_list **alst, t_list *new);
-int ft_lstsize(t_list *lst);
-t_list *ft_lstlast(t_list *lst);
-void ft_lstadd_back(t_list **alst, t_list *new);
-void ft_lstdelone(t_list *lst, void (*del)(void *));
-void ft_lstclear(t_list **lst, void (*del)(void *));
-void ft_lstiter(t_list *lst, void (*f)(void *));
-t_list *ft_lstmap(t_list *lst, void *(*f)(void *),
- void (*del)(void *));
-void ft_lstpop_front(t_list **lst, void (*del)(void *));
-t_list *ft_lstreverse_ret(t_list *lst);
-void ft_lstreverse(t_list **lst);
-
-/*
-** mem
-*/
-
-void *ft_memset(void *s, int c, size_t n);
-void ft_bzero(void *s, size_t n);
-void *ft_memcpy(void *dest, const void *src, size_t n);
-void *ft_memccpy(void *dest, const void *src, int c, size_t n);
-void *ft_memmove(void *dst, const void *src, size_t len);
-void *ft_memchr(const void *s, int c, size_t n);
-int ft_memcmp(const void *s1, const void *s2, size_t n);
-
-void *ft_memalloc(size_t size);
-void ft_memdel(void **ap);
-void *ft_calloc(size_t count, size_t size);
-
-/*
-** str
-*/
-
-size_t ft_strlen(const char *s);
-char *ft_strdup(const char *s);
-char *ft_strcpy(char *dest, const char *src);
-char *ft_strncpy(char *dest, const char *src, size_t n);
-char *ft_strcat(char *dest, const char *src);
-char *ft_strncat(char *dest, const char *src, size_t n);
-size_t ft_strlcat(char *dst, const char *src, size_t size);
-size_t ft_strlcpy(char *dst, const char *src, size_t size);
-char *ft_strchr(const char *s, int c);
-char *ft_strrchr(const char *s, int c);
-char *ft_strstr(const char *haystack, const char *needle);
-char *ft_strnstr(const char *haystack,
- const char *needle, size_t len);
-int ft_strcmp(const char *s1, const char *s2);
-int ft_strncmp(const char *s1, const char *s2, size_t n);
-void ft_striter(char *s, void (*f)(char *));
-void ft_striteri(char *s, void (*f)(unsigned int, char *));
-int ft_atoi(const char *nptr);
-
-char *ft_strnew(size_t size);
-void ft_strdel(char **as);
-void ft_strclr(char *s);
-char *ft_strmap(char const *s, char (*f)(char));
-char *ft_strmapi(char *s, char (*f)(unsigned int, char));
-int ft_strequ(char const *s1, char const *s2);
-int ft_strnequ(char const *s1, char const *s2, size_t n);
-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);
-char **ft_split(char const *s, char c);
-
-char *ft_strjoin_free(char const *s1, char const *s2,
- int free_nb);
-char *ft_strjoin_free_snd(char const *s1, char const *s2);
-int ft_strcount(char *str, char c);
-char *ft_itoa(int n);
-int ft_strict_atoi(const char *s);
-long ft_strtol(const char *s, char **endptr, int base);
-
#endif
diff --git a/src/io/get_next_line/get_next_line.c b/src/io/ft_get_next_line.c
index e51f152..4aecf3c 100644
--- a/src/io/get_next_line/get_next_line.c
+++ b/src/io/ft_get_next_line.c
@@ -6,13 +6,11 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/19 09:08:36 by cacharle #+# #+# */
-/* Updated: 2020/01/15 07:26:50 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:53:23 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include "get_next_line.h"
-
-#define HAS_NEWLINE(str, split_at) ((split_at = gnl_find_newline(str)) != -1)
+#include "libft.h"
static int gnl_find_newline(char *str)
{
@@ -46,12 +44,12 @@ static int gnl_read_line(int fd, char **line, char *rest)
int split_at;
char *buf;
- if ((buf = malloc(sizeof(char) * (BUFFER_SIZE + 1))) == NULL)
+ if ((buf = malloc(sizeof(char) * (GNL_BUFFER_SIZE + 1))) == NULL)
return (gnl_free_return(line, NULL, GNL_STATUS_ERROR));
- while ((ret = read(fd, buf, BUFFER_SIZE)) > 0)
+ while ((ret = read(fd, buf, GNL_BUFFER_SIZE)) > 0)
{
buf[ret] = '\0';
- if (HAS_NEWLINE(buf, split_at))
+ if ((split_at = gnl_find_newline(buf)) != -1)
{
ft_strcpy(rest, buf + split_at + 1);
buf[split_at] = '\0';
@@ -88,15 +86,15 @@ static int gnl_read_line(int fd, char **line, char *rest)
int get_next_line(int fd, char **line)
{
int split_at;
- static char rest[OPEN_MAX][BUFFER_SIZE + 1] = {{0}};
+ static char rest[OPEN_MAX][GNL_BUFFER_SIZE + 1] = {{0}};
- if (fd < 0 || fd > OPEN_MAX || line == NULL || BUFFER_SIZE <= 0)
+ if (fd < 0 || fd > OPEN_MAX || line == NULL || GNL_BUFFER_SIZE <= 0)
return (GNL_STATUS_ERROR);
if ((*line = ft_strdup("")) == NULL)
return (GNL_STATUS_ERROR);
if (rest[fd][0] == '\0')
return (gnl_read_line(fd, line, rest[fd]));
- if (HAS_NEWLINE(rest[fd], split_at))
+ if ((split_at = gnl_find_newline(rest[fd])) != -1)
{
free(*line);
if ((*line = (char*)malloc(sizeof(char) * (split_at + 1))) == NULL)
diff --git a/src/io/ft_asprintf.c b/src/io/ft_printf/ft_asprintf.c
index 5eb62d9..5eb62d9 100644
--- a/src/io/ft_asprintf.c
+++ b/src/io/ft_printf/ft_asprintf.c
diff --git a/src/io/ft_dprintf.c b/src/io/ft_printf/ft_dprintf.c
index 8e60970..8e60970 100644
--- a/src/io/ft_dprintf.c
+++ b/src/io/ft_printf/ft_dprintf.c
diff --git a/src/io/ft_printf/ft_printf.c b/src/io/ft_printf/ft_printf.c
index daa0cf2..1b92bb2 100644
--- a/src/io/ft_printf/ft_printf.c
+++ b/src/io/ft_printf/ft_printf.c
@@ -5,88 +5,20 @@
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
-/* Created: 2019/10/29 00:15:28 by cacharle #+# #+# */
-/* Updated: 2019/11/13 08:56:49 by cacharle ### ########.fr */
+/* Created: 2019/11/21 02:31:32 by cacharle #+# #+# */
+/* Updated: 2019/11/21 03:41:54 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
-#include "ft_vasprintf.h"
+#include "libft.h"
-int ft_printf(const char *format, ...)
+int ft_printf(const char *format, ...)
{
- t_printf_status status;
+ int ret;
+ va_list ap;
- if (format == NULL)
- return (STATUS_ERROR);
- if (!parse(format, &status.flist))
- return (STATUS_ERROR);
- va_start(status.ap, format);
- status.format = format;
- status.out = NULL;
- status.out_size = 0;
- while (*status.format)
- {
- if (*status.format == '%'
- && (status.format =
- add_conversion(&status, status.flist->content)) == NULL)
- return (destroy_status_error(&status));
- else if ((status.format = add_between(&status)) == NULL)
- return (destroy_status_error(&status));
- }
- va_end(status.ap);
- list_destroy(&status.flist);
- write(STDOUT_FILENO, status.out, status.out_size);
- free(status.out);
- return (status.out_size);
-}
-
-const char *add_conversion(t_printf_status *status, t_pformat *pformat)
-{
- char *conversion_str;
-
- conversion_str = convert(pformat, status->ap);
- if (pformat->specifier == 'n')
- {
- if (pformat->written != NULL)
- *pformat->written = status->out_size;
- status->format += pformat->fmt_len;
- list_pop_front(&status->flist);
- return (status->format + 1);
- }
- if (conversion_str == NULL)
- return (NULL);
- if (pformat->specifier != 'c')
- pformat->size = ft_strlen(conversion_str);
- if ((status->out = ft_memjoin_free(status->out, status->out_size,
- conversion_str, pformat->size)) == NULL)
- return (NULL);
- status->out_size += pformat->size;
- free(conversion_str);
- status->format += pformat->fmt_len;
- list_pop_front(&status->flist);
- return (status->format + 1);
-}
-
-const char *add_between(t_printf_status *status)
-{
- int i;
-
- i = 0;
- while (status->format[i] && status->format[i] != '%')
- i++;
- if ((status->out = ft_memjoin_free(status->out, status->out_size,
- (void*)status->format, i)) == NULL)
- return (NULL);
- status->out_size += i;
- return (status->format + i);
-}
-
-int destroy_status_error(t_printf_status *status)
-{
- if (status == NULL)
- return (STATUS_ERROR);
- va_end(status->ap);
- list_destroy(&status->flist);
- free(status->out);
- return (STATUS_ERROR);
+ va_start(ap, format);
+ ret = ft_vprintf(format, ap);
+ va_end(ap);
+ return (ret);
}
diff --git a/src/io/ft_snprintf.c b/src/io/ft_printf/ft_snprintf.c
index e1fdfbd..e1fdfbd 100644
--- a/src/io/ft_snprintf.c
+++ b/src/io/ft_printf/ft_snprintf.c
diff --git a/src/io/ft_sprintf.c b/src/io/ft_printf/ft_sprintf.c
index 31da75e..31da75e 100644
--- a/src/io/ft_sprintf.c
+++ b/src/io/ft_printf/ft_sprintf.c
diff --git a/src/io/ft_vasprintf.c b/src/io/ft_printf/ft_vasprintf.c
index 85f66bc..85f66bc 100644
--- a/src/io/ft_vasprintf.c
+++ b/src/io/ft_printf/ft_vasprintf.c
diff --git a/src/io/ft_vdprintf.c b/src/io/ft_printf/ft_vdprintf.c
index a5e5ebf..a5e5ebf 100644
--- a/src/io/ft_vdprintf.c
+++ b/src/io/ft_printf/ft_vdprintf.c
diff --git a/src/io/ft_vprintf.c b/src/io/ft_printf/ft_vprintf.c
index b98670b..b98670b 100644
--- a/src/io/ft_vprintf.c
+++ b/src/io/ft_printf/ft_vprintf.c
diff --git a/src/io/ft_vsnprintf.c b/src/io/ft_printf/ft_vsnprintf.c
index 7db988c..7db988c 100644
--- a/src/io/ft_vsnprintf.c
+++ b/src/io/ft_printf/ft_vsnprintf.c
diff --git a/src/io/ft_vsprintf.c b/src/io/ft_printf/ft_vsprintf.c
index 91b4815..91b4815 100644
--- a/src/io/ft_vsprintf.c
+++ b/src/io/ft_printf/ft_vsprintf.c
diff --git a/src/io/ft_printf/convert.c b/src/io/ft_printf/internals/convert.c
index 398c754..398c754 100644
--- a/src/io/ft_printf/convert.c
+++ b/src/io/ft_printf/internals/convert.c
diff --git a/src/io/ft_printf/convert_char.c b/src/io/ft_printf/internals/convert_char.c
index c5f3a93..c5f3a93 100644
--- a/src/io/ft_printf/convert_char.c
+++ b/src/io/ft_printf/internals/convert_char.c
diff --git a/src/io/ft_printf/convert_hex.c b/src/io/ft_printf/internals/convert_hex.c
index 0464dc7..0464dc7 100644
--- a/src/io/ft_printf/convert_hex.c
+++ b/src/io/ft_printf/internals/convert_hex.c
diff --git a/src/io/ft_printf/convert_int.c b/src/io/ft_printf/internals/convert_int.c
index 2345f76..2345f76 100644
--- a/src/io/ft_printf/convert_int.c
+++ b/src/io/ft_printf/internals/convert_int.c
diff --git a/src/io/ft_printf/convert_none.c b/src/io/ft_printf/internals/convert_none.c
index 358ef1b..358ef1b 100644
--- a/src/io/ft_printf/convert_none.c
+++ b/src/io/ft_printf/internals/convert_none.c
diff --git a/src/io/ft_printf/convert_percent.c b/src/io/ft_printf/internals/convert_percent.c
index 813bb77..813bb77 100644
--- a/src/io/ft_printf/convert_percent.c
+++ b/src/io/ft_printf/internals/convert_percent.c
diff --git a/src/io/ft_printf/convert_ptr.c b/src/io/ft_printf/internals/convert_ptr.c
index 63babb9..63babb9 100644
--- a/src/io/ft_printf/convert_ptr.c
+++ b/src/io/ft_printf/internals/convert_ptr.c
diff --git a/src/io/ft_printf/convert_str.c b/src/io/ft_printf/internals/convert_str.c
index 7d51a5e..7d51a5e 100644
--- a/src/io/ft_printf/convert_str.c
+++ b/src/io/ft_printf/internals/convert_str.c
diff --git a/src/io/ft_printf/convert_uint.c b/src/io/ft_printf/internals/convert_uint.c
index 4207165..4207165 100644
--- a/src/io/ft_printf/convert_uint.c
+++ b/src/io/ft_printf/internals/convert_uint.c
diff --git a/src/io/ft_printf/convert_written.c b/src/io/ft_printf/internals/convert_written.c
index 4beeaef..4beeaef 100644
--- a/src/io/ft_printf/convert_written.c
+++ b/src/io/ft_printf/internals/convert_written.c
diff --git a/src/io/ft_printf/extract.c b/src/io/ft_printf/internals/extract.c
index c56a777..c56a777 100644
--- a/src/io/ft_printf/extract.c
+++ b/src/io/ft_printf/internals/extract.c
diff --git a/src/io/ft_printf/length_modifier.c b/src/io/ft_printf/internals/length_modifier.c
index 88226da..88226da 100644
--- a/src/io/ft_printf/length_modifier.c
+++ b/src/io/ft_printf/internals/length_modifier.c
diff --git a/src/io/ft_printf/list.c b/src/io/ft_printf/internals/list.c
index 99491f4..99491f4 100644
--- a/src/io/ft_printf/list.c
+++ b/src/io/ft_printf/internals/list.c
diff --git a/src/io/ft_printf/parse.c b/src/io/ft_printf/internals/parse.c
index 33928a0..33928a0 100644
--- a/src/io/ft_printf/parse.c
+++ b/src/io/ft_printf/internals/parse.c
diff --git a/src/io/ft_printf/utils.c b/src/io/ft_printf/internals/utils.c
index ad44980..ad44980 100644
--- a/src/io/ft_printf/utils.c
+++ b/src/io/ft_printf/internals/utils.c
diff --git a/src/lst/ft_lstreverse_ret.c b/src/lst/ft_lstreverse_ret.c
index 03ae98e..3e2118f 100644
--- a/src/lst/ft_lstreverse_ret.c
+++ b/src/lst/ft_lstreverse_ret.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 12:51:15 by cacharle #+# #+# */
-/* Updated: 2020/01/15 13:36:46 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:12:42 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,6 +15,7 @@
t_list *ft_lstreverse_ret(t_list *lst)
{
t_list *tmp;
+
if (lst == NULL)
return (NULL);
if (lst->next == NULL)
diff --git a/src/mem/ft_memccpy.c b/src/mem/ft_memccpy.c
index f95aa03..8ce656a 100644
--- a/src/mem/ft_memccpy.c
+++ b/src/mem/ft_memccpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:01:53 by cacharle #+# #+# */
-/* Updated: 2019/11/20 03:30:45 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:03 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,12 +14,12 @@
void *ft_memccpy(void *dest, const void *src, int c, size_t n)
{
- size_t i;
- t_byte *cast_dest;
- t_byte *cast_src;
+ size_t i;
+ t_ftbyte *cast_dest;
+ t_ftbyte *cast_src;
- cast_dest = (t_byte*)dest;
- cast_src = (t_byte*)src;
+ cast_dest = (t_ftbyte*)dest;
+ cast_src = (t_ftbyte*)src;
i = -1;
while (++i < n)
{
diff --git a/src/mem/ft_memchr.c b/src/mem/ft_memchr.c
index d2364db..27e9028 100644
--- a/src/mem/ft_memchr.c
+++ b/src/mem/ft_memchr.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:55:31 by cacharle #+# #+# */
-/* Updated: 2019/11/20 03:30:55 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:53:57 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,10 +14,10 @@
void *ft_memchr(const void *s, int c, size_t n)
{
- size_t i;
- t_byte *cast_s;
+ size_t i;
+ t_ftbyte *cast_s;
- cast_s = (t_byte*)s;
+ cast_s = (t_ftbyte*)s;
i = -1;
while (++i < n)
if (cast_s[i] == (unsigned char)c)
diff --git a/src/mem/ft_memcmp.c b/src/mem/ft_memcmp.c
index 2c8e179..233d796 100644
--- a/src/mem/ft_memcmp.c
+++ b/src/mem/ft_memcmp.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 09:56:44 by cacharle #+# #+# */
-/* Updated: 2019/11/21 01:58:42 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:15 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,12 +14,12 @@
int ft_memcmp(const void *s1, const void *s2, size_t n)
{
- size_t i;
- t_byte *cast_s1;
- t_byte *cast_s2;
+ size_t i;
+ t_ftbyte *cast_s1;
+ t_ftbyte *cast_s2;
- cast_s1 = (t_byte*)s1;
- cast_s2 = (t_byte*)s2;
+ cast_s1 = (t_ftbyte*)s1;
+ cast_s2 = (t_ftbyte*)s2;
if (n == 0)
return (0);
i = -1;
diff --git a/src/mem/ft_memcpy.c b/src/mem/ft_memcpy.c
index ca679fc..d0ef008 100644
--- a/src/mem/ft_memcpy.c
+++ b/src/mem/ft_memcpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:00:07 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:04:36 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:04 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -22,7 +22,7 @@ void *ft_memcpy(void *dest, const void *src, size_t n)
while (n % 8 > 0)
{
n--;
- ((t_byte*)dest)[n] = ((t_byte*)src)[n];
+ ((t_ftbyte*)dest)[n] = ((t_ftbyte*)src)[n];
}
long_dest = dest;
long_src = src;
diff --git a/src/mem/ft_memmove.c b/src/mem/ft_memmove.c
index 73e26b8..2f794fd 100644
--- a/src/mem/ft_memmove.c
+++ b/src/mem/ft_memmove.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:03:21 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:43:26 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:26 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,7 @@ void *ft_memmove(void *dst, const void *src, size_t len)
while (len % 8 > 0)
{
len--;
- *(t_byte*)dst++ = *(t_byte*)src++;
+ *(t_ftbyte*)dst++ = *(t_ftbyte*)src++;
}
long_dst = dst;
long_src = src;
diff --git a/src/mem/ft_memset.c b/src/mem/ft_memset.c
index 4ede5f3..89f53ff 100644
--- a/src/mem/ft_memset.c
+++ b/src/mem/ft_memset.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:01:23 by cacharle #+# #+# */
-/* Updated: 2019/11/21 18:40:59 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:39:10 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -19,7 +19,7 @@ void *ft_memset(void *s, int c, size_t n)
c = (unsigned char)c;
while (n % 8 > 0)
- *((t_byte*)s + --n) = c;
+ *((t_ftbyte*)s + --n) = c;
buf = (long int)c | (long int)c << 8 | (long int)c << 16
| (long int)c << 24 | (long int)c << 32 | (long int)c << 40
| (long int)c << 48 | (long int)c << 56;
diff --git a/src/str/ft_atoi_strict.c b/src/str/ft_atoi_strict.c
index 6156b03..0079807 100644
--- a/src/str/ft_atoi_strict.c
+++ b/src/str/ft_atoi_strict.c
@@ -6,13 +6,12 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 10:06:29 by cacharle #+# #+# */
-/* Updated: 2020/01/15 14:09:03 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:12:54 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
-#include <stdio.h>
int ft_strict_atoi(const char *s)
{
char *end;
diff --git a/src/str/ft_strncpy.c b/src/str/ft_strncpy.c
index a0cfb4c..07a4927 100644
--- a/src/str/ft_strncpy.c
+++ b/src/str/ft_strncpy.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/07 10:26:59 by cacharle #+# #+# */
-/* Updated: 2019/11/21 02:49:48 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:40:21 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -17,7 +17,7 @@ char *ft_strncpy(char *dest, const char *src, size_t n)
size_t len;
len = ft_strlen(src);
- ft_memcpy(dest, src, MIN(n, len));
+ ft_memcpy(dest, src, n < len ? n : len);
if (len < n)
ft_bzero(dest + len, n - len);
return (dest);
diff --git a/src/str/ft_strtol.c b/src/str/ft_strtol.c
index 0fb5261..e5ce552 100644
--- a/src/str/ft_strtol.c
+++ b/src/str/ft_strtol.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/15 10:26:45 by cacharle #+# #+# */
-/* Updated: 2020/01/15 14:15:40 by cacharle ### ########.fr */
+/* Updated: 2020/01/17 10:54:41 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -51,7 +51,7 @@ static long errno_return(int err)
long ft_strtol(const char *str, char **endptr, int base)
{
- t_bool is_negative;
+ t_ftbool is_negative;
long long nb;
char base_str[37];
diff --git a/test/ctest b/test/ctest
-Subproject 61963f169ff5ae4dc18c5e6e1c7c6972745d6cf
+Subproject ab5906865fab359cbb0a814ef3863bbc1fe5f10
diff --git a/test/str/ft_strlen_test.c b/test/str/ft_strlen_test.c
index 57ccee4..1c444ba 100644
--- a/test/str/ft_strlen_test.c
+++ b/test/str/ft_strlen_test.c
@@ -14,10 +14,21 @@ ASSERT_FUNC1(ft_strlen, char*, str)
}
ASSERT_FUNC1_END
+ASSERT_PRINT_ARG_FUNC1(ft_strlen, char*, str)
+{
+ printf("(str: \"%.30s", str);
+ if (strlen(str) > 30)
+ fputs("...", stdout);
+ fputs("\")", stdout);
+}
+ASSERT_PRINT_ARG_FUNC1_END
+
TEST(ft_strlen)
{
- ASSERT(ft_strlen, "bonjour");
- ASSERT(ft_strlen, "yo");
- ASSERT(ft_strlen, "slt");
+ ASSERT(ft_strlen, CTEST_DEF_EMPTY);
+ ASSERT(ft_strlen, CTEST_DEF_HELLO);
+ ASSERT(ft_strlen, CTEST_DEF_HIDDEN);
+ ASSERT(ft_strlen, CTEST_DEF_FORMAT);
+ ASSERT(ft_strlen, CTEST_DEF_LOREM_IPSUM);
}
diff --git a/test/test_libft.h b/test/test_libft.h
index f4d489f..aa23e54 100644
--- a/test/test_libft.h
+++ b/test/test_libft.h
@@ -2,6 +2,7 @@
# define TEST_LIBFT_H
# include "ctest.h"
+# include "libft.h"
TEST(ft_strlen);