Compare commits
No commits in common. "59cb1ccc1cd314eba9349b49004b014e8c604d0d" and "34d94e3a4e29d02b2d284f3366a9cf1f78538941" have entirely different histories.
59cb1ccc1c
...
34d94e3a4e
3 changed files with 2 additions and 78 deletions
4
Makefile
4
Makefile
|
|
@ -6,7 +6,7 @@
|
||||||
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
|
# By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2025/10/03 18:03:12 by lalgarra #+# #+# #
|
# Created: 2025/10/03 18:03:12 by lalgarra #+# #+# #
|
||||||
# Updated: 2025/10/08 20:35:23 by lalgarra ### ########.fr #
|
# Updated: 2025/10/08 19:27:12 by lalgarra ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
|
|
@ -22,7 +22,7 @@ TESTS := ft_isalpha_test ft_isdigit_test ft_isalnum_test ft_isascii_test \
|
||||||
ft_memset_test ft_bzero_test ft_memcpy_test ft_calloc_test \
|
ft_memset_test ft_bzero_test ft_memcpy_test ft_calloc_test \
|
||||||
ft_memmove_test ft_strlcpy_test ft_strlcat_test ft_strchr_test \
|
ft_memmove_test ft_strlcpy_test ft_strlcat_test ft_strchr_test \
|
||||||
ft_strrchr_test ft_strncmp_test ft_memcmp_test ft_strnstr_test \
|
ft_strrchr_test ft_strncmp_test ft_memcmp_test ft_strnstr_test \
|
||||||
ft_atoi_test ft_substr_test ft_strjoin_test
|
ft_atoi_test ft_substr_test
|
||||||
|
|
||||||
%_test : %_test.c
|
%_test : %_test.c
|
||||||
$(CC) $(CFLAGS) $*_test.c -L$(LIBDIR) -lft -o $*_test
|
$(CC) $(CFLAGS) $*_test.c -L$(LIBDIR) -lft -o $*_test
|
||||||
|
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
test 1: str1:[Lorem], str2:[ ipsum], result:[Lorem ipsum]
|
|
||||||
test 2: str1:[], str2:[ ipsum], result:[ ipsum]
|
|
||||||
test 3: str1:[Lorem], str2:[], result:[Lorem]
|
|
||||||
test 4: str1:[Lorem], str2:[-NULL-], result:[Lorem]
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* ft_strjoin_test.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2025/10/08 20:21:32 by lalgarra #+# #+# */
|
|
||||||
/* Updated: 2025/10/08 20:41:28 by lalgarra ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "libft.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
static void ft_putstr_fd1(char *res, int fd)
|
|
||||||
{
|
|
||||||
if (res == NULL)
|
|
||||||
ft_putstr_fd("-NULL-", fd);
|
|
||||||
else
|
|
||||||
ft_putstr_fd(res, fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void test(char *prefix, char *str1, char *str2)
|
|
||||||
{
|
|
||||||
char *res;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
fd = STDOUT_FILENO;
|
|
||||||
ft_putstr_fd(prefix, fd);
|
|
||||||
ft_putstr_fd("str1:[", fd);
|
|
||||||
ft_putstr_fd1(str1, fd);
|
|
||||||
ft_putstr_fd("], str2:[", fd);
|
|
||||||
ft_putstr_fd1(str2, fd);
|
|
||||||
res = ft_strjoin(str1, str2);
|
|
||||||
ft_putstr_fd("], result:[", fd);
|
|
||||||
ft_putstr_fd1(res, fd);
|
|
||||||
free(res);
|
|
||||||
ft_putendl_fd("]", fd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_test1(void)
|
|
||||||
{
|
|
||||||
test("test 1: ", "Lorem", " ipsum");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_test2(void)
|
|
||||||
{
|
|
||||||
test("test 2: ", "", " ipsum");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_test3(void)
|
|
||||||
{
|
|
||||||
test("test 3: ", "Lorem", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void do_test4(void)
|
|
||||||
{
|
|
||||||
test("test 4: ", "Lorem", (char *)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
do_test1();
|
|
||||||
do_test2();
|
|
||||||
do_test3();
|
|
||||||
do_test4();
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue