From 1899b01d0a6f753d3bd21681567a1a0cef11e401 Mon Sep 17 00:00:00 2001 From: tomoron Date: Thu, 7 Aug 2025 13:41:51 +0200 Subject: [PATCH] fix makefile and tests --- Makefile | 4 ++-- test.c | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index c679dc3..d95b273 100644 --- a/Makefile +++ b/Makefile @@ -27,11 +27,11 @@ FLAGS = -felf64 all: $(NAME) test: test.c bonus - clang -z noexecstack test.c -L. -lasm_bonus -o test -g + clang -z noexecstack test.c -L. -lasm -o test -g ./test || echo -e "\033[31m tests exited with an error code" bonus: $(OBJS_DIR) $(OBJS) $(OBJS_BONUS) - ar rcs $@ $(OBJS) $(OBJS_BONUS) + ar rcs $(NAME) $(OBJS) $(OBJS_BONUS) $(NAME): $(OBJS_DIR) $(OBJS) ar rcs $@ $(OBJS) diff --git a/test.c b/test.c index 5216db5..816e258 100644 --- a/test.c +++ b/test.c @@ -6,7 +6,7 @@ /* By: tomoron +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/29 19:53:58 by tomoron #+# #+# */ -/* Updated: 2025/04/12 19:30:05 by tomoron ### ########.fr */ +/* Updated: 2025/08/07 13:40:55 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -89,6 +89,7 @@ int test_write(void) int fail = 0; TEST("writing hello and test return value", ft_write(1, "hello ", 6) == 6); + TEST("writing nothing", ft_write(1, "hello", 0) == 0); errno = 0; TEST("failed write return value", ft_write(-1, "", 0) == (size_t)-1); TEST("failed write errno test", errno == 9); @@ -111,6 +112,7 @@ int test_read(void) close(fd); fd = open("test_file.tmp", O_RDONLY); + TEST("read 0 char", ft_read(fd, buf, 0) == 0); TEST("read 1 char", ft_read(fd, buf, 1) == 1); TEST("check read char", memcmp(buf, "p", 1) == 0); TEST("read multiple char", ft_read(fd, buf, 5) == 5); @@ -249,7 +251,7 @@ int test_list_sort() int remove_if_compare(void *data, int *nb) { - return((long)data == *nb); + return((long)data != *nb); } int test_list_remove_if()