diff options
| -rw-r--r-- | Makefile | 4 | ||||
| -rw-r--r-- | functions_reference/ref_ft_atoi_base.c | 6 | ||||
| -rw-r--r-- | functions_reference/ref_ft_list_size.c | 6 | ||||
| -rw-r--r-- | functions_reference/ref_ft_list_sort.c | 6 | ||||
| -rw-r--r-- | libasm_test.h | 26 | ||||
| -rw-r--r-- | main.c | 5 | ||||
| -rw-r--r-- | test/ft_atoi_base_test.c | 6 | ||||
| -rw-r--r-- | test/ft_list_push_front_test.c | 5 | ||||
| -rw-r--r-- | test/ft_list_remove_if_test.c | 5 | ||||
| -rw-r--r-- | test/ft_list_sort_test.c | 5 | ||||
| -rw-r--r-- | test/ft_read_test.c | 6 | ||||
| -rw-r--r-- | test/ft_strcmp_test.c | 6 | ||||
| -rw-r--r-- | test/ft_strcpy_test.c | 6 | ||||
| -rw-r--r-- | test/ft_strdup_test.c | 6 | ||||
| -rw-r--r-- | test/ft_strlen_test.c | 5 | ||||
| -rw-r--r-- | test/ft_write_test.c | 6 |
16 files changed, 51 insertions, 58 deletions
@@ -6,13 +6,13 @@ # By: cacharle <marvin@42.fr> +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/02/08 03:06:59 by cacharle #+# #+# # -# Updated: 2020/11/02 20:01:39 by charles ### ########.fr # +# Updated: 2020/11/07 17:19:11 by charles ### ########.fr # # # # **************************************************************************** # LIBASM_PATH = ../libasm -RM = rm -f +RM = rm -fv MAKE = make --no-print-directory PYTHON = python3 diff --git a/functions_reference/ref_ft_atoi_base.c b/functions_reference/ref_ft_atoi_base.c index 52dd92c..638b61d 100644 --- a/functions_reference/ref_ft_atoi_base.c +++ b/functions_reference/ref_ft_atoi_base.c @@ -6,15 +6,13 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:20:16 by cacharle #+# #+# */ -/* Updated: 2020/10/21 15:29:23 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:17:01 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include <ctype.h> #include "libasm_test.h" -#ifdef LIBASM_TEST_BONUS - static bool valid_base(char *base) { @@ -56,5 +54,3 @@ int ref_ft_atoi_base(char *str, char *base) } return is_negative ? -nb : nb; } - -#endif diff --git a/functions_reference/ref_ft_list_size.c b/functions_reference/ref_ft_list_size.c index a76a472..6f5e7cf 100644 --- a/functions_reference/ref_ft_list_size.c +++ b/functions_reference/ref_ft_list_size.c @@ -6,14 +6,12 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:20:11 by cacharle #+# #+# */ -/* Updated: 2020/10/21 15:28:41 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:17:28 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "libasm_test.h" -#ifdef LIBASM_TEST_BONUS - int ref_ft_list_size(t_list *begin_list) { int counter; @@ -26,5 +24,3 @@ int ref_ft_list_size(t_list *begin_list) } return counter; } - -#endif diff --git a/functions_reference/ref_ft_list_sort.c b/functions_reference/ref_ft_list_sort.c index 08914b3..6f40513 100644 --- a/functions_reference/ref_ft_list_sort.c +++ b/functions_reference/ref_ft_list_sort.c @@ -6,14 +6,12 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 02:49:28 by cacharle #+# #+# */ -/* Updated: 2020/10/21 15:28:30 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:17:13 by charles ### ########.fr */ /* */ /* ************************************************************************** */ #include "libasm_test.h" -#ifdef LIBASM_TEST_BONUS - static t_list* merge_sorted_list(t_list* l1, t_list* l2, int (*cmp)(void *, void*)) { @@ -59,5 +57,3 @@ void ref_ft_list_sort(t_list **begin_list, int (*cmp)(void *, void*)) ref_ft_list_sort(&middle, cmp); *begin_list = merge_sorted_list(*begin_list, middle, cmp); } - -#endif diff --git a/libasm_test.h b/libasm_test.h index 82b675a..afbc959 100644 --- a/libasm_test.h +++ b/libasm_test.h @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:19 by cacharle #+# #+# */ -/* Updated: 2020/10/21 15:37:33 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:13:23 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -109,17 +109,19 @@ void ref_ft_list_remove_if(t_list **begin_list, void *data_ref, */ extern int pid; extern bool signaled; - -# define TEST_SEGFAULT(x) do { \ - if ((pid = fork()) < 0) \ - exit(EXIT_FAILURE); \ - if (pid == 0) { \ - do { x; } while(0); \ - exit(EXIT_SUCCESS); \ - } else { \ - wait(&pid); \ - signaled = WIFSIGNALED(pid); \ - } \ +extern bool signaled_suite; + +# define TEST_SEGFAULT(x) do { \ + if ((pid = fork()) < 0) \ + exit(EXIT_FAILURE); \ + if (pid == 0) { \ + do { x; } while(0); \ + exit(EXIT_SUCCESS); \ + } else { \ + wait(&pid); \ + signaled = WIFSIGNALED(pid); \ + if (signaled) signaled_suite = true; \ + } \ } while(0) extern char *test_name; @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:06:45 by cacharle #+# #+# */ -/* Updated: 2020/10/21 15:37:28 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:13:43 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ int pid; bool signaled; +bool signaled_suite; char *test_name; int main(void) @@ -21,10 +22,8 @@ int main(void) ft_strlen_test(); ft_strcpy_test(); ft_strcmp_test(); -#ifndef __linux__ ft_write_test(); ft_read_test(); -#endif ft_strdup_test(); #ifdef LIBASM_TEST_BONUS diff --git a/test/ft_atoi_base_test.c b/test/ft_atoi_base_test.c index 1c4e1ef..d7fb430 100644 --- a/test/ft_atoi_base_test.c +++ b/test/ft_atoi_base_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:27 by cacharle #+# #+# */ -/* Updated: 2020/10/21 16:01:31 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:12:55 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -144,8 +144,8 @@ void ft_atoi_base_compare(void) void ft_atoi_base_test(void) { test_name = "ft_atoi_base.s"; - + signaled_suite = false; ft_atoi_base_segfault(); - if (!signaled) + if (!signaled_suite) ft_atoi_base_compare(); } diff --git a/test/ft_list_push_front_test.c b/test/ft_list_push_front_test.c index 55d0b4f..d858486 100644 --- a/test/ft_list_push_front_test.c +++ b/test/ft_list_push_front_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:08:24 by cacharle #+# #+# */ -/* Updated: 2020/04/13 14:57:14 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:15:43 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,7 +70,8 @@ void ft_list_push_front_compare(void) void ft_list_push_front_test(void) { test_name = "ft_list_push_front.s"; + signaled_suite = false; ft_list_push_front_segfault(); - if (!signaled) + if (!signaled_suite) ft_list_push_front_compare(); } diff --git a/test/ft_list_remove_if_test.c b/test/ft_list_remove_if_test.c index bca0a19..45bf260 100644 --- a/test/ft_list_remove_if_test.c +++ b/test/ft_list_remove_if_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:08:42 by cacharle #+# #+# */ -/* Updated: 2020/04/13 14:59:22 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:15:34 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -103,7 +103,8 @@ void ft_list_remove_if_compare(void) void ft_list_remove_if_test(void) { test_name = "ft_list_remove_if.s"; + signaled_suite = false; ft_list_remove_if_segfault(); - if (!signaled) + if (!signaled_suite) ft_list_remove_if_compare(); } diff --git a/test/ft_list_sort_test.c b/test/ft_list_sort_test.c index 82e60cc..5b2d236 100644 --- a/test/ft_list_sort_test.c +++ b/test/ft_list_sort_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:08:15 by cacharle #+# #+# */ -/* Updated: 2020/04/13 15:00:02 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:15:22 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,7 +71,8 @@ void ft_list_sort_compare(void) void ft_list_sort_test(void) { test_name = "ft_list_sort.s"; + signaled_suite = false; ft_list_sort_segfault(); - if (!signaled) + if (!signaled_suite) ft_list_sort_compare(); } diff --git a/test/ft_read_test.c b/test/ft_read_test.c index 2379a3f..cfe12fd 100644 --- a/test/ft_read_test.c +++ b/test/ft_read_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:44 by cacharle #+# #+# */ -/* Updated: 2020/10/06 15:05:51 by cacharle ### ########.fr */ +/* Updated: 2020/11/07 17:15:02 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -107,8 +107,8 @@ tortor, sit amet consequat amet."); void ft_read_test(void) { test_name = "ft_read.s"; - + signaled_suite = false; ft_read_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_read_test_compare(); } diff --git a/test/ft_strcmp_test.c b/test/ft_strcmp_test.c index b9b3520..cd8059f 100644 --- a/test/ft_strcmp_test.c +++ b/test/ft_strcmp_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:08:03 by cacharle #+# #+# */ -/* Updated: 2020/04/13 14:44:18 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:14:40 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -118,8 +118,8 @@ tortor, sit amet consequat amet."); void ft_strcmp_test(void) { test_name = "ft_strcmp.s"; - + signaled_suite = false; ft_strcmp_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_strcmp_test_compare(); } diff --git a/test/ft_strcpy_test.c b/test/ft_strcpy_test.c index 6b038bb..e98313a 100644 --- a/test/ft_strcpy_test.c +++ b/test/ft_strcpy_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:58 by cacharle #+# #+# */ -/* Updated: 2020/04/13 15:02:13 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:14:26 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -70,8 +70,8 @@ tortor, sit amet consequat amet."); void ft_strcpy_test(void) { test_name = "ft_strcpy.s"; - + signaled_suite = false; ft_strcpy_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_strcpy_test_compare(); } diff --git a/test/ft_strdup_test.c b/test/ft_strdup_test.c index 19ffe2c..847ef97 100644 --- a/test/ft_strdup_test.c +++ b/test/ft_strdup_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:08:06 by cacharle #+# #+# */ -/* Updated: 2020/05/04 15:21:49 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:14:04 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,8 +71,8 @@ tortor, sit amet consequat amet."); void ft_strdup_test(void) { test_name = "ft_strdup.s"; - + signaled_suite = false; ft_strdup_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_strdup_test_compare(); } diff --git a/test/ft_strlen_test.c b/test/ft_strlen_test.c index 06796b4..46648aa 100644 --- a/test/ft_strlen_test.c +++ b/test/ft_strlen_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:53 by cacharle #+# #+# */ -/* Updated: 2020/04/13 14:41:19 by charles ### ########.fr */ +/* Updated: 2020/11/07 17:14:15 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -62,7 +62,8 @@ tortor, sit amet consequat amet."); void ft_strlen_test(void) { test_name = "ft_strlen.s"; + signaled_suite = false; ft_strlen_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_strlen_test_compare(); } diff --git a/test/ft_write_test.c b/test/ft_write_test.c index 6ae96a6..6a36fd4 100644 --- a/test/ft_write_test.c +++ b/test/ft_write_test.c @@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/08 03:07:48 by cacharle #+# #+# */ -/* Updated: 2020/10/06 14:40:00 by cacharle ### ########.fr */ +/* Updated: 2020/11/07 17:15:12 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -104,8 +104,8 @@ tortor, sit amet consequat amet."); void ft_write_test(void) { test_name = "ft_write.s"; - + signaled_suite = false; ft_write_test_segfault(); - if (!signaled) + if (!signaled_suite) ft_write_test_compare(); } |
