fix makefile and tests
This commit is contained in:
4
Makefile
4
Makefile
@ -27,11 +27,11 @@ FLAGS = -felf64
|
|||||||
all: $(NAME)
|
all: $(NAME)
|
||||||
|
|
||||||
test: test.c bonus
|
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"
|
./test || echo -e "\033[31m tests exited with an error code"
|
||||||
|
|
||||||
bonus: $(OBJS_DIR) $(OBJS) $(OBJS_BONUS)
|
bonus: $(OBJS_DIR) $(OBJS) $(OBJS_BONUS)
|
||||||
ar rcs $@ $(OBJS) $(OBJS_BONUS)
|
ar rcs $(NAME) $(OBJS) $(OBJS_BONUS)
|
||||||
|
|
||||||
$(NAME): $(OBJS_DIR) $(OBJS)
|
$(NAME): $(OBJS_DIR) $(OBJS)
|
||||||
ar rcs $@ $(OBJS)
|
ar rcs $@ $(OBJS)
|
||||||
|
6
test.c
6
test.c
@ -6,7 +6,7 @@
|
|||||||
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
/* By: tomoron <tomoron@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/03/29 19:53:58 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;
|
int fail = 0;
|
||||||
|
|
||||||
TEST("writing hello and test return value", ft_write(1, "hello ", 6) == 6);
|
TEST("writing hello and test return value", ft_write(1, "hello ", 6) == 6);
|
||||||
|
TEST("writing nothing", ft_write(1, "hello", 0) == 0);
|
||||||
errno = 0;
|
errno = 0;
|
||||||
TEST("failed write return value", ft_write(-1, "", 0) == (size_t)-1);
|
TEST("failed write return value", ft_write(-1, "", 0) == (size_t)-1);
|
||||||
TEST("failed write errno test", errno == 9);
|
TEST("failed write errno test", errno == 9);
|
||||||
@ -111,6 +112,7 @@ int test_read(void)
|
|||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
fd = open("test_file.tmp", O_RDONLY);
|
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("read 1 char", ft_read(fd, buf, 1) == 1);
|
||||||
TEST("check read char", memcmp(buf, "p", 1) == 0);
|
TEST("check read char", memcmp(buf, "p", 1) == 0);
|
||||||
TEST("read multiple char", ft_read(fd, buf, 5) == 5);
|
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)
|
int remove_if_compare(void *data, int *nb)
|
||||||
{
|
{
|
||||||
return((long)data == *nb);
|
return((long)data != *nb);
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_list_remove_if()
|
int test_list_remove_if()
|
||||||
|
Reference in New Issue
Block a user