string: add a test case for a buggy situation of strtok
This commit is contained in:
parent
684f827e99
commit
c712416d12
|
@ -92,10 +92,11 @@ static void _ft_string_naive(ft_test *t)
|
|||
ft_assert(t, strstr(s1, "abcdabc") == NULL);
|
||||
ft_assert(t, strcasestr(s1, "ABCdaBd") == s1 + 15);
|
||||
|
||||
char input[] = ",;,section 1;section 2,,section 3,,";
|
||||
char input[] = ",;,section 1;section 2,,section 3,,section 4";
|
||||
ft_assert(t, strcmp(strtok(input, ";,"), "section 1") == 0);
|
||||
ft_assert(t, strcmp(strtok(NULL, ";,"), "section 2") == 0);
|
||||
ft_assert(t, strcmp(strtok(NULL, ";,"), "section 3") == 0);
|
||||
ft_assert(t, strcmp(strtok(NULL, ";,"), "section 4") == 0);
|
||||
ft_assert(t, strtok(NULL, ";,") == NULL);
|
||||
ft_assert(t, strtok(NULL, ";,") == NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue