int ft_isalnum(int c);
int ft_isalpha(int c);
int ft_isascii(int c);
int ft_isdigit(int c);
int ft_isprint(int c);
size_t ft_strlen(const char *s);
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);
Basic use of the function.
Normal input but with n < strlen(input).
Normal input but with n = 0.
dst & src pointing on same address.
dst set to NULL. Behavior on ubuntu: crash.
src set to NULL. Behavior on ubuntu: crash.
dst & src set to NULL. Behavior on ubuntu: crash.
void *ft_memmove(void *dest, const void *src, size_t n);
Basic use of the function.
dst & src pointing on same address.
dst address set to a lower address than src but with an overlapping size.
src address set to a lower address than dst but with an overlapping size.
Normal input but with n < strlen(input).
Normal input but with n = 0.
dst set to NULL. Behavior on ubuntu: crash.
src set to NULL. Behavior on ubuntu: crash.
dst & src set to NULL. Behavior on ubuntu: crash.
size_t ft_strlcpy(char *dst, const char *src, size_t size);
Basic use of the function. Behavior: copies size-1 bytes from src to dst + \0. Return value: length of src.
Size smaller than src. Behavior: copies size-1 bytes from src to dst + \0. Return value: length of src.
Size bigger than src. Behavior: copies only strlen(src) bytes from src to dst. Return value: length of src.
size = 0. Behavior: doesn’t copy anything. Return value: length of src.
dst set to NULL. Behavior: CRASH.
src set to NULL. Behavior: CRASH.
dst & src set to NULL. Behavior: CRASH.
size_t ft_strlcat(char *dst, const char *src, size_t size);
Basic use of function. Behavior: Copies size - len(dst) - 1 bytes from src to end of dst + \0. Return value: Initial length of dst + length of src.
Size smaller than final buffer. Behavior: Copies size - len(dst) - 1 bytes from src to end of dst + \0 (Truncation). Return value: Initial length of dst + length of src if size >= len(dst) else size + length of src.
Size smaller than len(dst). Behavior: Doesn’t copy anything. Return value: size + length of src.
Size bigger than strlen(dst) + strlen(src). Behavior: Does the copy but stops at \0 of src. Return value: Initial length of dst + length of src.
Size = 0. Behavior: Doesn’t copy anything. Return value: Length of src (same calculation than if size < len(dst)).
dst set to NULL. Behavior: CRASH. Return value: /
dst set to NULL and size set to zero. Behavior: Doesn’t copy anything. (NO CRASH). Return value: length of src.
src set to NULL. Behavior: CRASH. Return value: /
dst & src set to NULL. Behavior: CRASH. Return value: /
int ft_toupper(int c);
int ft_tolower(int c);
int ft_strncmp(const char *s1, const char *s2, size_t n);
s1 & s2 the same. Return value: 0
s1 & s2 different, s1 less than s2 Return value: negative (s1[i] - s2[i])
s1 & s2 different, s1 greater than s2 Return value: positive (s1[i] - s2[i])
s1 & s2 the same until ‘\0’ in s1. n set to length of s2. Return value: negative (0 - s2[i])
s1 & s2 the same until ‘\0’ in s2. n set to length of s1. Return value: positive (s1[i] - 0)
n smaller than the 2 lengths. Return value: difference between nth char of the 2 strings.
n bigger than the 2 lengths. Return value: difference between last char of the smaller string and equivalent char of the other.
n set to zero. Return value: 0
Insertion of values not initially unsigned char to test that the function casts to unsigned char. Return value: diff as usual.
s1 set to NULL with n > 0. Return value: / (CRASH)
s2 set to NULL with n > 0. Return value: / (CRASH)
s1 & s2 set to NULL with n > 0. Return value: / (CRASH)
s1 & s2 set to NULL with n > 0. Return value: 0 (NO CRASH)
void *ft_memchr(const void *s, int c, size_t n);
Normal use of the function with c placed in s. Return value: pointer to first instance of c in s.
Normal use of the function, c has multiple instances in s. Return value: pointer to first instance of c in s.
Normal use of the function, c not in s. Return value: NULL.
Test the function with a non unsigned char value in c (present in s). Return value: pointer to instance of c in s (only if c and s[i] are cast to unsigned char).
Search for ‘\0’ (‘\0’ is also put in s). Return value: pointer to ‘\0’ in s.
Normal inputs but n smaller than s. Return value: pointer to first instance of c but tests at most n bytes.
s set to NULL. Return value: / (CRASH).
s set to NULL and n to zero. Return value: NULL.
int ft_memcmp(const void *s1, const void *s2, size_t n);
Basic use of the function, s1 and s2 beeing equal and n = len(s1). Return value: 0.
Basic use of the function, s1 and s2 differs (s1 < s2) and n = len(s1). Return value: negative (s1[i] - s2[i]).
Basic use of the function, s1 and s2 differs (s1 > s2) and n = len(s1). Return value: positive (s1[i] - s2[i]).
Both strings contain multiple ‘\0’ inside and then a byte is different (s1 > s2). Return value: positive.
n set to zero. Return value: 0.
s1 value set to an integer bigger than unsigned char. Return value: Same as usual if values are casted to unsigned char.
s2 value set to an integer bigger than unsigned char. Return value: Same as usual if values are casted to unsigned char.
s1 set to NULL and n > 0. Return value: / (CRASH)
s2 set to NULL and n > 0. Return value: / (CRASH)
s1 & s2 set to NULL, n > 0. Return value: / (CRASH)
s1 & s2 set to NULL, n = 0. Return value: 0.
char *ft_strnstr(const char *big, const char *little, size_t len);
string little contained in big and len = len(big). Return value: pointer to first char of first occurrence of little in big.
string little not contained in big. Return value: NULL.
len set len(little). len is contained in big but only after len. Return value: NULL.
little contained in big but after len. Return value: NULL.
little not contained in big and len > len(big). Return value: NULL.
len set to zero. Return value: NULL.
big set to an empty string. Return value: NULL.
little set to an empty string. Return value: big.
little & big set to an empty string. Return value: pointer to big.
big set to NULL. Return value: / (CRASH)
big set to NULL. Return value: NULL.
little set to NULL. Return value: / (CRASH)
little set to NULL. Return value: / (CRASH)
big & little set to NULL with len > 0. Return value: / (CRASH)
big & little set to NULL with len = 0. Return value: / (CRASH)
int ft_atoi(const char *nptr);
Simple number passed. Return value: integer version of number in nptr.
Negative number passed. Return value: integer version of number in nptr.
Normal number with positive sign before. Return value: integer version of number in nptr.
Normal number with more than one signs before. Return value: 0.
Normal number with multiple whitespaces before sign. Return value: integer version of number in nptr.
Normal number with multiple whitespaces after sign. Return value: 0.
Normal number with whitespaces after some numbers. Return value: integer version of number before whitespaces.
Minimum integer passed. Return value: integer version of number in nptr.
Maximum integer passed. Return value: integer version of number in nptr.
Number greater than int max passed. Return value: equivalent value of number converted to int (bits).
Number greater than unsigned int max passed. Return value: -1
nptr set to empty string. Return value: 0.
nptr set to NULL. Return value: / (CRASH)
void *ft_calloc(size_t nmemb, size_t size);
Try to free memory allocated by ft_calloc with normal inputs. Behavior: Allocation & initialization of memory. Return value: pointer to memory.
Normal values passed and size asked to malloc compared to right value. Behavior: Allocation & initialization of memory. Return value: pointer to memory.
Make malloc fail. Behavior: No allocation. Return value: NULL.
nmemb & size set to 0. Behavior: No allocation. Return value: unique pointer value that can be passed to free().
Too big size passed to ft_calloc. Behavior: No allocation. Return value: NULL for too big number (ULONG_MAX for ex.) and a pointer for int overflow.
char *ft_strdup(const char *s);
Normal c string passed. Behavior: s copied in new pointer allocated. Return value: pointer to s.
Make malloc fail. Behavior: s not copied because function stops after malloc fail. Return value: NULL.
s allocated but empty string. Behavior: empty string copied. Return value: pointer to s.
s set to NULL. Behavior: CRASH Return value: / (CRASH)
char *ft_substr(char const *s, unsigned int start, size_t len);
Basic inputs passed to the function. Behavior: copies string s from index start with length len. Return value: the substring.
start set to 0 & len set to strlen(s). Behavior: copies string s from index start with length len. Return value: the substring (same string as s).
Same inputs but with len > strlen(s) - start. Behavior: copies string s from index start with length = length of s from start to ‘\0’. Return value: the substring.
len set to 0. Behavior: Copies empty string (copy = len - 1, last character beeing ‘\0’). Return value: the substring (empty string).
start set to a greater number than strlen(s). Behavior: Creates empty string. Return value: the substring (empty string).
start set to strlen(s). Behavior: Creates empty string. Return value: the substring (empty string).
s set to an empty string (start = 0 & len = 1) Behavior: Copies empty string. Return value: the substring (empty string).
s set to NULL. Behavior: No copy. Return value: NULL.
Make malloc fail. Behavior: No copy. Return value: NULL.
char *ft_strjoin(char const *s1, char const *s2);
s1 & s2 set to differents strings. Behavior: allocation of a new string in which s1 + s2 are copied. Return value: the new string.
make malloc fail. Behavior: No copy. Return value: NULL.
s1 set to an empty string. Behavior: allocation of a new string in which s1 + s2 are copied (so only s2). Return value: the new string (=s2).
s2 set to an empty string. Behavior: allocation of a new string in which s1 + s2 are copied (so only s1). Return value: the new string (=s1).
s1 & s2 set to empty strings. Behavior: allocation of a new string in which s1 + s2 are copied (so ‘\0’). Return value: the new string (=’\0’).
s1 set to NULL. Behavior: Nothing. Return value: NULL.
s2 set to NULL. Behavior: Nothing. Return value: NULL.
s1 & s2 set to NULL. Behavior: Nothing. Return value: NULL.
char *ft_strtrim(char const *s1, char const *set);
Basic inputs passed to the function. Behavior: s1 is trimmed and returned. Return value: trimmed s1 (copy).
Characters of set only in the string (not at beginning or end). Behavior: s1 is not modified. Return value: s1 (copy).
No character of set present in s1. Behavior: s1 is not modified. Return value: s1 (copy).
s1 contains only characters from set. Behavior: empty string copied. Return value: empty string.
set set to an empty string. Behavior: s1 is not modified. Return value: s1 (copy).
s1 set to an empty string. Behavior: s1 is not modified. Return value: s1 (copy).
Make malloc fail. Behavior: Nothing. Return value: NULL.
s1 set to NULL. Behavior: Nothing. Return value: NULL.
set set to NULL. Behavior: Nothing. Return value: NULL.
s1 & set set to NULL. Behavior: Nothing. Return value: NULL.
char **ft_split(char const *s, char c);
s set to a string containing multiple times c. Behavior: s is split. Return value: array of new strings.
s set to a string containing multiple times c plus before and after the string. Behavior: s is split. Return value: array of new strings (no empty string).
s set to a string not containing c. Behavior: s is split (only one string). Return value: array of new string.
c set to zero (‘\0’). Behavior: s is split (only one string). Return value: array of new string.
s set to an empty string. Behavior: s is split (only one string). Return value: array of new string.
Make malloc fail. Behavior: Nothing. Return value: NULL.
s set to NULL. Behavior: Nothing. Return value: NULL.
char *ft_itoa(int n);
n set to a positive number. Return value: string representing the integer.
n set to a negative number. Return value: string representing the integer.
n set to maximum int. Return value: string representing the integer.
n set to minimum int. Return value: string representing the integer.
n set to zero. Return value: string representing the integer.
Make malloc fail. Return value: NULL.
char *ft_strmapi(char const *s, char (*f)(unsigned int, char));
The test function passed to strmapi will be a rot47 function.
s set to a normal string, f a rot47 function. Behavior: s modified by f. Return value: the new string.
s set to an empty string. Behavior: s modified by f (nothing). Return value: the new string (empty).
s set to NULL. Behavior: Nothing. Return value: NULL.
f set to NULL. Behavior: Nothing. Return value: NULL.
Make malloc fail Behavior: Nothing. Return value: NULL.
void ft_striteri(char *s, void (*f)(unsigned int, char*));
The test function passed to striteri will be a rot47 function.
s set to a normal string, f a rot47 function. Behavior: s modified by f.
s set to an empty string. Behavior: s modified by f (nothing).
s set to NULL. Behavior: Nothing.
f set to NULL. Behavior: Nothing.
void ft_putchar_fd(char c, int fd);
fd set to a pipe fd (stdout & stderr closed) and c to a regular char. Behavior: writes c to fd.
void ft_putstr_fd(char *s, int fd);
fd set to a pipe fd (stdout & stderr closed) and s to a regular string. Behavior: writes string s to fd.
fd set to a pipe fd (stdout & stderr closed) and s to an empty string. Behavior: writes (empty) s to fd.
fd set to a pipe fd (stdout & stderr closed) and s to NULL. Behavior: Nothing.
void ft_putendl_fd(char *s, int fd);
fd set to a pipe fd (stdout & stderr closed) and s to a regular string. Behavior: writes string s (with ‘\n’) to fd.
fd set to a pipe fd (stdout & stderr closed) and s to a string terminated by multiple newlines. Behavior: writes string s (with ‘\n’) to fd.
fd set to a pipe fd (stdout & stderr closed) and s to an empty string. Behavior: writes s (only ‘\n’) to fd.
fd set to a pipe fd (stdout & stderr closed) and s to NULL. Behavior: Nothing.
void ft_putnbr_fd(int n, int fd);
fd set to a pipe fd (stdout & stderr closed) and n to positive number. Behavior: converts n to a string and then writes it to fd.
fd set to a pipe fd (stdout & stderr closed) and n to negative number. Behavior: converts n to a string and then writes it to fd.
fd set to a pipe fd (stdout & stderr closed) and n to minimum integer. Behavior: converts n to a string and then writes it to fd.
fd set to a pipe fd (stdout & stderr closed) and n to maximum integer. Behavior: converts n to a string and then writes it to fd.
fd set to a pipe fd (stdout & stderr closed) and n to zero. Behavior: converts n to a string and then writes it to fd.
t_list *ft_lstnew(void *content);
content set to a basic string. Behavior: A node containing the string as content is allocated. Return value: The new node.
content set to NULL. Behavior: A node containing NULL as content is allocated. Return value: The new node.
Make malloc fail. Behavior: Tries to allocate memory. Return value: NULL.
void ft_lstadd_front(t_list **lst, t_list *new);
Creation of 2 nodes then call of the function. Behavior: The lst param becomes new, with next set to old lst.
lst set to NULL. Behavior: Nothing.
lst pointing to a NULL address. Behavior: pointer of lst set to new.
new set to NULL. Behavior: Nothing.
lst & new set to NULL. Behavior: Nothing.
int ft_lstsize(t_list *lst);
lst set to a list of multiple nodes. Return value: The size of lst.
lst set to NULL. Return value: Zero.
t_list *ft_lstlast(t_list *lst);
lst set to a list of multiple nodes. Return value: The last node of the list.
lst set to NULL. Return value: NULL.
void ft_lstadd_back(t_list **lst, t_list *new);
Creation of 2 nodes then call of the function. Behavior: The next element of lst is set to new.
lst set to NULL. Behavior: lst set to new.
lst points to NULL. Behavior: lst set to new.
new set to NULL. Behavior: Nothing.
lst & new set to NULL. Behavior: Nothing.
void ft_lstdelone(t_list *lst, void (*del)(void *));
lst set to a node containing a 2D array of ints, del to appropriate function to free the content. Behavior: the content is freed using del and then the node is freed.
lst set to NULL. Behavior: Nothing.
del set to NULL. Behavior: Nothing.
void ft_lstclear(t_list **lst, void (*del)(void *));
lst set to a list of multiple nodes of 2D arrays of int, del to appropriate function to free the content. Behavior: every node is freed after the content. The lst is then set to NULL.
lst set to NULL. Behavior: Nothing.
lst set to pointer to NULL. Behavior: Nothing.
del set to NULL. Behavior: Nothing.
void ft_lstiter(t_list *lst, void (*f)(void *));
lst set to a list of multiple nodes containing a string, f to a rot47 function. Behavior: Iterates on lst and applies f on the content of each node.
lst set to NULL. Behavior: Nothing.
f set to NULL. Behavior: Nothing.
t_list *ft_lstmap(t_list *lst, void *(*f)(void *), void (*del)(void *));
lst set to a list of multiple nodes, each containing a string. f a rot47 function. del to the corresponding delete function. Behavior: Creation of a new list. Return value: The new list.
Same parameters but make malloc fail. Behavior: Nothing. Return value: NULL.
Same parameters but make the third malloc fail. Behavior: Tries to create the new list but third malloc fails, so the del function is called on each node of the new list & everything is freed (the new list). Return value: NULL.
lst set to NULL. Behavior: Nothing. Return value: NULL.
f set to NULL. Behavior: Nothing. Return value: NULL.
del set to NULL. Behavior: Nothing. Return value: NULL.