removing the libft of rparodi
This commit is contained in:
parent
0391323626
commit
be6038dcc8
523 changed files with 724 additions and 3336 deletions
39
libft/tests/ft_string/ft_str/test_strtok.c
Normal file
39
libft/tests/ft_string/ft_str/test_strtok.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* test_strtok.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/26 11:24:49 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/06/25 21:43:49 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_string.h"
|
||||
|
||||
int test_strtok(void)
|
||||
{
|
||||
char test[50];
|
||||
char lorem[30];
|
||||
|
||||
lorem[0] = '\0';
|
||||
test[0] = '\0';
|
||||
ft_strlcpy(lorem, "Lorem ipsum dolor ", 30);
|
||||
ft_strlcpy(test, ":::path/to/file:::another/path::yet/:/another/path", 47);
|
||||
if (ft_strcmp(ft_strtok(lorem, " "), "Lorem") != 0
|
||||
|| ft_strcmp(ft_strtok(NULL, " "), "ipsum") != 0
|
||||
|| ft_strcmp(ft_strtok(NULL, " "), "dolor") != 0)
|
||||
return (1);
|
||||
if (ft_strcmp(ft_strtok(NULL, " "), "") != 0 || ft_strtok(NULL,
|
||||
" "))
|
||||
return (2);
|
||||
if (ft_strcmp(ft_strtok(test, ":"), "path/to/file") != 0
|
||||
|| ft_strcmp(ft_strtok(NULL, ":"), "another/path") != 0)
|
||||
return (3);
|
||||
if (ft_strcmp(ft_strtok(NULL, ":/"), "yet") != 0)
|
||||
return (4);
|
||||
if (ft_strcmp(ft_strtok(NULL, ":/"), "another") != 0)
|
||||
return (5);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue