add: strdup test

This commit is contained in:
starnakin 2024-09-05 18:39:38 +02:00
parent eadf7cde62
commit cbed6c468f

View File

@ -163,6 +163,19 @@ void multiple_test_push_front()
} }
} }
void multiple_test_strdup(const char * const *values)
{
char *tmp;
for (size_t i = 0; values[i] != NULL; i++)
{
tmp = ft_strdup(values[i]);
test_str(tmp, values[i]);
free(tmp);
printf("\n");
}
}
int main() int main()
{ {
printf("STRLEN\n"); printf("STRLEN\n");
@ -180,8 +193,11 @@ int main()
multiple_test_strcpy(ft_strcpy, strcpy_tests); multiple_test_strcpy(ft_strcpy, strcpy_tests);
printf("\n"); printf("\n");
ft_write(1, "bozo\n", 5); printf("STRDUP\n");
printf("%s\n", ft_strdup("sdsfsd")); const char *strdup_tests[] = {"yo", "", "bonjour", "co\0fgf", NULL};
multiple_test_strdup(strdup_tests);
printf("\n");
/* /*
printf("ATOI_BASE\n"); printf("ATOI_BASE\n");
const char *atoi_base_tests[][2] = {{"0123", ""}, {"0123", "0"}, {"0123", "0123456789"}, {"bonjour", "bonjour"}, {"", ""}, {"bonjour", "salut"}, {"co\0fgf", "co\0fgf"}, NULL}; const char *atoi_base_tests[][2] = {{"0123", ""}, {"0123", "0"}, {"0123", "0123456789"}, {"bonjour", "bonjour"}, {"", ""}, {"bonjour", "salut"}, {"co\0fgf", "co\0fgf"}, NULL};