added bgoulard lib + made lib sources in their own directory in build/ for readability
This commit is contained in:
parent
83cc8419a0
commit
0a390934d6
457 changed files with 21807 additions and 61 deletions
38
libft_personal/tests/ft_string/ft_str/test_split.c
Normal file
38
libft_personal/tests/ft_string/ft_str/test_split.c
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* test_split.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/26 11:13:01 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/05/31 15:08:58 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_string.h"
|
||||
|
||||
int test_split(void)
|
||||
{
|
||||
const char *str = " Hello World! ";
|
||||
char **res;
|
||||
const char *str2 = "Hello World! ";
|
||||
char **res2;
|
||||
size_t i;
|
||||
|
||||
res = ft_split(str, ' ');
|
||||
res2 = ft_split(str2, ' ');
|
||||
if (ft_strcmp(res[0], "Hello") != 0 || ft_strcmp(res[1], "World!") != 0
|
||||
|| res[2])
|
||||
return (1);
|
||||
if (ft_strcmp(res2[0], "Hello") != 0 || ft_strcmp(res2[1], "World!") != 0
|
||||
|| res2[2])
|
||||
return (2);
|
||||
i = 0;
|
||||
while (res[i])
|
||||
free(res[i++]);
|
||||
i = 0;
|
||||
while (res2[i])
|
||||
free(res2[i++]);
|
||||
return (free(res), free(res2), 0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue