├── .gitignore ├── README.md ├── ft_ansi.h ├── gnl_test.c ├── makefile ├── moulitest_files ├── Makefile ├── config.ini ├── config.ini.template ├── get_next_line_tests │ ├── Makefile │ ├── Makefile_cfg.mk │ ├── main.c │ ├── project.h │ ├── tests │ │ ├── 01_test_simple.spec.c │ │ ├── 02_test_eof_with_close.spec.c │ │ ├── 03_test_medium_string.spec.c │ │ ├── 04_test_return_values.spec.c │ │ ├── 05_test_error_handling.spec.c │ │ ├── 06_test_line_of_08.spec.c │ │ ├── 07_test_two_lines_of_08.spec.c │ │ ├── 08_test_few_lines_of_08.spec.c │ │ ├── 09_test_line_of_16.spec.c │ │ ├── 10_test_two_lines_of_16.spec.c │ │ ├── 11_test_few_lines_of_16.spec.c │ │ ├── 12_test_line_of_4.spec.c │ │ ├── 13_test_two_lines_of_4.spec.c │ │ ├── 14_test_few_lines_of_4.spec.c │ │ ├── 15_test_line_without_nl.spec.c │ │ ├── 16_test_line_of_8_without_nl.spec.c │ │ ├── 17_test_line_of_16_without_nl.spec.c │ │ ├── 30_bonus_multiple_fd.spec.c │ │ ├── 40_hard_test_medium_string.spec.c │ │ ├── 41_hard_test_large_file.spec.c │ │ └── 42_hard_test_one_big_fat_line.spec.c │ └── utils.c └── testframework │ ├── fake_rendu │ ├── ft_ls │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ └── main.c │ ├── ft_printf │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ └── ft_printf.c │ ├── ft_printf_with_libft │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ ├── ft_printf.c │ │ └── libft │ │ │ ├── Makefile │ │ │ ├── Makefile_cfg.mk │ │ │ ├── ft_strcat.c │ │ │ └── includes │ │ │ └── libft.h │ ├── get_next_line │ │ ├── get_next_line.c │ │ └── get_next_line.h │ ├── get_next_line_with_libft │ │ ├── get_next_line.c │ │ ├── get_next_line.h │ │ └── libft │ │ │ ├── Makefile │ │ │ ├── Makefile_cfg.mk │ │ │ ├── ft_strcat.c │ │ │ └── includes │ │ │ └── libft.h │ ├── libft │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ ├── ft_atoi.c │ │ ├── ft_bzero.c │ │ ├── ft_isalnum.c │ │ ├── ft_isalpha.c │ │ ├── ft_isascii.c │ │ ├── ft_isblank.c │ │ ├── ft_isdigit.c │ │ ├── ft_islower.c │ │ ├── ft_isprint.c │ │ ├── ft_isspace.c │ │ ├── ft_isupper.c │ │ ├── ft_itoa.c │ │ ├── ft_lstadd.c │ │ ├── ft_lstdel.c │ │ ├── ft_lstdelone.c │ │ ├── ft_lstiter.c │ │ ├── ft_lstmap.c │ │ ├── ft_lstnew.c │ │ ├── ft_memalloc.c │ │ ├── ft_memccpy.c │ │ ├── ft_memchr.c │ │ ├── ft_memcmp.c │ │ ├── ft_memcpy.c │ │ ├── ft_memdel.c │ │ ├── ft_memmove.c │ │ ├── ft_memset.c │ │ ├── ft_putchar.c │ │ ├── ft_putchar_fd.c │ │ ├── ft_putendl.c │ │ ├── ft_putendl_fd.c │ │ ├── ft_putnbr.c │ │ ├── ft_putnbr_fd.c │ │ ├── ft_putnendl.c │ │ ├── ft_putnstr.c │ │ ├── ft_putstr.c │ │ ├── ft_putstr_fd.c │ │ ├── ft_strcat.c │ │ ├── ft_strchr.c │ │ ├── ft_strclr.c │ │ ├── ft_strcmp.c │ │ ├── ft_strcpy.c │ │ ├── ft_strdel.c │ │ ├── ft_strdup.c │ │ ├── ft_strequ.c │ │ ├── ft_striter.c │ │ ├── ft_striteri.c │ │ ├── ft_strjoin.c │ │ ├── ft_strlcat.c │ │ ├── ft_strlen.c │ │ ├── ft_strlowcase.c │ │ ├── ft_strmap.c │ │ ├── ft_strmapi.c │ │ ├── ft_strncat.c │ │ ├── ft_strncmp.c │ │ ├── ft_strncpy.c │ │ ├── ft_strnequ.c │ │ ├── ft_strnew.c │ │ ├── ft_strnstr.c │ │ ├── ft_strrchr.c │ │ ├── ft_strrev.c │ │ ├── ft_strsplit.c │ │ ├── ft_strstr.c │ │ ├── ft_strsub.c │ │ ├── ft_strtrim.c │ │ ├── ft_strupcase.c │ │ ├── ft_tolower.c │ │ ├── ft_toupper.c │ │ └── libft.h │ ├── libft_part1 │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ ├── ft_atoi.c │ │ ├── ft_bzero.c │ │ ├── ft_isalnum.c │ │ ├── ft_isalpha.c │ │ ├── ft_isascii.c │ │ ├── ft_isblank.c │ │ ├── ft_isdigit.c │ │ ├── ft_islower.c │ │ ├── ft_isprint.c │ │ ├── ft_isspace.c │ │ ├── ft_isupper.c │ │ ├── ft_itoa.c │ │ ├── ft_lstadd.c │ │ ├── ft_lstdel.c │ │ ├── ft_lstdelone.c │ │ ├── ft_lstiter.c │ │ ├── ft_lstmap.c │ │ ├── ft_lstnew.c │ │ ├── ft_memalloc.c │ │ ├── ft_memccpy.c │ │ ├── ft_memchr.c │ │ ├── ft_memcmp.c │ │ ├── ft_memcpy.c │ │ ├── ft_memdel.c │ │ ├── ft_memmove.c │ │ ├── ft_memset.c │ │ ├── ft_putchar.c │ │ ├── ft_putchar_fd.c │ │ ├── ft_putendl.c │ │ ├── ft_putendl_fd.c │ │ ├── ft_putnbr.c │ │ ├── ft_putnbr_fd.c │ │ ├── ft_putnendl.c │ │ ├── ft_putnstr.c │ │ ├── ft_putstr.c │ │ ├── ft_putstr_fd.c │ │ ├── ft_strcat.c │ │ ├── ft_strchr.c │ │ ├── ft_strclr.c │ │ ├── ft_strcmp.c │ │ ├── ft_strcpy.c │ │ ├── ft_strdel.c │ │ ├── ft_strdup.c │ │ ├── ft_strequ.c │ │ ├── ft_striter.c │ │ ├── ft_striteri.c │ │ ├── ft_strjoin.c │ │ ├── ft_strlcat.c │ │ ├── ft_strlen.c │ │ ├── ft_strlowcase.c │ │ ├── ft_strmap.c │ │ ├── ft_strmapi.c │ │ ├── ft_strncat.c │ │ ├── ft_strncmp.c │ │ ├── ft_strncpy.c │ │ ├── ft_strnequ.c │ │ ├── ft_strnew.c │ │ ├── ft_strnstr.c │ │ ├── ft_strrchr.c │ │ ├── ft_strrev.c │ │ ├── ft_strsplit.c │ │ ├── ft_strstr.c │ │ ├── ft_strsub.c │ │ ├── ft_strtrim.c │ │ ├── ft_strupcase.c │ │ ├── ft_tolower.c │ │ ├── ft_toupper.c │ │ └── libft.h │ ├── libft_part2 │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ ├── ft_atoi.c │ │ ├── ft_bzero.c │ │ ├── ft_isalnum.c │ │ ├── ft_isalpha.c │ │ ├── ft_isascii.c │ │ ├── ft_isblank.c │ │ ├── ft_isdigit.c │ │ ├── ft_islower.c │ │ ├── ft_isprint.c │ │ ├── ft_isspace.c │ │ ├── ft_isupper.c │ │ ├── ft_itoa.c │ │ ├── ft_lstadd.c │ │ ├── ft_lstdel.c │ │ ├── ft_lstdelone.c │ │ ├── ft_lstiter.c │ │ ├── ft_lstmap.c │ │ ├── ft_lstnew.c │ │ ├── ft_memalloc.c │ │ ├── ft_memccpy.c │ │ ├── ft_memchr.c │ │ ├── ft_memcmp.c │ │ ├── ft_memcpy.c │ │ ├── ft_memdel.c │ │ ├── ft_memmove.c │ │ ├── ft_memset.c │ │ ├── ft_putchar.c │ │ ├── ft_putchar_fd.c │ │ ├── ft_putendl.c │ │ ├── ft_putendl_fd.c │ │ ├── ft_putnbr.c │ │ ├── ft_putnbr_fd.c │ │ ├── ft_putnendl.c │ │ ├── ft_putnstr.c │ │ ├── ft_putstr.c │ │ ├── ft_putstr_fd.c │ │ ├── ft_strcat.c │ │ ├── ft_strchr.c │ │ ├── ft_strclr.c │ │ ├── ft_strcmp.c │ │ ├── ft_strcpy.c │ │ ├── ft_strdel.c │ │ ├── ft_strdup.c │ │ ├── ft_strequ.c │ │ ├── ft_striter.c │ │ ├── ft_striteri.c │ │ ├── ft_strjoin.c │ │ ├── ft_strlcat.c │ │ ├── ft_strlen.c │ │ ├── ft_strlowcase.c │ │ ├── ft_strmap.c │ │ ├── ft_strmapi.c │ │ ├── ft_strncat.c │ │ ├── ft_strncmp.c │ │ ├── ft_strncpy.c │ │ ├── ft_strnequ.c │ │ ├── ft_strnew.c │ │ ├── ft_strnstr.c │ │ ├── ft_strrchr.c │ │ ├── ft_strrev.c │ │ ├── ft_strsplit.c │ │ ├── ft_strstr.c │ │ ├── ft_strsub.c │ │ ├── ft_strtrim.c │ │ ├── ft_strupcase.c │ │ ├── ft_tolower.c │ │ ├── ft_toupper.c │ │ └── libft.h │ ├── libft_to_be_symliked │ │ ├── Makefile │ │ ├── Makefile_cfg.mk │ │ ├── ft_strcat.c │ │ └── includes │ │ │ └── libft.h │ └── makefile_templates │ │ └── Makefile │ ├── v2 │ ├── testframework.c │ ├── testframework.h │ └── utils.c │ ├── v3 │ ├── Makefile │ ├── includes │ │ ├── capture.h │ │ ├── color.h │ │ ├── fw.h │ │ ├── mt.h │ │ ├── mt_lst.h │ │ ├── mt_xstdio.h │ │ ├── suite.h │ │ └── test.h │ └── srcs │ │ ├── capture │ │ └── capture.c │ │ ├── mt │ │ ├── mt_count_failed_suites.c │ │ ├── mt_count_failed_tests.c │ │ ├── mt_count_tests.c │ │ ├── mt_create.c │ │ ├── mt_del.c │ │ └── mt_exec.c │ │ ├── mt_lst │ │ ├── mt_lst__link.c │ │ ├── mt_lst_count.c │ │ ├── mt_lst_create_elem.c │ │ ├── mt_lst_del.c │ │ ├── mt_lst_del_elem.c │ │ ├── mt_lst_find.c │ │ ├── mt_lst_find_by_value.c │ │ ├── mt_lst_get.c │ │ ├── mt_lst_init.c │ │ ├── mt_lst_iter.c │ │ ├── mt_lst_len.c │ │ ├── mt_lst_map.c │ │ ├── mt_lst_pop.c │ │ ├── mt_lst_push.c │ │ ├── mt_lst_reduce.c │ │ ├── mt_lst_reducei.c │ │ └── mt_lstelem_del.c │ │ ├── mt_xstdio │ │ └── mt_xstdio_isempty.c │ │ ├── suite │ │ ├── suite_count_failed_tests.c │ │ ├── suite_count_tests.c │ │ ├── suite_create.c │ │ ├── suite_del.c │ │ ├── suite_exec.c │ │ └── suite_filter_failed.c │ │ ├── test │ │ ├── test_assert.c │ │ ├── test_assert_prep.c │ │ ├── test_create.c │ │ ├── test_del.c │ │ ├── test_exec.c │ │ ├── test_filter_failed.c │ │ ├── test_get_failure_type.c │ │ └── test_print.c │ │ └── utils │ │ └── utils.h │ └── v3_templates │ └── Makefile_template.mk ├── test_basic.txt ├── test_basic_dino.txt ├── test_null_cases.txt ├── timmy_test_a.txt ├── timmy_test_b.txt └── timmy_test_interleave.txt /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | mtest_tmp/* 3 | *.a 4 | *_cpy* 5 | get_next_line_tests 6 | *.dSYM 7 | sandbox/* 8 | gnl_tester 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GNL TESTING TOOLS 2 | ## Documentation 3 | * run 'make' with no arguments to see usage and setup. 4 | * Edit makefile accordingly. 5 | * ??? 6 | * Nothing, you get nothing. -------------------------------------------------------------------------------- /ft_ansi.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_ansi.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: ppatil +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2016/10/10 16:26:45 by ppatil #+# #+# */ 9 | /* Updated: 2016/10/10 16:26:45 by ppatil ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef FT_ANSI_H 14 | # define FT_ANSI_H 15 | 16 | # define ANSI_RESET "\033[0m" 17 | 18 | # define ANSI_F_RED "\033[31m" 19 | # define ANSI_F_BRED "\033[31;1m" 20 | # define ANSI_F_GREEN "\033[32m" 21 | # define ANSI_F_BGREEN "\033[32;1m" 22 | # define ANSI_F_YELLOW "\033[33m" 23 | # define ANSI_F_BYELLOW "\033[33;1m" 24 | # define ANSI_F_BLUE "\033[34m" 25 | # define ANSI_F_BBLUE "\033[34;1m" 26 | # define ANSI_F_MAGENTA "\033[35m" 27 | # define ANSI_F_BMAGENTA "\033[35;1m" 28 | # define ANSI_F_CYAN "\033[36m" 29 | # define ANSI_F_BCYAN "\033[36;1m" 30 | # define ANSI_F_BLACK "\033[30m" 31 | # define ANSI_F_BBLACK "\033[30;1m" 32 | # define ANSI_F_WHITE "\033[37m" 33 | # define ANSI_F_BWHITE "\033[37;1m" 34 | 35 | # define ANSI_B_RED "\033[41m" 36 | # define ANSI_B_BRED "\033[41;1m" 37 | # define ANSI_B_GREEN "\033[42m" 38 | # define ANSI_B_BGREEN "\033[42;1m" 39 | # define ANSI_B_YELLOW "\033[43m" 40 | # define ANSI_B_BYELLOW "\033[43;1m" 41 | # define ANSI_B_BLUE "\033[44m" 42 | # define ANSI_B_BBLUE "\033[44;1m" 43 | # define ANSI_B_MAGENTA "\033[45m" 44 | # define ANSI_B_BMAGENTA "\033[45;1m" 45 | # define ANSI_B_CYAN "\033[46m" 46 | # define ANSI_B_BCYAN "\033[46;1m" 47 | # define ANSI_B_BLACK "\033[40m" 48 | # define ANSI_B_BBLACK "\033[40;1m" 49 | # define ANSI_B_WHITE "\033[47m" 50 | # define ANSI_B_BWHITE "\033[47;1m" 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /gnl_test.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* test.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: ppatil +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2016/10/05 22:39:37 by ppatil #+# #+# */ 9 | /* Updated: 2019/10/27 22:39:51 by cacharle ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include GNL_HEADER_CPY 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include "ft_ansi.h" 19 | 20 | void test_basic(void) 21 | { 22 | size_t line_count; 23 | char *line; 24 | int fd; 25 | 26 | line_count = 0; 27 | line = NULL; 28 | printf("Opening file... "); 29 | fd = open("test_basic_dino.txt", O_RDONLY); 30 | if (fd < 0) 31 | { 32 | printf(ANSI_F_RED "Error opening %s.\n" ANSI_RESET, "test_basic_dino.txt"); 33 | return ; 34 | } 35 | printf("Done.\n"); 36 | printf(ANSI_F_YELLOW "Reading Lines...\n" ANSI_RESET); 37 | while (get_next_line(fd, &line)) 38 | { 39 | line_count++; 40 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 41 | free(line); 42 | } 43 | if (line_count != 12) 44 | printf(ANSI_F_RED "ERROR: test_basic(...) failed.\n" ANSI_RESET); 45 | else 46 | printf(ANSI_F_GREEN "Done.\n" ANSI_RESET); 47 | printf(ANSI_F_YELLOW "[ Lines Expected: 12, Lines Read: %zu ]\n" ANSI_RESET, line_count); 48 | fd = close(fd); 49 | if (fd < 0) 50 | { 51 | printf(ANSI_F_BRED "Fatal Error: Could not close open file.\n" ANSI_RESET); 52 | exit(EXIT_FAILURE); 53 | } 54 | } 55 | 56 | void test_poems(void) 57 | { 58 | size_t line_count; 59 | char *line; 60 | int fd_i; 61 | int fd_a; 62 | int fd_b; 63 | 64 | line = NULL; 65 | line_count = 0; 66 | fd_i = open("timmy_test_interleave.txt", O_RDONLY); 67 | fd_a = open("timmy_test_a.txt", O_RDONLY); 68 | fd_b = open("timmy_test_b.txt", O_RDONLY); 69 | if (fd_i < 0 || fd_a < 0 || fd_b < 0) 70 | { 71 | printf(ANSI_F_RED "Error opening files.\n" ANSI_RESET); 72 | return ; 73 | } 74 | printf(ANSI_F_YELLOW "Starting interleaved file read test...\n\n" ANSI_RESET); 75 | line_count = 0; 76 | while (line_count < 4) 77 | { 78 | line_count++; 79 | get_next_line(fd_i, &line); 80 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 81 | free(line); 82 | } 83 | while (get_next_line(fd_a, &line)) 84 | { 85 | line_count++; 86 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 87 | free(line); 88 | } 89 | line_count++; 90 | get_next_line(fd_i, &line); 91 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 92 | free(line); 93 | while (get_next_line(fd_b, &line)) 94 | { 95 | line_count++; 96 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 97 | free(line); 98 | } 99 | while (get_next_line(fd_i, &line)) 100 | { 101 | line_count++; 102 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 103 | free(line); 104 | } 105 | if (line_count != 45) 106 | printf(ANSI_F_RED "\nERROR: Interleaved files test failed! [ test_poems(...); ]\n" ANSI_RESET); 107 | else 108 | printf(ANSI_F_GREEN "\nDone.\n" ANSI_RESET); 109 | printf(ANSI_F_YELLOW "[ Lines Expected: 45, Lines Read: %zu ]\n" ANSI_RESET, line_count); 110 | fd_i = close(fd_i); 111 | fd_a = close(fd_a); 112 | fd_b = close(fd_b); 113 | if (fd_i < 0 || fd_a < 0 || fd_b < 0) 114 | { 115 | printf(ANSI_F_BRED "Fatal Error: Could not close open files!\n" ANSI_RESET); 116 | exit(EXIT_FAILURE); 117 | } 118 | } 119 | 120 | void test_null_cases(void) 121 | { 122 | char *line; 123 | int temp_fd; 124 | size_t line_count; 125 | 126 | line = NULL; 127 | line_count = 0; 128 | temp_fd = open("test_null_cases.txt", O_RDONLY); 129 | printf("Testing failure cases...\n"); 130 | printf("Passing NULL pointer to line parameter of get_next_line(...)\n"); 131 | get_next_line(temp_fd, NULL); 132 | printf("Passing invalid file descriptor (fd = -1)...\n"); 133 | get_next_line(-1, &line); 134 | printf("Passing invalid file descriptor and line pointer...\n"); 135 | printf(ANSI_F_GREEN "Done.\n" ANSI_RESET "As a prize here is some text:\n\n"); 136 | if (temp_fd < 0) 137 | { 138 | printf(ANSI_F_RED "Nevermind. The file couln't be opened so you get nothing :C\n" ANSI_RESET); 139 | return ; 140 | } 141 | while (get_next_line(temp_fd, &line)) 142 | { 143 | line_count++; 144 | printf(ANSI_F_CYAN "%zu" ANSI_RESET "\t|%s" ANSI_F_CYAN "$\n" ANSI_RESET, line_count, line); 145 | free(line); 146 | } 147 | if (line_count == 16) 148 | printf("\nDid you enjoy your prize? Yes? Okay let's move on.\n"); 149 | else 150 | printf(ANSI_F_RED "Hey! Your prize isn't working properly! What's going on?\n" ANSI_RESET); 151 | printf(ANSI_F_YELLOW "[ Prize lines read: %zu, Prize lines expected: 16 ]\n" ANSI_RESET, line_count); 152 | temp_fd = close(temp_fd); 153 | if (temp_fd < 0) 154 | { 155 | printf("Fatal Error: Could not close open file!\n"); 156 | exit(EXIT_FAILURE); 157 | } 158 | } 159 | 160 | int main(void) 161 | { 162 | printf(ANSI_F_BCYAN "[ Testing get_next_line(...): ]\n"); 163 | printf("[ Current Buffer Size: %.4d ]\n\n" ANSI_RESET, BUFFER_SIZE); 164 | test_basic(); 165 | test_poems(); 166 | test_null_cases(); 167 | printf(ANSI_F_BCYAN "[ Test complete. ]\n" ANSI_RESET); 168 | return (0); 169 | } 170 | -------------------------------------------------------------------------------- /makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: ppatil +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2016/10/05 23:33:26 by ppatil #+# #+# # 9 | # Updated: 2019/11/03 21:36:27 by cacharle ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Hey this is what you need to edit! 14 | # Use absolute path to get_next_line root project folder. 15 | GNL_SOURCE_DIR = ../get_next_line 16 | # Try not to edit past this line. (Unless something goes very wrong.) 17 | 18 | NAME = gnl_tester 19 | CC = clang 20 | C_FLAGS = -Wall -Werror -Wextra 21 | TEST_BUFFER_SIZE = 20 22 | C_FILES = gnl_test.c 23 | # This is required in the assignment if using libft. 24 | MOULITEST_DIR = ./moulitest_files 25 | 26 | INCLUDE_DIRS = . $(GNL_SOURCE_DIR) 27 | 28 | I_ARGS = $(patsubst %, -I%, $(INCLUDE_DIRS)) 29 | HEADER_CPY = gnl_header_cpy.h 30 | SRC_CPY = gnl_src_cpy.c 31 | 32 | default : 33 | @echo "" 34 | @echo "================== GET NEXT LINE TESTS ==================" 35 | @echo "[ WARNING: ]" 36 | @echo "[ - This test will copy and modify your get_next_line.h ]" 37 | @echo "[ file! Why? Because I need to recompile with several ]" 38 | @echo "[ BUFFER_SIZE amounts. So it removes the #define line ]" 39 | @echo "[ in your source's copy. ]" 40 | @echo "[ - DON'T PANIC! Your original file is still in tact! ]" 41 | @echo "[ Just watch out for any problems in the copy in this ]" 42 | @echo "[ test directory. ]" 43 | @echo "[ - Please report any bugs because I'm very lazy :P ]" 44 | @echo "[ PREREQUISITES: ]" 45 | @echo "[ - Edit this makefile to point GNL_SOURCE_DIR to your ]" 46 | @echo "[ project directory. ]" 47 | @echo "[ USAGE: ]" 48 | @echo "[ - make buff_1 : Runs test with BUFFER_SIZE set to 1 ]" 49 | @echo "[ - make buff_16 : Runs test with BUFFER_SIZE set to 16 ]" 50 | @echo "[ - make buff_32 : Runs test with BUFFER_SIZE set to 32 ]" 51 | @echo "[ - make buff_42 : You see the pattern here... ]" 52 | @echo "[ - make buff_64 : Boop ]" 53 | @echo "[ - make buff_128 : Beep ]" 54 | @echo "[ - make buff_2048 : Waffle ]" 55 | @echo "[ - make buff_4096 : Tea ]" 56 | @echo "[ - make buff_EXTREME : Whoa take it easy buddy... ]" 57 | @echo "[ - make mtest_N : Runs the get_next_line Moulitest ]" 58 | @echo "[ where N is an above buffer size. ]" 59 | @echo "[ NOTES: ]" 60 | @echo "[ - If you get a linker error for libft make sure it is ]" 61 | @echo "[ in the libft/ directory in your project root. The ]" 62 | @echo "[ assignment specifies it. ]" 63 | @echo "=========================================================" 64 | @echo "" 65 | 66 | mtest_all: 67 | @for i in 1 16 32 64 128 2048 4096 EXTREME; do make mtest_$$i; done 68 | 69 | mtest_1 : 70 | $(MAKE) mtest TEST_BUFFER_SIZE=1 71 | 72 | mtest_16 : 73 | $(MAKE) mtest TEST_BUFFER_SIZE=16 74 | 75 | mtest_32 : 76 | $(MAKE) mtest TEST_BUFFER_SIZE=32 77 | 78 | mtest_42 : 79 | $(MAKE) mtest TEST_BUFFER_SIZE=42 80 | 81 | mtest_64 : 82 | $(MAKE) mtest TEST_BUFFER_SIZE=64 83 | 84 | mtest_128 : 85 | $(MAKE) mtest TEST_BUFFER_SIZE=128 86 | 87 | mtest_2048 : 88 | $(MAKE) mtest TEST_BUFFER_SIZE=2048 89 | 90 | mtest_4096 : 91 | $(MAKE) mtest TEST_BUFFER_SIZE=4096 92 | 93 | mtest_EXTREME : 94 | $(MAKE) mtest TEST_BUFFER_SIZE=2 95 | 96 | mtest : moulitest_config 97 | $(MAKE) -C $(MOULITEST_DIR) gnl PASSED_DEFINES="-DBUFFER_SIZE=\"$(TEST_BUFFER_SIZE)\"" 98 | 99 | moulitest_config : $(GNL_SOURCE_DIR)/get_next_line.c $(GNL_SOURCE_DIR)/get_next_line.h $(GNL_SOURCE_DIR)/get_next_line_utils.c 100 | -mkdir mtest_tmp 101 | @cp $(GNL_SOURCE_DIR)/get_next_line.h ./mtest_tmp/ 102 | @sed -i.bkp -e 's/.*define BUFFER_SIZE.*//g' ./mtest_tmp/get_next_line.h 103 | @cp $(GNL_SOURCE_DIR)/get_next_line.c ./mtest_tmp/ 104 | @sed -i.bkp -e 's/.*define BUFFER_SIZE.*//g' ./mtest_tmp/get_next_line.c 105 | @cp $(GNL_SOURCE_DIR)/get_next_line_utils.c ./mtest_tmp/ 106 | @sed -i.bkp -e 's/.*define BUFFER_SIZE.*//g' ./mtest_tmp/get_next_line_utils.c 107 | @echo "GET_NEXT_LINE_PATH = $(shell pwd)/mtest_tmp" > $(MOULITEST_DIR)/config.ini 108 | 109 | buff_all: 110 | @for i in 1 16 32 64 128 2048 4096 EXTREME; do make buff_$$i; done 111 | 112 | buff_1 : 113 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=1 114 | ./$(NAME) 115 | 116 | buff_16 : 117 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=16 118 | ./$(NAME) 119 | 120 | buff_32 : 121 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=32 122 | ./$(NAME) 123 | 124 | buff_42 : 125 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=42 126 | ./$(NAME) 127 | 128 | buff_64 : 129 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=64 130 | ./$(NAME) 131 | 132 | buff_128 : 133 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=128 134 | ./$(NAME) 135 | 136 | buff_2048 : 137 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=2048 138 | ./$(NAME) 139 | 140 | buff_4096 : 141 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=4096 142 | ./$(NAME) 143 | 144 | buff_EXTREME : 145 | $(MAKE) $(NAME) TEST_BUFFER_SIZE=2 146 | ./$(NAME) 147 | 148 | $(NAME) : $(C_FILES) $(HEADER_CPY) $(SRC_CPY) 149 | @$(CC) $(C_FILES) $(GNL_SOURCE_DIR)/get_next_line_utils.c $(SRC_CPY) $(C_FLAGS) \ 150 | -DBUFFER_SIZE=$(TEST_BUFFER_SIZE) \ 151 | -DGNL_HEADER_CPY=\"$(HEADER_CPY)\" \ 152 | -DGNL_SRC_CPY=\"$(SRC_CPY)\" \ 153 | $(I_ARGS) -o $(NAME) 154 | 155 | $(HEADER_CPY) : $(GNL_SOURCE_DIR)/get_next_line.h 156 | @$(shell cp $(GNL_SOURCE_DIR)/get_next_line.h ./$(HEADER_CPY)) 157 | @$(shell sed -i.bkp -e 's/.*define BUFFER_SIZE.*//g' ./$(HEADER_CPY)) 158 | 159 | $(SRC_CPY) : $(GNL_SOURCE_DIR)/get_next_line.c 160 | @$(shell cp $(GNL_SOURCE_DIR)/get_next_line.c ./$(SRC_CPY)) 161 | @$(shell sed -i.bkp -e 's/.*include \"get_next_line.h\".*/#include GNL_HEADER_CPY/g' ./$(SRC_CPY)) 162 | 163 | clean : 164 | @rm -f $(NAME) 165 | @rm -f *.bkp 166 | @rm -f $(HEADER_CPY) $(SRC_CPY) 167 | -$(MAKE) -C $(MOULITEST_DIR)/get_next_line_tests fclean 168 | @rm -rf mtest_tmp 169 | 170 | .PHONY : clean re buff_1 buff_16 buff_32 buff_42 buff_64 \ 171 | buff_128 buff_2048 buff_4096 buff_EXTREME \ 172 | $(NAME) $(SRC_CPY) $(HEADER_CPY) mtest 173 | -------------------------------------------------------------------------------- /moulitest_files/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2014/12/08 14:30:51 by celegran #+# #+# # 9 | # Updated: 2019/11/03 21:21:39 by cacharle ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Allow the usage of platform-specific tools through environment variables. 14 | MAKE ?= make 15 | CC ?= gcc 16 | 17 | 18 | help: 19 | @echo "Usage :" 20 | @echo "\tmake libft_part1" 21 | @echo "\tmake libft_part2 // Includes part1" 22 | @echo "\tmake libft_bonus // Includes part2 and part1" 23 | @echo "\tmake get_next_line or gnl" 24 | @echo "\tmake ft_ls" 25 | @echo "\tmake ft_printf" 26 | @echo "" 27 | 28 | libft_part1: 29 | @make -C libft_tests part1 30 | 31 | libft_part2: 32 | @make -C libft_tests part2 33 | 34 | libft_bonus: 35 | @make -C libft_tests bonus 36 | 37 | get_next_line: 38 | @make -C get_next_line_tests PASSED_DEFINES=$(PASSED_DEFINES) 39 | 40 | gnl: get_next_line 41 | 42 | ft_ls: 43 | @make -C ft_ls_tests 44 | 45 | ft_printf: 46 | @make -C ft_printf_tests 47 | 48 | update_deps: 49 | @rm -rf testframework/v3/lst 50 | @mkdir -p testframework/v3/lst 51 | @cp ../projects/common/libft/srcs/lst/* testframework/v3/lst 52 | @cp ../projects/common/libft/includes/lst.h testframework/v3/includes/lst.h 53 | 54 | check: 55 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/libft make -k libft_bonus 56 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/libft_part1 make -k libft_part1 57 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/libft_part2 make -k libft_part2 58 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/libft make -k libft_part2 59 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/get_next_line make -k gnl 60 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/get_next_line_with_libft make -k gnl 61 | 62 | # Does not work on the continuous integration for a misterious reason ... 63 | # MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/ft_ls make -k ft_ls 64 | 65 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/ft_printf make -k ft_printf 66 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/ft_printf_with_libft make -k ft_printf 67 | @MAKEFLAGS="" RENDU_PATH=$(shell pwd)/testframework/fake_rendu/ft_printf make -k ft_printf PATTERN=01 68 | 69 | .PHONY: help libft_part1 libft_part2 libft_bonus get_next_line gnl ft_ls ft_printf 70 | -------------------------------------------------------------------------------- /moulitest_files/config.ini: -------------------------------------------------------------------------------- 1 | GET_NEXT_LINE_PATH = /Users/cacharle/get_next_line_test/mtest_tmp 2 | -------------------------------------------------------------------------------- /moulitest_files/config.ini.template: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # Use absolute path 3 | ################################################################################ 4 | 5 | LIBFT_PATH = /absolute/path/to/project 6 | GET_NEXT_LINE_PATH = /absolute/path/to/project 7 | FT_PRINTF_PATH = /absolute/path/to/project 8 | FT_LS_PATH = /absolute/path/to/project 9 | LIBFTASM_PATH = /absolute/path/to/project 10 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/18 09:55:13 by yyang #+# #+# # 9 | #* Updated: 2016/01/19 00:16:54 by mtassett ### ########.fr *# 10 | # # 11 | # **************************************************************************** # 12 | # 13 | # **************************************************************************** # 14 | 15 | #=============================================================================== 16 | # REQUIRED CONFIGS 17 | #=============================================================================== 18 | 19 | # NAME = 20 | # RENDU_PATH_KEY = 21 | 22 | #=============================================================================== 23 | # DEFAULTS 24 | #=============================================================================== 25 | POST_PATTERN = "" 26 | CC_FLAGS = -g 27 | 28 | FRAMEWORK_PATH = ../testframework/v3/ 29 | RENDU_MAKE_ARG = re 30 | CONFIG_INI_PATH = ../config.ini 31 | PATTERN ?= spec.c$$ 32 | define FIRST_RULE 33 | make exec_tests 34 | endef 35 | 36 | ifeq ("$(RENDU_PATH)", "") 37 | RENDU_PATH ?= $(shell grep $(RENDU_PATH_KEY) $(CONFIG_INI_PATH) | cut -d '=' -f 2 | sed -E "s/^[ \"]*//" | sed -E "s/[ \"]*$$//") 38 | endif 39 | 40 | all: 41 | @$(FIRST_RULE) 42 | 43 | #=============================================================================== 44 | # INCLUDES 45 | #=============================================================================== 46 | 47 | include Makefile_cfg.mk 48 | 49 | #=============================================================================== 50 | # COMMON 51 | #=============================================================================== 52 | TESTS_PATH = tests 53 | CC_LIBFT_LIB_DEFAULT = -L $(LIBFT_PATH) -lft 54 | CC_FRAMEWORK_LIB = -L$(FRAMEWORK_PATH) -lmt_framework 55 | CC_INCLUDES = -I . -I $(FRAMEWORK_PATH)/includes -I $(RENDU_PATH) -I $(RENDU_PATH)/includes -I $(RENDU_PATH)/includes/builtin -I 56 | TEST_FILES = $(shell find tests -name "*.spec.c" -type f -follow -print | grep $(PATTERN)) 57 | CC_SOURCE = $(TEST_FILES) main.c utils.c $(CC_SOURCE_EXTRA) 58 | LIBFT_PATH = $(RENDU_PATH)/libft 59 | ADD_TESTS = $(shell echo "$(TEST_FILES)" | perl -pe "s/.*?\/([^\/ ]*)\.spec\.c/MT_ADD_SUITE\(mt, \1, suite_\1); /g") 60 | PROTOTYPES = $(shell echo "$(TEST_FILES)" | perl -pe "s/.*?\/([^\/ ]*)\.spec\.c/MT_ADD_PROTO\(\1\); /g") 61 | # PRP - Added some CC_Defines for the copied files. 62 | CC_DEFINES = -D__MOULITEST__ -DPROTOTYPES="$(PROTOTYPES)" -DADD_TESTS="$(ADD_TESTS)" -DRENDU_PATH="\"$(RENDU_PATH)\"" 63 | CC_DEFINES += $(PASSED_DEFINES) 64 | 65 | C_DIR = $(RENDU_PATH)/srcs 66 | O_DIR = .tmp/objects 67 | 68 | CC_HEADERS = $(CC_INCLUDES) 69 | 70 | C_FILES = $(shell find $(C_DIR) -type f -follow -print | grep ".*\.c$$" | grep -v "\.spec\.c") 71 | C_DIRS = $(shell find $(C_DIR) -type d -follow -print) 72 | 73 | H_FILES = $(shell find $(RENDU_PATH)/includes -type f -follow -print | grep ".*\.h$$") 74 | O_DIRS = $(C_DIRS:$(C_DIR)%=$(O_DIR)%) 75 | O_FILES = $(C_FILES:$(C_DIR)%.c=$(O_DIR)%.o) 76 | CC_OPTIONS = -D__MOULITEST__ -g $(CC_HEADERS) $(CC_FLAGS_EXTRA) 77 | 78 | $(O_DIR)%.o: $(C_DIR)%.c $(H_FILES) 79 | @mkdir -p $(O_DIRS) $(O_DIR) 80 | @gcc $(CC_OPTIONS) $(CONFIG_EXTRA_H) $(LIB_TOWEL_INCLUDES) -o $@ -c $< \ 81 | && printf "." 82 | 83 | exec_tests: $(O_FILES) 84 | @echo "$(TEST_FILES)" 85 | ifneq ("$(wildcard $(RENDU_PATH)/libft/Makefile)","") 86 | @make $(RENDU_MAKE_ARG) -k -C $(LIBFT_PATH) 87 | @$(eval CC_LIBFT_LIB = $(CC_LIBFT_LIB_DEFAULT)) 88 | endif 89 | ifneq ("$(wildcard $(RENDU_PATH)/Makefile)","") 90 | @make $(RENDU_MAKE_ARG) -k -C $(RENDU_PATH) $(CC_LIBFT_LIB) 91 | endif 92 | @make -k -C $(FRAMEWORK_PATH) 93 | @$(CC) $(CC_FLAGS) $(CC_INCLUDES) $(CC_DEFINES) $(CC_SOURCE) $^ -o $(NAME) $(CC_FRAMEWORK_LIB) $(CC_LIBS) 94 | @$(shell pwd)/$(NAME) 95 | 96 | clean: 97 | @-rm -f $(OBJECTS) 98 | 99 | fclean: clean 100 | @-make -k -C $(FRAMEWORK_PATH) fclean 101 | @-rm -f $(NAME) 102 | 103 | # Removed following line because it tries to make the temp directory which has no makefile. 104 | #-make -k -C $(RENDU_PATH) fclean 105 | 106 | re: clean fclean all project 107 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | NAME = get_next_line_tests 2 | RENDU_PATH_KEY = GET_NEXT_LINE_PATH 3 | 4 | ifneq ("$(wildcard $(RENDU_PATH)/libft)","") 5 | CC_LIBS = -lft -L $(RENDU_PATH)/libft 6 | endif 7 | 8 | CC_SOURCE_EXTRA = $(RENDU_PATH)/get_next_line.c 9 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "project.h" 9 | 10 | 11 | PROTOTYPES 12 | 13 | 14 | int main() 15 | { 16 | t_mt *mt = mt_create("get_next_line"); 17 | 18 | setbuf(stdout, NULL); 19 | 20 | ADD_TESTS 21 | 22 | mt_exec(mt); 23 | 24 | free(mt); 25 | return(0); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/project.h: -------------------------------------------------------------------------------- 1 | #ifndef PROJECT_H 2 | # define PROJECT_H 3 | # include 4 | # include 5 | # include 6 | # include 7 | # include 8 | # include 9 | # include 10 | # include 11 | # include 12 | # include 13 | # include 14 | # include 15 | 16 | 17 | char *get_cmd_out(const char *cmd); 18 | char *sandbox_cmd(const char *cmd); 19 | void reset_sandbox(); 20 | char *ls(const char *options); 21 | char *ft_ls(const char *options); 22 | char *ls_err(const char *options); 23 | char *ft_ls_err(const char *options); 24 | char *strip_illegal_opt_err(char *str); 25 | char *strip_no_such_file_or_dir(char *str); 26 | 27 | #endif -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/01_test_simple.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | fd = 1; 11 | out = dup(fd); 12 | pipe(p); 13 | 14 | dup2(p[1], fd); 15 | write(fd, "aaa\nbbb\nccc\nddd\n", 16); 16 | dup2(out, fd); 17 | close(p[1]); 18 | get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "aaa") == 0); 20 | free(line); 21 | 22 | get_next_line(p[0], &line); 23 | mt_assert(strcmp(line, "bbb") == 0); 24 | free(line); 25 | 26 | get_next_line(p[0], &line); 27 | mt_assert(strcmp(line, "ccc") == 0); 28 | free(line); 29 | 30 | get_next_line(p[0], &line); 31 | mt_assert(strcmp(line, "ddd") == 0); 32 | free(line); 33 | } 34 | 35 | void suite_01_test_simple(t_suite *suite) 36 | { 37 | SUITE_ADD_TEST(suite, simple_string); 38 | } 39 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/02_test_eof_with_close.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int gnl_ret; 10 | 11 | fd = 1; 12 | out = dup(fd); 13 | pipe(p); 14 | dup2(p[1], fd); 15 | write(fd, "aaa", 3); 16 | close(p[1]); 17 | dup2(out, fd); 18 | gnl_ret = get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "aaa") == 0); 20 | mt_assert(gnl_ret == 0 || gnl_ret == 1); 21 | free(line); 22 | } 23 | 24 | void suite_02_test_eof_with_close(t_suite *suite) 25 | { 26 | SUITE_ADD_TEST(suite, simple_string); 27 | } 28 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/03_test_medium_string.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | char *str; 9 | int gnl_ret; 10 | 11 | str = (char *)malloc(1000 * 1000); 12 | *str = '\0'; 13 | strcat(str, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in leo dignissim, gravida leo id, imperdiet urna. Aliquam magna nunc, maximus quis eleifend et, scelerisque non dolor. Suspendisse augue augue, tempus"); 14 | strcat(str, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in leo dignissim, gravida leo id, imperdiet urna. Aliquam magna nunc, maximus quis eleifend et, scelerisque non dolor. Suspendisse augue augue, tempus"); 15 | strcat(str, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in leo dignissim, gravida leo id, imperdiet urna. Aliquam magna nunc, maximus quis eleifend et, scelerisque non dolor. Suspendisse augue augue, tempus"); 16 | out = dup(1); 17 | pipe(p); 18 | dup2(p[1], 1); 19 | 20 | write(1, str, strlen(str)); 21 | close(p[1]); 22 | dup2(out, 1); 23 | gnl_ret = get_next_line(p[0], &line); 24 | mt_assert(strcmp(line, str) == 0); 25 | mt_assert(gnl_ret == 0 || gnl_ret == 1); 26 | free(line); 27 | free(str); 28 | } 29 | 30 | void suite_03_test_medium_string(t_suite *suite) 31 | { 32 | SUITE_ADD_TEST(suite, simple_string); 33 | } 34 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/04_test_return_values.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int gnl_ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abc\n\n", 5); 17 | close(p[1]); 18 | dup2(out, fd); 19 | 20 | /* Read abc and new line */ 21 | gnl_ret = get_next_line(p[0], &line); 22 | mt_assert(gnl_ret == 1); 23 | mt_assert(strcmp(line, "abc") == 0); 24 | free(line); 25 | 26 | /* Read new line */ 27 | gnl_ret = get_next_line(p[0], &line); 28 | mt_assert(gnl_ret == 1); 29 | mt_assert(line == NULL || *line == '\0'); 30 | free(line); 31 | 32 | /* Read again, but meet EOF */ 33 | gnl_ret = get_next_line(p[0], &line); 34 | mt_assert(gnl_ret == 0); 35 | mt_assert(line == NULL || *line == '\0'); 36 | free(line); 37 | 38 | /* Let's do it once again */ 39 | gnl_ret = get_next_line(p[0], &line); 40 | mt_assert(gnl_ret == 0); 41 | mt_assert(line == NULL || *line == '\0'); 42 | free(line); 43 | } 44 | 45 | void suite_04_test_return_values(t_suite *suite) 46 | { 47 | SUITE_ADD_TEST(suite, simple_string); 48 | } 49 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/05_test_error_handling.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line = NULL; 6 | 7 | mt_assert(get_next_line(-99, NULL) == -1); 8 | mt_assert(get_next_line(-1, NULL) == -1); 9 | mt_assert(get_next_line(-10000, NULL) == -1); 10 | mt_assert(get_next_line(1, NULL) == -1); 11 | mt_assert(get_next_line(99, NULL) == -1); 12 | 13 | mt_assert(get_next_line(-99, &line) == -1); 14 | mt_assert(get_next_line(-1, &line) == -1); 15 | mt_assert(get_next_line(-10000, &line) == -1); 16 | 17 | /* Not opened fd */ 18 | mt_assert(get_next_line(42, &line) == -1); 19 | } 20 | 21 | void suite_05_test_error_handling(t_suite *suite) 22 | { 23 | SUITE_ADD_TEST(suite, simple_string); 24 | } 25 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/06_test_line_of_08.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "oiuytrew\n", 9); 16 | close(p[1]); 17 | dup2(out, fd); 18 | get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "oiuytrew") == 0); 20 | free(line); 21 | } 22 | 23 | void suite_06_test_line_of_08(t_suite *suite) 24 | { 25 | SUITE_ADD_TEST(suite, simple_string); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/07_test_two_lines_of_08.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "abcdefgh\n", 9); 16 | write(fd, "ijklmnop\n", 9); 17 | close(p[1]); 18 | dup2(out, fd); 19 | get_next_line(p[0], &line); 20 | mt_assert(strcmp(line, "abcdefgh") == 0); 21 | free(line); 22 | 23 | get_next_line(p[0], &line); 24 | mt_assert(strcmp(line, "ijklmnop") == 0); 25 | free(line); 26 | } 27 | 28 | void suite_07_test_two_lines_of_08(t_suite *suite) 29 | { 30 | SUITE_ADD_TEST(suite, simple_string); 31 | } 32 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/08_test_few_lines_of_08.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "abcdefgh\n", 9); 16 | write(fd, "ijklmnop\n", 9); 17 | write(fd, "qrstuvwx\n", 9); 18 | write(fd, "yzabcdef\n", 9); 19 | write(fd, "ghijklmn\n", 9); 20 | write(fd, "opqrstuv\n", 9); 21 | write(fd, "wxyzabcd\n", 9); 22 | close(p[1]); 23 | dup2(out, fd); 24 | get_next_line(p[0], &line); 25 | mt_assert(strcmp(line, "abcdefgh") == 0); 26 | free(line); 27 | 28 | get_next_line(p[0], &line); 29 | mt_assert(strcmp(line, "ijklmnop") == 0); 30 | free(line); 31 | 32 | get_next_line(p[0], &line); 33 | mt_assert(strcmp(line, "qrstuvwx") == 0); 34 | free(line); 35 | 36 | get_next_line(p[0], &line); 37 | mt_assert(strcmp(line, "yzabcdef") == 0); 38 | free(line); 39 | 40 | get_next_line(p[0], &line); 41 | mt_assert(strcmp(line, "ghijklmn") == 0); 42 | free(line); 43 | 44 | get_next_line(p[0], &line); 45 | mt_assert(strcmp(line, "opqrstuv") == 0); 46 | free(line); 47 | 48 | get_next_line(p[0], &line); 49 | mt_assert(strcmp(line, "wxyzabcd") == 0); 50 | free(line); 51 | } 52 | 53 | void suite_08_test_few_lines_of_08(t_suite *suite) 54 | { 55 | SUITE_ADD_TEST(suite, simple_string); 56 | } 57 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/09_test_line_of_16.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcdefghijklmnop\n", 17); 17 | close(p[1]); 18 | dup2(out, fd); 19 | get_next_line(p[0], &line); 20 | mt_assert(strcmp(line, "abcdefghijklmnop") == 0); 21 | free(line); 22 | ret = get_next_line(p[0], &line); 23 | mt_assert(ret == 0); 24 | free(line); 25 | } 26 | 27 | void suite_09_test_line_of_16(t_suite *suite) 28 | { 29 | SUITE_ADD_TEST(suite, simple_string); 30 | } 31 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/10_test_two_lines_of_16.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcdefghijklmnop\n", 17); 17 | write(fd, "qrstuvwxyzabcdef\n", 17); 18 | close(p[1]); 19 | dup2(out, fd); 20 | get_next_line(p[0], &line); 21 | mt_assert(strcmp(line, "abcdefghijklmnop") == 0); 22 | free(line); 23 | 24 | get_next_line(p[0], &line); 25 | mt_assert(strcmp(line, "qrstuvwxyzabcdef") == 0); 26 | free(line); 27 | 28 | ret = get_next_line(p[0], &line); 29 | mt_assert(ret == 0); 30 | free(line); 31 | } 32 | 33 | void suite_10_test_two_lines_of_16(t_suite *suite) 34 | { 35 | SUITE_ADD_TEST(suite, simple_string); 36 | } 37 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/11_test_few_lines_of_16.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcdefghijklmnop\n", 17); 17 | write(fd, "qrstuvwxyzabcdef\n", 17); 18 | write(fd, "ghijklmnopqrstuv\n", 17); 19 | write(fd, "wxyzabcdefghijkl\n", 17); 20 | write(fd, "mnopqrstuvwxyzab\n", 17); 21 | write(fd, "cdefghijklmnopqr\n", 17); 22 | write(fd, "stuvwxzabcdefghi\n", 17); 23 | close(p[1]); 24 | dup2(out, fd); 25 | get_next_line(p[0], &line); 26 | mt_assert(strcmp(line, "abcdefghijklmnop") == 0); 27 | free(line); 28 | 29 | get_next_line(p[0], &line); 30 | mt_assert(strcmp(line, "qrstuvwxyzabcdef") == 0); 31 | free(line); 32 | 33 | get_next_line(p[0], &line); 34 | mt_assert(strcmp(line, "ghijklmnopqrstuv") == 0); 35 | free(line); 36 | 37 | get_next_line(p[0], &line); 38 | mt_assert(strcmp(line, "wxyzabcdefghijkl") == 0); 39 | free(line); 40 | 41 | get_next_line(p[0], &line); 42 | mt_assert(strcmp(line, "mnopqrstuvwxyzab") == 0); 43 | free(line); 44 | 45 | get_next_line(p[0], &line); 46 | mt_assert(strcmp(line, "cdefghijklmnopqr") == 0); 47 | free(line); 48 | 49 | get_next_line(p[0], &line); 50 | mt_assert(strcmp(line, "stuvwxzabcdefghi") == 0); 51 | free(line); 52 | 53 | ret = get_next_line(p[0], &line); 54 | mt_assert(ret == 0); 55 | free(line); 56 | } 57 | 58 | void suite_11_test_few_lines_of_16(t_suite *suite) 59 | { 60 | SUITE_ADD_TEST(suite, simple_string); 61 | } 62 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/12_test_line_of_4.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcd\n", 5); 17 | close(p[1]); 18 | dup2(out, fd); 19 | get_next_line(p[0], &line); 20 | mt_assert(strcmp(line, "abcd") == 0); 21 | free(line); 22 | ret = get_next_line(p[0], &line); 23 | free(line); 24 | mt_assert(ret == 0); 25 | } 26 | 27 | void suite_12_test_line_of_4(t_suite *suite) 28 | { 29 | SUITE_ADD_TEST(suite, simple_string); 30 | } 31 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/13_test_two_lines_of_4.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcd\n", 5); 17 | write(fd, "efgh\n", 5); 18 | close(p[1]); 19 | dup2(out, fd); 20 | get_next_line(p[0], &line); 21 | mt_assert(strcmp(line, "abcd") == 0); 22 | free(line); 23 | 24 | get_next_line(p[0], &line); 25 | mt_assert(strcmp(line, "efgh") == 0); 26 | free(line); 27 | 28 | ret = get_next_line(p[0], &line); 29 | mt_assert(ret == 0); 30 | free(line); 31 | } 32 | 33 | void suite_13_test_two_lines_of_4(t_suite *suite) 34 | { 35 | SUITE_ADD_TEST(suite, simple_string); 36 | } 37 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/14_test_few_lines_of_4.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | int ret; 10 | 11 | out = dup(1); 12 | pipe(p); 13 | 14 | fd = 1; 15 | dup2(p[1], fd); 16 | write(fd, "abcd\n", 5); 17 | write(fd, "efgh\n", 5); 18 | write(fd, "ijkl\n", 5); 19 | write(fd, "mnop\n", 5); 20 | write(fd, "qrst\n", 5); 21 | write(fd, "uvwx\n", 5); 22 | write(fd, "yzab\n", 5); 23 | close(p[1]); 24 | dup2(out, fd); 25 | get_next_line(p[0], &line); 26 | mt_assert(strcmp(line, "abcd") == 0); 27 | free(line); 28 | 29 | get_next_line(p[0], &line); 30 | mt_assert(strcmp(line, "efgh") == 0); 31 | free(line); 32 | 33 | get_next_line(p[0], &line); 34 | mt_assert(strcmp(line, "ijkl") == 0); 35 | free(line); 36 | 37 | get_next_line(p[0], &line); 38 | mt_assert(strcmp(line, "mnop") == 0); 39 | free(line); 40 | 41 | get_next_line(p[0], &line); 42 | mt_assert(strcmp(line, "qrst") == 0); 43 | free(line); 44 | 45 | get_next_line(p[0], &line); 46 | mt_assert(strcmp(line, "uvwx") == 0); 47 | free(line); 48 | 49 | get_next_line(p[0], &line); 50 | mt_assert(strcmp(line, "yzab") == 0); 51 | free(line); 52 | 53 | ret = get_next_line(p[0], &line); 54 | mt_assert(ret == 0); 55 | free(line); 56 | } 57 | 58 | void suite_14_test_few_lines_of_4(t_suite *suite) 59 | { 60 | SUITE_ADD_TEST(suite, simple_string); 61 | } 62 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/15_test_line_without_nl.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "abcd", 4); 16 | close(p[1]); 17 | dup2(out, fd); 18 | get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "abcd") == 0); 20 | free(line); 21 | } 22 | 23 | void suite_15_test_line_without_nl(t_suite *suite) 24 | { 25 | SUITE_ADD_TEST(suite, simple_string); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/16_test_line_of_8_without_nl.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "efghijkl", 8); 16 | close(p[1]); 17 | dup2(out, fd); 18 | get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "efghijkl") == 0); 20 | free(line); 21 | } 22 | 23 | void suite_16_test_line_of_8_without_nl(t_suite *suite) 24 | { 25 | SUITE_ADD_TEST(suite, simple_string); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/17_test_line_of_16_without_nl.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line; 6 | int out; 7 | int p[2]; 8 | int fd; 9 | 10 | out = dup(1); 11 | pipe(p); 12 | 13 | fd = 1; 14 | dup2(p[1], fd); 15 | write(fd, "mnopqrstuvwxyzab", 16); 16 | close(p[1]); 17 | dup2(out, fd); 18 | get_next_line(p[0], &line); 19 | mt_assert(strcmp(line, "mnopqrstuvwxyzab") == 0); 20 | free(line); 21 | } 22 | 23 | void suite_17_test_line_of_16_without_nl(t_suite *suite) 24 | { 25 | SUITE_ADD_TEST(suite, simple_string); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/30_bonus_multiple_fd.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void simple_string(t_test *test) 4 | { 5 | char *line_fd0; 6 | int p_fd0[2]; 7 | int fd0 = 0; 8 | int out_fd0 = dup(fd0); 9 | 10 | char *line_fd1; 11 | int p_fd1[2]; 12 | int fd1 = 1; 13 | int out_fd1 = dup(fd1); 14 | 15 | char *line_fd2; 16 | int p_fd2[2]; 17 | int fd2 = 2; 18 | int out_fd2 = dup(fd2); 19 | 20 | char *line_fd3; 21 | int p_fd3[2]; 22 | int fd3 = 3; 23 | int out_fd3 = dup(fd3); 24 | 25 | pipe(p_fd0); 26 | dup2(p_fd0[1], fd0); 27 | write(fd0, "aaa\nbbb\n", 12); 28 | dup2(out_fd0, fd0); 29 | close(p_fd0[1]); 30 | 31 | pipe(p_fd1); 32 | dup2(p_fd1[1], fd1); 33 | write(fd1, "111\n222\n", 12); 34 | dup2(out_fd1, fd1); 35 | close(p_fd1[1]); 36 | 37 | pipe(p_fd2); 38 | dup2(p_fd2[1], fd2); 39 | write(fd2, "www\nzzz\n", 12); 40 | dup2(out_fd2, fd2); 41 | close(p_fd2[1]); 42 | 43 | pipe(p_fd3); 44 | dup2(p_fd3[1], fd3); 45 | write(fd3, "888\n999\n", 12); 46 | dup2(out_fd3, fd3); 47 | close(p_fd3[1]); 48 | 49 | /* mt_assert(0); */ 50 | get_next_line(p_fd0[0], &line_fd0); 51 | mt_assert(strcmp(line_fd0, "aaa") == 0); 52 | free(line_fd0); 53 | 54 | get_next_line(p_fd1[0], &line_fd1); 55 | mt_assert(strcmp(line_fd1, "111") == 0); 56 | free(line_fd1); 57 | 58 | get_next_line(p_fd2[0], &line_fd2); 59 | mt_assert(strcmp(line_fd2, "www") == 0); 60 | free(line_fd2); 61 | 62 | get_next_line(p_fd3[0], &line_fd3); 63 | mt_assert(strcmp(line_fd3, "888") == 0); 64 | free(line_fd3); 65 | 66 | get_next_line(p_fd0[0], &line_fd0); 67 | mt_assert(strcmp(line_fd0, "bbb") == 0); 68 | free(line_fd0); 69 | 70 | get_next_line(p_fd1[0], &line_fd1); 71 | mt_assert(strcmp(line_fd1, "222") == 0); 72 | free(line_fd1); 73 | 74 | get_next_line(p_fd2[0], &line_fd2); 75 | mt_assert(strcmp(line_fd2, "zzz") == 0); 76 | free(line_fd2); 77 | 78 | get_next_line(p_fd3[0], &line_fd3); 79 | mt_assert(strcmp(line_fd3, "999") == 0); 80 | free(line_fd3); 81 | } 82 | 83 | void suite_30_bonus_multiple_fd(t_suite *suite) 84 | { 85 | SUITE_ADD_TEST(suite, simple_string); 86 | } 87 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/40_hard_test_medium_string.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void test01(t_test *test) 4 | { 5 | test->timeout = 5; 6 | 7 | char *line; 8 | int out; 9 | int p[2]; 10 | char *str; 11 | int len = 50; 12 | 13 | str = (char *)malloc(1000 * 1000); 14 | *str = '\0'; 15 | while (len--) 16 | strcat(str, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in leo dignissim, gravida leo id, imperdiet urna. Aliquam magna nunc, maximus quis eleifend et, scelerisque non dolor. Suspendisse augue augue, tempus"); 17 | out = dup(1); 18 | pipe(p); 19 | dup2(p[1], 1); 20 | if (str) 21 | write(1, str, strlen(str)); 22 | close(p[1]); 23 | dup2(out, 1); 24 | get_next_line(p[0], &line); 25 | mt_assert(strcmp(line, str) == 0); 26 | free(line); 27 | free(str); 28 | } 29 | 30 | void suite_40_hard_test_medium_string(t_suite *suite) 31 | { 32 | SUITE_ADD_TEST_TIMEOUT(suite, test01, 5 * 1000000); 33 | } 34 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/41_hard_test_large_file.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void test01(t_test *test) 4 | { 5 | char *line; 6 | int fd; 7 | int fd2; 8 | int fd3; 9 | int diff_file_size; 10 | 11 | system("mkdir -p sandbox"); 12 | system("openssl rand -out sandbox/large_file.txt -base64 $((50 * 1000 * 3/4)) 2> /dev/null"); 13 | 14 | fd = open("sandbox/large_file.txt", O_RDONLY); 15 | fd2 = open("sandbox/large_file.txt.mine", O_CREAT | O_RDWR | O_TRUNC, 0755); 16 | 17 | while (get_next_line(fd, &line) == 1) 18 | { 19 | write(fd2, line, strlen(line)); 20 | write(fd2, "\n", 1); 21 | free(line); 22 | } 23 | 24 | close(fd); 25 | close(fd2); 26 | 27 | system("diff sandbox/large_file.txt sandbox/large_file.txt.mine > sandbox/large_file.diff"); 28 | fd3 = open("sandbox/large_file.diff", O_RDONLY); 29 | diff_file_size = read(fd3, NULL, 10); 30 | close(fd3); 31 | 32 | mt_assert(diff_file_size == 0); 33 | free(line); 34 | } 35 | 36 | void suite_41_hard_test_large_file(t_suite *suite) 37 | { 38 | SUITE_ADD_TEST_TIMEOUT(suite, test01, 5 * 1000000); 39 | } 40 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/tests/42_hard_test_one_big_fat_line.spec.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static void test01(t_test *test) 4 | { 5 | test->timeout = 1; 6 | 7 | char *line; 8 | int fd; 9 | int fd2; 10 | int fd3; 11 | int diff_file_size; 12 | 13 | system("mkdir -p sandbox"); 14 | system("openssl rand -base64 $((30 * 1000 * 3/4)) | tr -d '\n' | tr -d '\r' > sandbox/one_big_fat_line.txt"); 15 | system("echo '\n' >> sandbox/one_big_fat_line.txt"); 16 | 17 | fd = open("sandbox/one_big_fat_line.txt", O_RDONLY); 18 | fd2 = open("sandbox/one_big_fat_line.txt.mine", O_CREAT | O_RDWR | O_TRUNC, 0755); 19 | 20 | while (get_next_line(fd, &line) == 1) 21 | { 22 | write(fd2, line, strlen(line)); 23 | write(fd2, "\n", 1); 24 | free(line); 25 | } 26 | if (line) 27 | write(fd2, line, strlen(line)); 28 | free(line); 29 | close(fd); 30 | close(fd2); 31 | 32 | system("diff sandbox/one_big_fat_line.txt sandbox/one_big_fat_line.txt.mine > sandbox/one_big_fat_line.diff"); 33 | fd3 = open("sandbox/one_big_fat_line.diff", O_RDONLY); 34 | diff_file_size = read(fd3, NULL, 10); 35 | close(fd3); 36 | 37 | mt_assert(diff_file_size == 0); 38 | } 39 | 40 | void suite_42_hard_test_one_big_fat_line(t_suite *suite) 41 | { 42 | SUITE_ADD_TEST_TIMEOUT(suite, test01, 5 * 1000000); 43 | } 44 | -------------------------------------------------------------------------------- /moulitest_files/get_next_line_tests/utils.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinfoilPancakes/get-next-line-testing-tools/64b93d4495a68fe3d48a62227ab245c48aff8a2b/moulitest_files/get_next_line_tests/utils.c -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_ls/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_ls/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = ft_ls 14 | OUTPUT_TYPE = exec 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_ls/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(int ac, char **av) 4 | { 5 | printf("hello world\n"); 6 | (void)ac; 7 | (void)av; 8 | return (0); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libftprintf.a 14 | OUTPUT_TYPE = lib 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf/ft_printf.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/22 14:09:28 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 15:23:07 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | int ft_printf(char *fmt, ...) 14 | { 15 | (void)fmt; 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libftprintf.a 14 | OUTPUT_TYPE = lib 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/ft_printf.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_printf.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/22 14:09:28 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 15:23:07 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | int ft_printf(char *fmt, ...) 14 | { 15 | (void)fmt; 16 | return (0); 17 | } 18 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/libft/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/libft/ft_strcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 19:45:53 by yyang #+# #+# */ 9 | /* Updated: 2015/01/14 10:57:23 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | char *ft_strcat(char *d, const char *s) 16 | { 17 | char *save; 18 | 19 | save = d; 20 | while (*d) 21 | d++; 22 | while ((*d++ = *s++)) 23 | ; 24 | return (save); 25 | } 26 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/ft_printf_with_libft/libft/includes/libft.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinfoilPancakes/get-next-line-testing-tools/64b93d4495a68fe3d48a62227ab245c48aff8a2b/moulitest_files/testframework/fake_rendu/ft_printf_with_libft/libft/includes/libft.h -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line/get_next_line.c: -------------------------------------------------------------------------------- 1 | #include "get_next_line.h" 2 | 3 | int get_next_line(int const fd, char **line) 4 | { 5 | (void)fd; 6 | (void)line; 7 | if (line) 8 | *line = strdup(""); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line/get_next_line.h: -------------------------------------------------------------------------------- 1 | #ifndef GET_NEXT_LINE_H 2 | # define GET_NEXT_LINE_H 3 | 4 | # define BUFF_SIZE 7 5 | # define MAX_BUFF_SIZE 8385531 6 | # define MAX_PARALLEL_FILES 10000 7 | 8 | # include 9 | # include 10 | 11 | int get_next_line(int const fd, char **line); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/get_next_line.c: -------------------------------------------------------------------------------- 1 | #include "get_next_line.h" 2 | 3 | int get_next_line(int const fd, char **line) 4 | { 5 | (void)fd; 6 | (void)line; 7 | if (line) 8 | *line = strdup(""); 9 | return (0); 10 | } 11 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/get_next_line.h: -------------------------------------------------------------------------------- 1 | #ifndef GET_NEXT_LINE_H 2 | # define GET_NEXT_LINE_H 3 | 4 | # define BUFF_SIZE 7 5 | # define MAX_BUFF_SIZE 8385531 6 | # define MAX_PARALLEL_FILES 10000 7 | 8 | # include 9 | # include 10 | 11 | int get_next_line(int const fd, char **line); 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/libft/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/libft/ft_strcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 19:45:53 by yyang #+# #+# */ 9 | /* Updated: 2015/01/14 10:57:23 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | char *ft_strcat(char *d, const char *s) 16 | { 17 | char *save; 18 | 19 | save = d; 20 | while (*d) 21 | d++; 22 | while ((*d++ = *s++)) 23 | ; 24 | return (save); 25 | } 26 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/get_next_line_with_libft/libft/includes/libft.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinfoilPancakes/get-next-line-testing-tools/64b93d4495a68fe3d48a62227ab245c48aff8a2b/moulitest_files/testframework/fake_rendu/get_next_line_with_libft/libft/includes/libft.h -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_atoi(const char *str) 3 | { 4 | (void)str; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_bzero.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_bzero(void *s, size_t n) 3 | { 4 | (void)(s); 5 | (void)(n); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalnum(int c) 3 | { 4 | (void)(c); 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalpha(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isascii.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isascii(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isblank.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isblank(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isdigit(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_islower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_islower(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isprint(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isspace(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_isupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_itoa.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_itoa(int n) 3 | { 4 | (void)n; 5 | return (ft_strdup("")); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstadd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstadd(t_list **alst, t_list *new) 3 | { 4 | (void)alst; 5 | (void)new; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstiter(t_list *lst, void (f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstnew(void const *content, size_t content_size) 3 | { 4 | (void)content; 5 | (void)content_size; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memalloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memalloc(size_t size) 3 | { 4 | (void)size; 5 | return (NULL); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void *ft_memccpy(void *dst, const void *src, int c, size_t n) 4 | { 5 | (void)dst; 6 | (void)src; 7 | (void)n; 8 | return (strdup("abc")); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memchr(const void *s, int c, size_t n) 3 | { 4 | (void)s; 5 | (void)c; 6 | (void)n; 7 | return (NULL); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_memcmp(const void *s1, const void *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memcpy(void *dst, const void *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_memdel(void **ap) 3 | { 4 | (void)ap; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memmove(void *dest, const void *src, size_t len) 3 | { 4 | (void)src; 5 | (void)len; 6 | return (dest); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memset(void *b, int c, size_t len) 3 | { 4 | (void)c; 5 | (void)len; 6 | return (b); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putchar_fd(char c, int fd) 3 | { 4 | (void)c; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl(char const *s) 3 | { 4 | (void)s; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr(int n) 3 | { 4 | (void)n; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr_fd(int n, int fd) 3 | { 4 | (void)n; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putnendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnendl(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnstr(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr(char const *s) 3 | { 4 | write(1, "123", 1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcat(char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | return ((char *)s2); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strclr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strclr(char *s) 3 | { 4 | (void)s; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strcmp(const char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcpy(char *dst, const char *src) 3 | { 4 | (void)src; 5 | return (dst); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strdel(char **as) 3 | { 4 | (void)as; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strdup(const char *s1) 3 | { 4 | return ((char *)s1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strequ(char const *s1, char const *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_striter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striter(char *s, void (*f)(char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_striteri.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striteri(char *s, void (*f)(unsigned int, char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strjoin(char const *s1, char const *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlcat(char *dst, const char *src, size_t size) 3 | { 4 | (void)src; 5 | (void)dst; 6 | return (size); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlen(const char *s) 3 | { 4 | (void)s; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strlowcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strlowcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libft.h" 3 | 4 | char *ft_strmap(char const *s, char (*f)(char)) 5 | { 6 | (void)f; 7 | return ((char *)s); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) 3 | { 4 | (void)f; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | char *ft_strncat(char *s1, const char *s2, size_t n) 5 | { 6 | (void)s2; 7 | (void)n; 8 | return (s1); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strncmp(const char *s1, const char *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strncpy(char *dst, const char *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strnequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strnequ(char const *s1, char const *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (1); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strnew(size_t size) 3 | { 4 | (void)size; 5 | return (""); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | char *ft_strnstr(const char *s1, const char *s2, size_t n) 4 | { 5 | (void)s2; 6 | (void)n; 7 | return (strdup("abc")); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strrev.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrev(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strsplit.c: -------------------------------------------------------------------------------- 1 | #include 2 | char **ft_strsplit(char const *s, char c) 3 | { 4 | char **out; 5 | 6 | out = malloc(sizeof(char *) * 10); 7 | out[0] = ft_strdup("aaa"); 8 | out[1] = ft_strdup("aaa"); 9 | out[2] = ft_strdup("aaa"); 10 | out[3] = ft_strdup("aaa"); 11 | out[4] = ft_strdup("aaa"); 12 | out[5] = ft_strdup("aaa"); 13 | out[6] = ft_strdup("aaa"); 14 | 15 | (void)c; 16 | (void)s; 17 | return (out); 18 | } 19 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strstr(const char *s1, const char *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strsub.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strsub(char const *s, unsigned int start, size_t len) 3 | { 4 | (void)start; 5 | (void)len; 6 | return ((char *)s); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strtrim(char const *s) 3 | { 4 | return ((char *)s); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_strupcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strupcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_tolower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_tolower(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/ft_toupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_toupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 15:05:51 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 15:14:41 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | # include 19 | 20 | typedef struct s_list 21 | { 22 | void *content; 23 | size_t content_size; 24 | struct s_list *next; 25 | } t_list; 26 | 27 | void *ft_memset(void *b, int c, size_t len); 28 | void ft_bzero(void *s, size_t n); 29 | void *ft_memcpy(void *dst, const void *src, size_t n); 30 | void *ft_memccpy(void *dst, const void *src, int c, size_t n); 31 | void *ft_memmove(void *dest, const void *src, size_t len); 32 | void *ft_memchr(const void *s, int c, size_t n); 33 | int ft_memcmp(const void *s1, const void *s2, size_t n); 34 | size_t ft_strlen(const char *s); 35 | char *ft_strdup(const char *s1); 36 | char *ft_strcpy(char *dst, const char *src); 37 | char *ft_strncpy(char *dst, const char *src, size_t n); 38 | char *ft_strcat(char *s1, const char *s2); 39 | char *ft_strncat(char *s1, const char *s2, size_t n); 40 | size_t ft_strlcat(char *dst, const char *src, size_t size); 41 | char *ft_strchr(const char *s, int c); 42 | char *ft_strrchr(const char *s, int c); 43 | char *ft_strstr(const char *s1, const char *s2); 44 | char *ft_strnstr(const char *s1, const char *s2, size_t n); 45 | int ft_strcmp(const char *s1, const char *s2); 46 | int ft_strncmp(const char *s1, const char *s2, size_t n); 47 | int ft_atoi(const char *str); 48 | int ft_isalpha(int c); 49 | int ft_isdigit(int c); 50 | int ft_isalnum(int c); 51 | int ft_isascii(int c); 52 | int ft_isprint(int c); 53 | int ft_toupper(int c); 54 | int ft_tolower(int c); 55 | 56 | void *ft_memalloc(size_t size); 57 | void ft_memdel(void **ap); 58 | char *ft_strnew(size_t size); 59 | void ft_strdel(char **as); 60 | void ft_strclr(char *s); 61 | void ft_striter(char *s, void(*f)(char *)); 62 | void ft_striteri(char *s, void(*f)(unsigned int, char *)); 63 | char *ft_strmap(char const *s, char(*f)(char)); 64 | char *ft_strmapi(char const *s, char(*f)(unsigned int, char)); 65 | int ft_strequ(char const *s1, char const *s2); 66 | int ft_strnequ(char const *s1, char const *s2, size_t n); 67 | char *ft_strsub(char const *s, unsigned int start, size_t len); 68 | char *ft_strjoin(char const *s1, char const *s2); 69 | char *ft_strtrim(char const *s); 70 | char **ft_strsplit(char const *s, char c); 71 | char *ft_itoa(int n); 72 | void ft_putchar(char c); 73 | void ft_putstr(char const *s); 74 | void ft_putendl(char const *s); 75 | void ft_putnbr(int n); 76 | void ft_putchar_fd(char c, int fd); 77 | void ft_putstr_fd(char const *s, int fd); 78 | void ft_putendl_fd(char const *s, int fd); 79 | void ft_putnbr_fd(int n, int fd); 80 | 81 | t_list *ft_lstnew(void const *content, size_t content_size); 82 | void ft_lstdelone(t_list **alst, void (*del)(void*, size_t)); 83 | void ft_lstdel(t_list **alst, void (*del)(void*, size_t)); 84 | void ft_lstadd(t_list **alst, t_list *new); 85 | void ft_lstiter(t_list *lst, void (*f)(t_list *elem)); 86 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)); 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_atoi(const char *str) 3 | { 4 | (void)str; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_bzero.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_bzero(void *s, size_t n) 3 | { 4 | (void)(s); 5 | (void)(n); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalnum(int c) 3 | { 4 | (void)(c); 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalpha(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isascii.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isascii(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isblank.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isblank(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isdigit(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_islower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_islower(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isprint(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isspace(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_isupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_itoa.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_itoa(int n) 3 | { 4 | (void)n; 5 | return (ft_strdup("")); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstadd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstadd(t_list **alst, t_list *new) 3 | { 4 | (void)alst; 5 | (void)new; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstiter(t_list *lst, void (f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstnew(void const *content, size_t content_size) 3 | { 4 | (void)content; 5 | (void)content_size; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memalloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memalloc(size_t size) 3 | { 4 | (void)size; 5 | return (NULL); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void *ft_memccpy(void *dst, const void *src, int c, size_t n) 4 | { 5 | (void)dst; 6 | (void)src; 7 | (void)n; 8 | return (strdup("abc")); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memchr(const void *s, int c, size_t n) 3 | { 4 | (void)s; 5 | (void)c; 6 | (void)n; 7 | return (NULL); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_memcmp(const void *s1, const void *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memcpy(void *dst, const void *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_memdel(void **ap) 3 | { 4 | (void)ap; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memmove(void *dest, const void *src, size_t len) 3 | { 4 | (void)src; 5 | (void)len; 6 | return (dest); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memset(void *b, int c, size_t len) 3 | { 4 | (void)c; 5 | (void)len; 6 | return (b); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putchar_fd(char c, int fd) 3 | { 4 | (void)c; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl(char const *s) 3 | { 4 | (void)s; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr(int n) 3 | { 4 | (void)n; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr_fd(int n, int fd) 3 | { 4 | (void)n; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putnendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnendl(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnstr(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr(char const *s) 3 | { 4 | write(1, "123", 1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcat(char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | return ((char *)s2); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strclr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strclr(char *s) 3 | { 4 | (void)s; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strcmp(const char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcpy(char *dst, const char *src) 3 | { 4 | (void)src; 5 | return (dst); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strdel(char **as) 3 | { 4 | (void)as; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strdup(const char *s1) 3 | { 4 | return ((char *)s1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strequ(char const *s1, char const *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_striter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striter(char *s, void (*f)(char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_striteri.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striteri(char *s, void (*f)(unsigned int, char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strjoin(char const *s1, char const *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlcat(char *dst, const char *src, size_t size) 3 | { 4 | (void)src; 5 | (void)dst; 6 | return (size); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlen(const char *s) 3 | { 4 | (void)s; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strlowcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strlowcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libft.h" 3 | 4 | char *ft_strmap(char const *s, char (*f)(char)) 5 | { 6 | (void)f; 7 | return ((char *)s); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) 3 | { 4 | (void)f; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | char *ft_strncat(char *s1, const char *s2, size_t n) 5 | { 6 | (void)s2; 7 | (void)n; 8 | return (s1); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strncmp(const char *s1, const char *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strncpy(char *dst, const char *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strnequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strnequ(char const *s1, char const *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (1); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strnew(size_t size) 3 | { 4 | (void)size; 5 | return (""); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | char *ft_strnstr(const char *s1, const char *s2, size_t n) 4 | { 5 | (void)s2; 6 | (void)n; 7 | return (strdup("abc")); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strrev.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrev(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strsplit.c: -------------------------------------------------------------------------------- 1 | #include 2 | char **ft_strsplit(char const *s, char c) 3 | { 4 | char **out; 5 | 6 | out = malloc(sizeof(char *) * 10); 7 | out[0] = ft_strdup("aaa"); 8 | out[1] = ft_strdup("aaa"); 9 | out[2] = ft_strdup("aaa"); 10 | out[3] = ft_strdup("aaa"); 11 | out[4] = ft_strdup("aaa"); 12 | out[5] = ft_strdup("aaa"); 13 | out[6] = ft_strdup("aaa"); 14 | 15 | (void)c; 16 | (void)s; 17 | return (out); 18 | } 19 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strstr(const char *s1, const char *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strsub.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strsub(char const *s, unsigned int start, size_t len) 3 | { 4 | (void)start; 5 | (void)len; 6 | return ((char *)s); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strtrim(char const *s) 3 | { 4 | return ((char *)s); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_strupcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strupcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_tolower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_tolower(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/ft_toupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_toupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part1/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 15:05:51 by yyang #+# #+# */ 9 | /* Updated: 2015/01/23 19:55:21 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | # include 19 | 20 | typedef struct s_list 21 | { 22 | void *content; 23 | size_t content_size; 24 | struct s_list *next; 25 | } t_list; 26 | 27 | void *ft_memset(void *b, int c, size_t len); 28 | void ft_bzero(void *s, size_t n); 29 | void *ft_memcpy(void *dst, const void *src, size_t n); 30 | void *ft_memccpy(void *dst, const void *src, int c, size_t n); 31 | void *ft_memmove(void *dest, const void *src, size_t len); 32 | void *ft_memchr(const void *s, int c, size_t n); 33 | int ft_memcmp(const void *s1, const void *s2, size_t n); 34 | size_t ft_strlen(const char *s); 35 | char *ft_strdup(const char *s1); 36 | char *ft_strcpy(char *dst, const char *src); 37 | char *ft_strncpy(char *dst, const char *src, size_t n); 38 | char *ft_strcat(char *s1, const char *s2); 39 | char *ft_strncat(char *s1, const char *s2, size_t n); 40 | size_t ft_strlcat(char *dst, const char *src, size_t size); 41 | char *ft_strchr(const char *s, int c); 42 | char *ft_strrchr(const char *s, int c); 43 | char *ft_strstr(const char *s1, const char *s2); 44 | char *ft_strnstr(const char *s1, const char *s2, size_t n); 45 | int ft_strcmp(const char *s1, const char *s2); 46 | int ft_strncmp(const char *s1, const char *s2, size_t n); 47 | int ft_atoi(const char *str); 48 | int ft_isalpha(int c); 49 | int ft_isdigit(int c); 50 | int ft_isalnum(int c); 51 | int ft_isascii(int c); 52 | int ft_isprint(int c); 53 | int ft_toupper(int c); 54 | int ft_tolower(int c); 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_atoi.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_atoi(const char *str) 3 | { 4 | (void)str; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_bzero.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_bzero(void *s, size_t n) 3 | { 4 | (void)(s); 5 | (void)(n); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isalnum.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalnum(int c) 3 | { 4 | (void)(c); 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isalpha.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isalpha(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isascii.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isascii(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isblank.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isblank(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isdigit.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isdigit(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_islower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_islower(int c) 3 | { 4 | (void)c; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isprint.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isprint(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isspace.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isspace(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_isupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_isupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_itoa.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_itoa(int n) 3 | { 4 | (void)n; 5 | return (ft_strdup("")); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstadd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstadd(t_list **alst, t_list *new) 3 | { 4 | (void)alst; 5 | (void)new; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdel(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstdelone.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstdelone(t_list **alst, void (*del)(void *, size_t)) 3 | { 4 | (void)alst; 5 | (void)del; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstiter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_lstiter(t_list *lst, void (f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstmap(t_list *lst, t_list *(*f)(t_list *elem)) 3 | { 4 | (void)lst; 5 | (void)f; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_lstnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | t_list *ft_lstnew(void const *content, size_t content_size) 3 | { 4 | (void)content; 5 | (void)content_size; 6 | return (NULL); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memalloc.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memalloc(size_t size) 3 | { 4 | (void)size; 5 | return (NULL); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memccpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void *ft_memccpy(void *dst, const void *src, int c, size_t n) 4 | { 5 | (void)dst; 6 | (void)src; 7 | (void)n; 8 | return (strdup("abc")); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memchr(const void *s, int c, size_t n) 3 | { 4 | (void)s; 5 | (void)c; 6 | (void)n; 7 | return (NULL); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_memcmp(const void *s1, const void *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memcpy(void *dst, const void *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_memdel(void **ap) 3 | { 4 | (void)ap; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memmove.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memmove(void *dest, const void *src, size_t len) 3 | { 4 | (void)src; 5 | (void)len; 6 | return (dest); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_memset.c: -------------------------------------------------------------------------------- 1 | #include 2 | void *ft_memset(void *b, int c, size_t len) 3 | { 4 | (void)c; 5 | (void)len; 6 | return (b); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putchar.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void ft_putchar(char c) 4 | { 5 | write(1, &c, 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putchar_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putchar_fd(char c, int fd) 3 | { 4 | (void)c; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl(char const *s) 3 | { 4 | (void)s; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putendl_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putendl_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putnbr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr(int n) 3 | { 4 | (void)n; 5 | write(1, "123", 1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putnbr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnbr_fd(int n, int fd) 3 | { 4 | (void)n; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putnendl.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnendl(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putnstr(char *s, size_t n) 3 | { 4 | (void)s; 5 | (void)n; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr(char const *s) 3 | { 4 | write(1, "123", 1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_putstr_fd.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_putstr_fd(char const *s, int fd) 3 | { 4 | (void)s; 5 | (void)fd; 6 | write(fd, "123", 1); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcat(char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | return ((char *)s2); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strclr.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strclr(char *s) 3 | { 4 | (void)s; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strcmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strcmp(const char *s1, const char *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strcpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strcpy(char *dst, const char *src) 3 | { 4 | (void)src; 5 | return (dst); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strdel.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_strdel(char **as) 3 | { 4 | (void)as; 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strdup.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strdup(const char *s1) 3 | { 4 | return ((char *)s1); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strequ(char const *s1, char const *s2) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | return (0); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_striter.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striter(char *s, void (*f)(char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_striteri.c: -------------------------------------------------------------------------------- 1 | #include 2 | void ft_striteri(char *s, void (*f)(unsigned int, char *)) 3 | { 4 | (void)s; 5 | (void)f; 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strjoin.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strjoin(char const *s1, char const *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strlcat.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlcat(char *dst, const char *src, size_t size) 3 | { 4 | (void)src; 5 | (void)dst; 6 | return (size); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strlen.c: -------------------------------------------------------------------------------- 1 | #include 2 | size_t ft_strlen(const char *s) 3 | { 4 | (void)s; 5 | return (0); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strlowcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strlowcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strmap.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "libft.h" 3 | 4 | char *ft_strmap(char const *s, char (*f)(char)) 5 | { 6 | (void)f; 7 | return ((char *)s); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strmapi.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strmapi(char const *s, char (*f)(unsigned int, char)) 3 | { 4 | (void)f; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strncat.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | char *ft_strncat(char *s1, const char *s2, size_t n) 5 | { 6 | (void)s2; 7 | (void)n; 8 | return (s1); 9 | } 10 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strncmp.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strncmp(const char *s1, const char *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (0); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strncpy.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strncpy(char *dst, const char *src, size_t n) 3 | { 4 | (void)src; 5 | (void)n; 6 | return (dst); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strnequ.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_strnequ(char const *s1, char const *s2, size_t n) 3 | { 4 | (void)s1; 5 | (void)s2; 6 | (void)n; 7 | return (1); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strnew.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strnew(size_t size) 3 | { 4 | (void)size; 5 | return (""); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strnstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | char *ft_strnstr(const char *s1, const char *s2, size_t n) 4 | { 5 | (void)s2; 6 | (void)n; 7 | return (strdup("abc")); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strrchr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrchr(const char *s, int c) 3 | { 4 | (void)c; 5 | return ((char *)s); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strrev.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strrev(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strsplit.c: -------------------------------------------------------------------------------- 1 | #include 2 | char **ft_strsplit(char const *s, char c) 3 | { 4 | char **out; 5 | 6 | out = malloc(sizeof(char *) * 10); 7 | out[0] = ft_strdup("aaa"); 8 | out[1] = ft_strdup("aaa"); 9 | out[2] = ft_strdup("aaa"); 10 | out[3] = ft_strdup("aaa"); 11 | out[4] = ft_strdup("aaa"); 12 | out[5] = ft_strdup("aaa"); 13 | out[6] = ft_strdup("aaa"); 14 | 15 | (void)c; 16 | (void)s; 17 | return (out); 18 | } 19 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strstr.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strstr(const char *s1, const char *s2) 3 | { 4 | (void)s2; 5 | return ((char *)s1); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strsub.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strsub(char const *s, unsigned int start, size_t len) 3 | { 4 | (void)start; 5 | (void)len; 6 | return ((char *)s); 7 | } 8 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strtrim.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strtrim(char const *s) 3 | { 4 | return ((char *)s); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_strupcase.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *ft_strupcase(char *str) 3 | { 4 | return (str); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_tolower.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_tolower(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/ft_toupper.c: -------------------------------------------------------------------------------- 1 | #include 2 | int ft_toupper(int c) 3 | { 4 | return (c); 5 | } 6 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_part2/libft.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* libft.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 15:05:51 by yyang #+# #+# */ 9 | /* Updated: 2015/01/23 20:35:56 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef LIBFT_H 14 | # define LIBFT_H 15 | 16 | # include 17 | # include 18 | # include 19 | 20 | typedef struct s_list 21 | { 22 | void *content; 23 | size_t content_size; 24 | struct s_list *next; 25 | } t_list; 26 | 27 | void *ft_memset(void *b, int c, size_t len); 28 | void ft_bzero(void *s, size_t n); 29 | void *ft_memcpy(void *dst, const void *src, size_t n); 30 | void *ft_memccpy(void *dst, const void *src, int c, size_t n); 31 | void *ft_memmove(void *dest, const void *src, size_t len); 32 | void *ft_memchr(const void *s, int c, size_t n); 33 | int ft_memcmp(const void *s1, const void *s2, size_t n); 34 | size_t ft_strlen(const char *s); 35 | char *ft_strdup(const char *s1); 36 | char *ft_strcpy(char *dst, const char *src); 37 | char *ft_strncpy(char *dst, const char *src, size_t n); 38 | char *ft_strcat(char *s1, const char *s2); 39 | char *ft_strncat(char *s1, const char *s2, size_t n); 40 | size_t ft_strlcat(char *dst, const char *src, size_t size); 41 | char *ft_strchr(const char *s, int c); 42 | char *ft_strrchr(const char *s, int c); 43 | char *ft_strstr(const char *s1, const char *s2); 44 | char *ft_strnstr(const char *s1, const char *s2, size_t n); 45 | int ft_strcmp(const char *s1, const char *s2); 46 | int ft_strncmp(const char *s1, const char *s2, size_t n); 47 | int ft_atoi(const char *str); 48 | int ft_isalpha(int c); 49 | int ft_isdigit(int c); 50 | int ft_isalnum(int c); 51 | int ft_isascii(int c); 52 | int ft_isprint(int c); 53 | int ft_toupper(int c); 54 | int ft_tolower(int c); 55 | 56 | void *ft_memalloc(size_t size); 57 | void ft_memdel(void **ap); 58 | char *ft_strnew(size_t size); 59 | void ft_strdel(char **as); 60 | void ft_strclr(char *s); 61 | void ft_striter(char *s, void(*f)(char *)); 62 | void ft_striteri(char *s, void(*f)(unsigned int, char *)); 63 | char *ft_strmap(char const *s, char(*f)(char)); 64 | char *ft_strmapi(char const *s, char(*f)(unsigned int, char)); 65 | int ft_strequ(char const *s1, char const *s2); 66 | int ft_strnequ(char const *s1, char const *s2, size_t n); 67 | char *ft_strsub(char const *s, unsigned int start, size_t len); 68 | char *ft_strjoin(char const *s1, char const *s2); 69 | char *ft_strtrim(char const *s); 70 | char **ft_strsplit(char const *s, char c); 71 | char *ft_itoa(int n); 72 | void ft_putchar(char c); 73 | void ft_putstr(char const *s); 74 | void ft_putendl(char const *s); 75 | void ft_putnbr(int n); 76 | void ft_putchar_fd(char c, int fd); 77 | void ft_putstr_fd(char const *s, int fd); 78 | void ft_putendl_fd(char const *s, int fd); 79 | void ft_putnbr_fd(int n, int fd); 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_to_be_symliked/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_to_be_symliked/Makefile_cfg.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/22 15:03:35 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | NAME = libft.a 14 | OUTPUT_TYPE = lib -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_to_be_symliked/ft_strcat.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* ft_strcat.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/11/05 19:45:53 by yyang #+# #+# */ 9 | /* Updated: 2015/01/14 10:57:23 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | char *ft_strcat(char *d, const char *s) 16 | { 17 | char *save; 18 | 19 | save = d; 20 | while (*d) 21 | d++; 22 | while ((*d++ = *s++)) 23 | ; 24 | return (save); 25 | } 26 | -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/libft_to_be_symliked/includes/libft.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TinfoilPancakes/get-next-line-testing-tools/64b93d4495a68fe3d48a62227ab245c48aff8a2b/moulitest_files/testframework/fake_rendu/libft_to_be_symliked/includes/libft.h -------------------------------------------------------------------------------- /moulitest_files/testframework/fake_rendu/makefile_templates/Makefile: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/22 14:47:06 by yyang #+# #+# # 9 | # Updated: 2015/01/23 21:33:28 by yyang ### ########.fr # 10 | # # 11 | # **************************************************************************** # 12 | 13 | # Required variables: NAME 14 | include Makefile_cfg.mk 15 | 16 | FLAGS = -I includes -I . 17 | 18 | all: $(NAME) 19 | 20 | $(NAME): 21 | $(CC) $(FLAGS) -c *.c 22 | ifeq ($(OUTPUT_TYPE), lib) 23 | ar rcs $(NAME) *.o 24 | endif 25 | ifeq ($(OUTPUT_TYPE), exec) 26 | @$(CC) $(FLAGS) *.o -o $@ 27 | endif 28 | @echo "$(COL_GREEN)$(NAME)$(COL_RESET)" 29 | 30 | clean: 31 | rm -rf *.o 32 | 33 | fclean: clean 34 | rm -f $(NAME) 35 | 36 | re: fclean all 37 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v2/testframework.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | ut_test_list_t *ut_tests = 0; 7 | jmp_buf ut_env; 8 | char *ut_last_err; 9 | char *ut_last_cond; 10 | int is_warning; 11 | char ut_test_symbol[100000]; 12 | 13 | void ut_sigsegv_(int u) 14 | { 15 | (void)u; 16 | longjmp(ut_env, 1); 17 | } 18 | 19 | ut_test_list_t *ut_create_list_(ut_test f, char *n) 20 | { 21 | ut_test_list_t *tmp; 22 | 23 | tmp = malloc(sizeof(ut_test_list_t)); 24 | tmp->next = 0; 25 | tmp->test = f; 26 | tmp->name = n; 27 | tmp->is_fail = 0; 28 | return (tmp); 29 | } 30 | 31 | void ut_add_test(ut_test f, char *n) 32 | { 33 | ut_test_list_t *tmp; 34 | 35 | if (!ut_tests) 36 | ut_tests = ut_create_list_(f, n); 37 | else 38 | { 39 | tmp = ut_tests; 40 | while (tmp->next) 41 | tmp = tmp->next; 42 | tmp->next = ut_create_list_(f, n); 43 | } 44 | } 45 | 46 | 47 | void ut_print_result_line(char *test_name, char *res_level, char *dots, char *message) 48 | { 49 | printf("%s%s%s%s", test_name, res_level, dots, message); 50 | } 51 | 52 | void ut_run_test(ut_test_list_t *t_, int *i_, int *_test_fails) 53 | { 54 | char *color; 55 | char *res_msg; 56 | 57 | printf("%s%-30s", "["C_YELLOW"UT"C_CLEAR"] ", t_->name); 58 | t_->test(i_); 59 | if(*(i_) == 1) { 60 | color = C_RED; 61 | res_msg = "FAIL"; 62 | (*_test_fails)++; 63 | } 64 | else { 65 | color = C_GREEN; 66 | res_msg = "Ok !"; 67 | } 68 | printf("[%s%s"C_CLEAR"] ", color, res_msg); 69 | printf("%s", ut_test_symbol); 70 | if (ut_last_err) 71 | printf(" ERROR: %s", ut_last_err); 72 | printf("\n"); 73 | *ut_test_symbol = '\0'; 74 | ut_last_err = NULL; 75 | ut_last_cond = NULL; 76 | } 77 | 78 | void ut_run_all_tests(void) 79 | { 80 | int _test_fails; 81 | int count; 82 | int ret; 83 | ut_test_list_t *tmp; 84 | 85 | signal(SIGBUS, &ut_sigsegv_); 86 | signal(SIGSEGV, &ut_sigsegv_); 87 | signal(SIGILL, &ut_sigsegv_) ; 88 | _test_fails = 0; 89 | count = 0; 90 | if (!ut_tests) 91 | return ; 92 | puts("[ "C_CYAN"-------STARTING ALL UNIT TESTS-------"C_CLEAR" ]"); 93 | tmp = ut_tests; 94 | while (tmp) 95 | { 96 | ret = 0; 97 | if (setjmp(ut_env)) 98 | { 99 | printf("["C_RED"FAIL"C_CLEAR"] %s"C_BLUE"SEGV"C_CLEAR, ut_test_symbol); 100 | if (ut_last_cond) 101 | printf(" ERROR: %s", ut_last_cond); 102 | printf("\n"); 103 | *ut_test_symbol = '\0'; 104 | ut_last_cond = NULL; 105 | _test_fails++; 106 | } 107 | else 108 | { 109 | ut_run_test(tmp, &ret, &_test_fails); 110 | } 111 | count++; 112 | tmp = tmp->next; 113 | } 114 | printf(C_WHITE"End of test : %d out of %d test passed."C_CLEAR"\n", count - _test_fails, count); 115 | puts("[ "C_CYAN"----------END OF UNIT TESTS----------"C_CLEAR" ]"); 116 | } 117 | 118 | 119 | void ut_assert_exec(int assert_res, char *assert_str, int *param) 120 | { 121 | ut_last_cond = assert_str; 122 | if(!(assert_res)) { 123 | if (!ut_last_err) 124 | { 125 | ut_last_err = ut_last_cond; 126 | if (!is_warning) 127 | *param = 1; 128 | } 129 | if (is_warning) 130 | strcat(ut_test_symbol, C_YELLOW"X"C_CLEAR); 131 | else 132 | strcat(ut_test_symbol, C_RED"X"C_CLEAR); 133 | } else { 134 | strcat(ut_test_symbol, C_GREEN"."C_CLEAR); 135 | } 136 | is_warning = 0; 137 | } 138 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v2/testframework.h: -------------------------------------------------------------------------------- 1 | #ifndef UNIT_TEST_H 2 | # define UNIT_TEST_H 3 | 4 | # include 5 | # include 6 | # include 7 | # include 8 | 9 | # define C_CLEAR "\033[0m" 10 | # define C_YELLOW "\033[33m" 11 | # define C_RED "\033[31;1m" 12 | # define C_GREEN "\033[32;1m" 13 | # define C_CYAN "\033[36;1m" 14 | # define C_WHITE "\033[37;1m" 15 | # define C_BLUE "\033[34;1m" 16 | 17 | # define UT_TEST(name) void ut_test_ ## name(int *param) 18 | # define UT_ASSERT_W(cond) is_warning = 1; UT_ASSERT_EXEC(cond) 19 | # define UT_ASSERT(cond) is_warning = 0; UT_ASSERT_EXEC(cond) 20 | # define UT_ASSERT_EXEC(cond) ut_assert_exec(cond, #cond, param) 21 | 22 | # define UT_ASSERT_EQ(a, b) UT_ASSERT((a) == (b)) 23 | # define UT_ASSERT_EQ_STR(a, b) UT_ASSERT(a && b && strcmp(a, b)) 24 | # define UT_ASSERT_NEQ(a, b) UT_ASSERT((a) != (b)) 25 | 26 | typedef void (*ut_test)(int *); 27 | 28 | typedef struct ut_test_list_s 29 | { 30 | ut_test test; 31 | char *name; 32 | int is_fail; 33 | struct ut_test_list_s *next; 34 | } ut_test_list_t; 35 | 36 | extern ut_test_list_t *ut_tests; 37 | extern int is_warning; 38 | extern char *ut_last_err; 39 | extern char *ut_last_cond; 40 | extern char ut_test_symbol[100000]; 41 | 42 | void ut_sigsegv_(int); 43 | ut_test_list_t *ut_create_list_(ut_test, char *); 44 | void ut_add_test(ut_test, char *); 45 | void ut_run_all_tests(void); 46 | int strequ(const char *s1, const char *s2); 47 | char *re_replace(char *str, char *pattern, char *replacement); 48 | void ut_assert_exec(int assert_res, char *assert_str, int *param); 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v2/utils.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int strequ(const char *s1, const char *s2) 5 | { 6 | return (s1 && s2 && strcmp(s1, s2) == 0); 7 | } 8 | 9 | char *re_replace(char *str, char *pattern, char *replacement) 10 | { 11 | int ret = 0; 12 | int cnt = 0; 13 | int offset = 0; 14 | char temp[1000000]; 15 | char *output; 16 | bzero(temp, 1000000); 17 | regex_t reg; 18 | regmatch_t pm; 19 | regcomp(®, pattern, REG_EXTENDED); /* REG_ICASE */ 20 | while(ret == 0) { 21 | ret = regexec(®, str + offset, 1, &pm, 0); 22 | if (ret != 0) 23 | break; 24 | strncat(temp, str + offset, pm.rm_so); 25 | strcat(temp, replacement); 26 | offset += pm.rm_eo; 27 | cnt++; 28 | } 29 | strcat(temp, str + offset); 30 | output = strdup(temp); 31 | return (output); 32 | } 33 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/Makefile: -------------------------------------------------------------------------------- 1 | NAME = libmt_framework.a 2 | INCLUDES = -I includes 3 | # SRCS = main.c **/*.c 4 | SRCS = srcs/**/*.c 5 | FLAGS = -Wall -Werror -Wextra -ggdb 6 | 7 | # C_DIR = srcs/ 8 | # O_DIR = .tmp/objects/ 9 | 10 | # C_FILES = $(shell find $(C_DIR) -type f -follow -print | grep ".*\.c$$") 11 | # C_DIRS = $(shell find $(C_DIR) -type d -follow -print) 12 | 13 | all: clean 14 | $(CC) $(FLAGS) $(INCLUDES) -c $(SRCS) ../../../../get_next_line/get_next_line_utils.c 15 | ar rc $(NAME) *.o 16 | 17 | clean: 18 | rm -f *.o 19 | 20 | fclean: clean 21 | rm -f $(NAME) 22 | 23 | re: fclean all 24 | 25 | # run: re 26 | # # $(CC) $(NAME) main.c -I includes 27 | # ./a.out 28 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/capture.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef CAPTURE_H 3 | # define CAPTURE_H 4 | 5 | typedef struct s_cap_stdout 6 | { 7 | int target_fd; 8 | int saved_fd; 9 | int out_pipe[2]; 10 | char buffer[10000]; 11 | 12 | } t_cap_stdout; 13 | 14 | // t_cap_stdout *capture_stdout_create(int target_fd); 15 | void capture_stdout(void); 16 | char *capture_stdout_get_buffer(void); 17 | void capture_stdout_destroy(void); 18 | void capture_close_saved_stdout(void); 19 | 20 | #endif -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/color.h: -------------------------------------------------------------------------------- 1 | #ifndef COLOR_H 2 | # define COLOR_H 3 | 4 | # define C_CLEAR "\033[0m" 5 | # define C_YELLOW "\033[33m" 6 | # define C_RED "\033[31;1m" 7 | # define C_GREEN "\033[32;1m" 8 | // # define C_GREEN "\033[32;1m" 9 | # define C_CYAN "\033[36;1m" 10 | # define C_WHITE "\033[37;1m" 11 | # define C_BLUE "\033[34;1m" 12 | 13 | #endif -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/fw.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef FW_H 3 | # define FW_H 4 | 5 | # include 6 | 7 | # define mt_assert_base(cond, msg, signum) test_assert_prep(test, #cond, msg, signum); test_assert(test, (cond)) 8 | # define mt_assert_msg(cond, msg) mt_assert_base(cond, msg, 0) 9 | # define mt_assert(cond) mt_assert_base(cond, NULL, 0) 10 | # define mt_assert_signal(cond, signum) mt_assert_base(cond, NULL, signum) 11 | # define SUITE_ADD_TEST_BASE(suite, test_fn, timeout) mt_lst_push(suite->tests, mt_lst_create_elem(test_create(#test_fn, test_fn, timeout))) 12 | # define SUITE_ADD_TEST(suite, test_fn) SUITE_ADD_TEST_BASE(suite, test_fn, DEFAULT_TIMEOUT_UTIME) 13 | # define SUITE_ADD_TEST_TIMEOUT(suite, test_fn, timeout) SUITE_ADD_TEST_BASE(suite, test_fn, timeout) 14 | 15 | # define MT_ADD_SUITE(mt, name, suite_fn) mt_lst_push(mt->suites, mt_lst_create_elem(suite_create(#name, suite_fn))) 16 | # define MT_ADD_PROTO(name) void suite_ ## name(t_suite *suite) 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/mt.h: -------------------------------------------------------------------------------- 1 | #ifndef MT_H 2 | # define MT_H 3 | # define ffprintf(str) fflush(stdout); fprintf(stdout, str); fflush(stdout); 4 | # include 5 | # include 6 | # define MAIN_COL_WIDTH 41 7 | # define DEFAULT_TIMEOUT_UTIME 2 * 1000 * 1000 8 | 9 | typedef struct s_mt 10 | { 11 | char *name; 12 | char *desc; 13 | t_mt_lst *suites; 14 | } t_mt; 15 | 16 | t_mt *mt_create(char *name); 17 | void mt_del(t_mt *mt); 18 | int mt_exec(t_mt *mt); 19 | size_t mt_count_failed_suites(t_mt *mt); 20 | size_t mt_count_tests(t_mt *mt); 21 | size_t mt_count_failed_tests(t_mt *mt); 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/mt_lst.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 19:33:34 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:27:41 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef MT_LST_H 14 | # define MT_LST_H 15 | # include 16 | 17 | typedef struct s_mt_lst_elem 18 | { 19 | void *data; 20 | struct s_mt_lst_elem *next; 21 | struct s_mt_lst_elem *prev; 22 | struct s_mt_lst *parent; 23 | char *key; 24 | } t_mt_lst_elem; 25 | 26 | typedef struct s_mt_lst 27 | { 28 | size_t len; 29 | struct s_mt_lst_elem *elems; 30 | } t_mt_lst; 31 | 32 | t_mt_lst *mt_lst_init(void); 33 | t_mt_lst_elem *mt_lst_create_elem(void *data); 34 | void mt_lst_push(t_mt_lst *lst, t_mt_lst_elem *newelem); 35 | void mt_lst_pop(t_mt_lst *lst); 36 | size_t mt_lst_len(t_mt_lst *lst); 37 | t_mt_lst_elem *mt_lst_get(t_mt_lst *lst, size_t index); 38 | t_mt_lst *mt_lst_map(t_mt_lst *lst, 39 | t_mt_lst_elem *(*f)(t_mt_lst_elem *elem)); 40 | void mt_lst_iter(t_mt_lst *lst, void (*f)(t_mt_lst_elem *elem)); 41 | void mt_lst_del(t_mt_lst *lst, void (*delfn)()); 42 | void mt_lst_del_elem(t_mt_lst *lst, t_mt_lst_elem *elem, 43 | void (*delfn)()); 44 | void mt_lstelem_del(t_mt_lst_elem *elem, void (*delfn)()); 45 | t_mt_lst_elem *mt_lst_find(t_mt_lst *lst, void *(*f)(void *)); 46 | size_t mt_lst_count(t_mt_lst *lst, void *(*f)(void *)); 47 | int mt_lst_reducei(t_mt_lst *lst, int (*fn)(t_mt_lst_elem *elem, 48 | int memo), int memo); 49 | void mt_lst__link(t_mt_lst_elem *elem1, t_mt_lst_elem *elem2); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/mt_xstdio.h: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_xstdio.h :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/25 22:17:41 by yyang #+# #+# */ 9 | /* Updated: 2015/01/25 22:18:29 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #ifndef MT_XSTDIO 14 | #define MT_XSTDIO 15 | 16 | int mt_isemptyfile(const char *path); 17 | 18 | #endif -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/suite.h: -------------------------------------------------------------------------------- 1 | #ifndef SUITE_H 2 | # define SUITE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | # define MAX_TESTS_PER_SUITE 1000 9 | 10 | struct s_suite; 11 | 12 | typedef void (t_suite_fn)(struct s_suite *); 13 | 14 | typedef struct s_suite 15 | { 16 | char *name; 17 | t_suite_fn *fn; 18 | t_mt_lst *tests; 19 | int x_success_count; 20 | int x_warning_count; 21 | } t_suite; 22 | 23 | t_suite *suite_create(char *name, t_suite_fn *fn); 24 | void suite_del(t_suite *suite); 25 | void suite_add_test(t_suite *suite, t_test *test); 26 | void suite_exec(t_mt_lst_elem *elem); 27 | size_t suite_count_failed_tests(t_suite *suite); 28 | int suite_filter_failed(t_suite *suite); 29 | size_t suite_count_tests(t_suite *suite); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/includes/test.h: -------------------------------------------------------------------------------- 1 | #ifndef TEST_H 2 | # define TEST_H 3 | 4 | # include 5 | # include 6 | # include 7 | 8 | struct s_test; 9 | 10 | typedef void (t_test_fn)(struct s_test *); 11 | 12 | typedef struct s_test 13 | { 14 | char *name; 15 | char *last_assert_cond; 16 | char *msg; 17 | t_test_fn *fn; 18 | int is_fail; 19 | int expected_signum; 20 | int test_type; 21 | int sig; 22 | int debug; 23 | int timeout; 24 | } t_test; 25 | 26 | t_test *test_create(char *name, t_test_fn *fn, int timeout); 27 | void test_del(t_test *test); 28 | void test_print(t_mt_lst_elem *elem); 29 | void test_exec(t_mt_lst_elem *elem); 30 | void test_assert(t_test *test, int is_fail); 31 | void test_assert_prep(t_test *test, char *cond, char *msg, int expected_signum); 32 | int test_filter_failed(t_test *test); 33 | char *test_get_failure_type(t_test *test); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/capture/capture.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #define MAX_LEN 42000 10 | #define BUF_SIZE MAX_LEN + 1 11 | 12 | const int READ = 0; 13 | const int WRITE = 1; 14 | // t_cap_stdout *capture_stdout_create(int target_fd) 15 | // { 16 | // t_cap_stdout *cap; 17 | // extern int saved_stdout; 18 | 19 | // cap = malloc(sizeof(t_cap_stdout)); 20 | // saved_stdout = dup(cap.target_fd); /* save stdout for display later */ 21 | // cap.target_fd = target_fd; 22 | // *(out_buffer) = '\0'; 23 | // return (cap); 24 | // } 25 | 26 | int out_pipe[2]; 27 | char out_buffer[10 * 1000]; 28 | 29 | #include 30 | #define NO_FD_OPENED -1 31 | int saved_stdout = NO_FD_OPENED; 32 | 33 | void capture_close_saved_stdout(void) 34 | { 35 | extern int saved_stdout; 36 | 37 | if (saved_stdout != NO_FD_OPENED) 38 | { 39 | // fprintf(stderr, "== close %d ==\n", saved_stdout); 40 | dup2(saved_stdout, STDOUT_FILENO); 41 | close(saved_stdout); /* important ! */ 42 | saved_stdout = NO_FD_OPENED; 43 | close(out_pipe[READ]); 44 | close(out_pipe[WRITE]); 45 | } 46 | } 47 | 48 | void capture_stdout(void) 49 | { 50 | capture_close_saved_stdout(); 51 | if( pipe(out_pipe) != 0 ) { /* make a pipe */ 52 | assert(0); 53 | } 54 | assert(saved_stdout < 100); 55 | saved_stdout = dup(STDOUT_FILENO); /* save stdout for display later */ 56 | dup2(out_pipe[WRITE], STDOUT_FILENO); /* redirect stdout to the pipe */ 57 | } 58 | 59 | static void capture_unblock_fd(int fd) 60 | { 61 | 62 | int flags = fcntl(fd, F_GETFL, 0); 63 | fcntl(fd, F_SETFL, flags | O_NONBLOCK); 64 | } 65 | 66 | char *capture_stdout_get_buffer(void) 67 | { 68 | int ret; 69 | fflush(stdout); 70 | 71 | capture_unblock_fd(out_pipe[0]); 72 | *(out_buffer) = '\0'; 73 | ret = read(out_pipe[READ], out_buffer, MAX_LEN); /* read from pipe into buffer */ 74 | out_buffer[ret] = '\0'; 75 | return (out_buffer); 76 | } 77 | 78 | void capture_stdout_destroy(void) 79 | { 80 | extern int saved_stdout; 81 | dup2(saved_stdout, STDOUT_FILENO); /* reconnect stdout for testing */ 82 | capture_close_saved_stdout(); 83 | 84 | // free(cap); 85 | } 86 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_count_failed_suites.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t mt_count_failed_suites(t_mt *mt) 4 | { 5 | return (mt_lst_count(mt->suites, (void *)suite_filter_failed)); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_count_failed_tests.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | static int sum_suite_tests(t_mt_lst_elem *elem, int memo) 4 | { 5 | t_suite *suite; 6 | 7 | suite = elem->data; 8 | return (suite_count_failed_tests(suite) + memo); 9 | } 10 | 11 | size_t mt_count_failed_tests(t_mt *mt) 12 | { 13 | return (mt_lst_reducei(mt->suites, sum_suite_tests, 0)); 14 | } 15 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_count_tests.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static int sum_suite_tests(t_mt_lst_elem *elem, int memo) 5 | { 6 | t_suite *suite; 7 | 8 | suite = elem->data; 9 | return (suite_count_tests(suite) + memo); 10 | } 11 | 12 | size_t mt_count_tests(t_mt *mt) 13 | { 14 | return (mt_lst_reducei(mt->suites, sum_suite_tests, 0)); 15 | } 16 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_create.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | t_mt *mt_create(char *name) 9 | { 10 | t_mt *mt; 11 | 12 | mt = (t_mt *)malloc(sizeof(t_mt)); 13 | bzero(mt, sizeof(t_mt)); 14 | mt->name = name; 15 | mt->desc = NULL; 16 | mt->suites = mt_lst_init(); 17 | return (mt); 18 | } 19 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_del.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | void mt_del(t_mt *mt) 9 | { 10 | mt_lst_del(mt->suites, suite_del); 11 | free(mt); 12 | } 13 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt/mt_exec.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | static void mt_exec_suites(t_mt *mt) 6 | { 7 | mt_lst_iter(mt->suites, (void *)suite_exec); 8 | } 9 | 10 | static void mt_print_header(t_mt *mt) 11 | { 12 | printf("\n--\n\n"); 13 | printf(C_CYAN">>>> Tests for %s"C_CLEAR"\n", mt->name); 14 | // printf("=== Tests for %s ===\n", mt->name); 15 | // printf("Test: %s\n", mt->name); 16 | printf("Source: github.com/yyang42/moulitest\n"); 17 | printf("Legend:"); 18 | printf(" ("C_GREEN"."C_CLEAR") Ok"); 19 | printf(" / ("C_RED"F"C_CLEAR") Fail"); 20 | printf(" / ("C_RED"S"C_CLEAR") Segfault"); 21 | printf(" / ("C_RED"B"C_CLEAR") Bus error"); 22 | printf(" / ("C_RED"T"C_CLEAR") Timeout"); 23 | printf(" / ("C_RED"A"C_CLEAR") Abort"); 24 | puts("\n"); 25 | if (mt->desc) 26 | printf("Notes: %s\n\n", mt->desc); 27 | printf("[ "C_CYAN"-------STARTING ALL UNIT TESTS-------"C_CLEAR" ]"); 28 | puts(""); 29 | (void)mt; 30 | } 31 | 32 | static void mt_print_result(t_mt *mt) 33 | { 34 | char *color; 35 | 36 | if (mt_count_failed_suites(mt) > 0) 37 | color = C_RED; 38 | else 39 | color = C_GREEN; 40 | printf("%s", color); 41 | printf(">>>> Result: %lu/%lu test suites passed.", 42 | mt_lst_len(mt->suites) - mt_count_failed_suites(mt) 43 | , mt_lst_len(mt->suites)); 44 | 45 | size_t total_tests = mt_count_tests(mt); 46 | printf(" %lu/%lu tests passed (dots).", total_tests - mt_count_failed_tests(mt), total_tests); 47 | printf(C_CLEAR); 48 | puts(""); 49 | } 50 | 51 | static void mt_print_footer(t_mt *mt) 52 | { 53 | puts("[ "C_CYAN"----------END OF UNIT TESTS----------"C_CLEAR" ]"); 54 | puts(""); 55 | mt_print_result(mt); 56 | puts(""); 57 | } 58 | 59 | int mt_exec(t_mt *mt) 60 | { 61 | mt_print_header(mt); 62 | mt_exec_suites(mt); 63 | mt_print_footer(mt); 64 | return (mt_count_failed_suites(mt) ? 1 : 0); 65 | } 66 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst__link.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst__link.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 17:50:11 by yyang #+# #+# */ 9 | /* Updated: 2015/01/09 16:03:53 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | void mt_lst__link(t_mt_lst_elem *elem1, t_mt_lst_elem *elem2) 16 | { 17 | if (elem1) 18 | elem1->next = elem2; 19 | if (elem2) 20 | elem2->prev = elem1; 21 | } 22 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_count.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_count.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: juschaef +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/07 09:17:53 by juschaef #+# #+# */ 9 | /* Updated: 2015/01/07 18:25:55 by juschaef ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | size_t mt_lst_count(t_mt_lst *lst, void *(*f)(void *)) 16 | { 17 | int len; 18 | t_mt_lst_elem *elem; 19 | 20 | len = 0; 21 | elem = lst->elems; 22 | while (elem) 23 | { 24 | if (f(elem->data)) 25 | len++; 26 | elem = elem->next; 27 | } 28 | return (len); 29 | } 30 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_create_elem.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_create_elem.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 10:18:33 by yyang #+# #+# */ 9 | /* Updated: 2015/01/09 15:07:34 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | t_mt_lst_elem *mt_lst_create_elem(void *data) 17 | { 18 | t_mt_lst_elem *elem; 19 | 20 | elem = malloc(sizeof(t_mt_lst_elem)); 21 | elem->data = data; 22 | elem->next = NULL; 23 | elem->prev = NULL; 24 | elem->parent = NULL; 25 | elem->key = NULL; 26 | return (elem); 27 | } 28 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_del.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lst_del.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 16:52:50 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:08:06 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | void mt_lst_del(t_mt_lst *lst, void (*delfn)(void *)) 17 | { 18 | t_mt_lst_elem *elem; 19 | t_mt_lst_elem *next; 20 | 21 | elem = lst->elems; 22 | while (elem) 23 | { 24 | next = elem->next; 25 | mt_lstelem_del(elem, delfn); 26 | elem = next; 27 | } 28 | free(lst); 29 | } 30 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_del_elem.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lst_del_elem.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 16:52:50 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:07:44 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | void mt_lst_del_elem(t_mt_lst *lst, t_mt_lst_elem *elem, void (*delfn)()) 17 | { 18 | if (lst->elems == elem) 19 | lst->elems = elem->next; 20 | mt_lst__link(elem->prev, elem->next); 21 | delfn(elem->data); 22 | if (elem->key) 23 | free(elem->key); 24 | elem->data = NULL; 25 | elem->next = NULL; 26 | elem->prev = NULL; 27 | elem->parent = NULL; 28 | elem->key = NULL; 29 | free(elem); 30 | (void)lst; 31 | } 32 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_find.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_find.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/19 10:51:42 by juschaef #+# #+# */ 9 | /* Updated: 2015/01/08 19:44:29 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | t_mt_lst_elem *mt_lst_find(t_mt_lst *lst, void *(*f)(void *)) 16 | { 17 | t_mt_lst_elem *elem; 18 | 19 | elem = lst->elems; 20 | while (elem) 21 | { 22 | if (f(elem->data)) 23 | return (elem); 24 | elem = elem->next; 25 | } 26 | return (NULL); 27 | } 28 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_find_by_value.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_find_by_value.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/19 10:51:42 by juschaef #+# #+# */ 9 | /* Updated: 2015/01/08 20:15:26 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | t_mt_lst_elem *mt_lst_find_by_value(t_mt_lst *lst, 16 | int (*f)(void *data, void *value), void *value) 17 | { 18 | t_mt_lst_elem *elem; 19 | 20 | elem = lst->elems; 21 | while (elem) 22 | { 23 | if (f(elem->data, value)) 24 | return (elem); 25 | elem = elem->next; 26 | } 27 | return (NULL); 28 | } 29 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_get.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lst_get.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 09:41:52 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:23:26 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | t_mt_lst_elem *mt_lst_get(t_mt_lst *lst, size_t index) 16 | { 17 | t_mt_lst_elem *elem; 18 | 19 | elem = lst->elems; 20 | while (elem && index--) 21 | elem = elem->next; 22 | return (elem ? elem : NULL); 23 | } 24 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_init.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_init.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 09:45:21 by yyang #+# #+# */ 9 | /* Updated: 2014/12/12 10:15:16 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | t_mt_lst *mt_lst_init(void) 17 | { 18 | t_mt_lst *lst; 19 | 20 | lst = (t_mt_lst *)malloc(sizeof(t_mt_lst)); 21 | lst->len = 0; 22 | lst->elems = NULL; 23 | return (lst); 24 | } 25 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_iter.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_iter.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: annguyen +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/20 17:06:30 by annguyen #+# #+# */ 9 | /* Updated: 2015/01/20 22:44:46 by annguyen ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | void mt_lst_iter(t_mt_lst *lst, void (*f)(t_mt_lst_elem *elem)) 16 | { 17 | t_mt_lst_elem *elem; 18 | 19 | elem = lst->elems; 20 | while (elem) 21 | { 22 | f(elem); 23 | elem = elem->next; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_len.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_len.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/11 22:24:18 by yyang #+# #+# */ 9 | /* Updated: 2014/12/28 09:48:55 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | size_t mt_lst_len(t_mt_lst *lst) 16 | { 17 | int len; 18 | t_mt_lst_elem *elem; 19 | 20 | elem = lst->elems; 21 | len = 0; 22 | while (elem) 23 | { 24 | elem = elem->next; 25 | len++; 26 | } 27 | return (len); 28 | } 29 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_map.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lst_map.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 09:29:17 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:22:05 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | t_mt_lst *mt_lst_map(t_mt_lst *lst, t_mt_lst_elem *(*fn)(t_mt_lst_elem *elem)) 16 | { 17 | t_mt_lst *new_lst; 18 | t_mt_lst_elem *elem; 19 | 20 | elem = lst->elems; 21 | new_lst = mt_lst_init(); 22 | while (elem) 23 | { 24 | mt_lst_push(new_lst, fn(elem)); 25 | elem = elem->next; 26 | } 27 | return (new_lst); 28 | } 29 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_pop.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lst_pop.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 09:41:52 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 22:23:47 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | void mt_lst_pop(t_mt_lst *lst) 17 | { 18 | t_mt_lst_elem *elem; 19 | t_mt_lst_elem *prev; 20 | 21 | elem = lst->elems; 22 | while (elem->next) 23 | elem = elem->next; 24 | prev = elem->prev; 25 | if (lst->elems == elem) 26 | lst->elems = NULL; 27 | if (prev) 28 | prev->next = NULL; 29 | } 30 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_push.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_push.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: juschaef +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 09:41:52 by yyang #+# #+# */ 9 | /* Updated: 2015/01/07 18:26:09 by juschaef ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | void mt_lst_push(t_mt_lst *lst, t_mt_lst_elem *newelem) 16 | { 17 | t_mt_lst_elem *tmpelem; 18 | 19 | newelem->parent = lst; 20 | if (!lst->elems) 21 | { 22 | lst->elems = newelem; 23 | } 24 | else 25 | { 26 | tmpelem = lst->elems; 27 | while (tmpelem->next) 28 | tmpelem = tmpelem->next; 29 | tmpelem->next = newelem; 30 | mt_lst__link(tmpelem, tmpelem->next); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_reduce.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_reduce.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/02 23:25:47 by yyang #+# #+# */ 9 | /* Updated: 2015/01/02 23:45:46 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | void *mt_lst_reduce(t_mt_lst *lst, void *(*fn)(t_mt_lst_elem *elem, 16 | void *memo), void *context) 17 | { 18 | t_mt_lst_elem *elem; 19 | 20 | elem = lst->elems; 21 | while (elem) 22 | { 23 | context = fn(elem, context); 24 | elem = elem->next; 25 | } 26 | return (context); 27 | } 28 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lst_reducei.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_lst_reducei.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/02 23:25:47 by yyang #+# #+# */ 9 | /* Updated: 2015/01/04 19:35:01 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | int mt_lst_reducei(t_mt_lst *lst, int (*fn)(t_mt_lst_elem *elem, int memo), int memo) 16 | { 17 | t_mt_lst_elem *elem; 18 | 19 | elem = lst->elems; 20 | while (elem) 21 | { 22 | memo = fn(elem, memo); 23 | elem = elem->next; 24 | } 25 | return (memo); 26 | } 27 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_lst/mt_lstelem_del.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* lstelem_del.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2014/12/12 16:52:50 by yyang #+# #+# */ 9 | /* Updated: 2015/01/22 20:43:18 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | #include 15 | 16 | void mt_lstelem_del(t_mt_lst_elem *elem, void (*delfn)()) 17 | { 18 | if (delfn) 19 | delfn(elem->data); 20 | (void)delfn; 21 | if (elem->key) 22 | free(elem->key); 23 | elem->data = NULL; 24 | elem->next = NULL; 25 | elem->prev = NULL; 26 | elem->parent = NULL; 27 | elem->key = NULL; 28 | free(elem); 29 | } 30 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/mt_xstdio/mt_xstdio_isempty.c: -------------------------------------------------------------------------------- 1 | /* ************************************************************************** */ 2 | /* */ 3 | /* ::: :::::::: */ 4 | /* mt_xstdio_isempty.c :+: :+: :+: */ 5 | /* +:+ +:+ +:+ */ 6 | /* By: yyang +#+ +:+ +#+ */ 7 | /* +#+#+#+#+#+ +#+ */ 8 | /* Created: 2015/01/25 22:16:18 by yyang #+# #+# */ 9 | /* Updated: 2015/01/26 10:28:47 by yyang ### ########.fr */ 10 | /* */ 11 | /* ************************************************************************** */ 12 | 13 | #include 14 | 15 | int mt_isemptyfile(const char *path) 16 | { 17 | FILE *fp; 18 | 19 | fp = fopen(path, "r"); 20 | long saved_offset = ftell(fp); 21 | fseek(fp, 0, SEEK_END); 22 | 23 | if (ftell(fp) == 0) 24 | return (1); 25 | fseek(fp, saved_offset, SEEK_SET); 26 | fclose(fp); 27 | return (0); 28 | } -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_count_failed_tests.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t suite_count_failed_tests(t_suite *suite) 4 | { 5 | return (mt_lst_count(suite->tests, (void *)test_filter_failed)); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_count_tests.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | size_t suite_count_tests(t_suite *suite) 4 | { 5 | return (mt_lst_len(suite->tests)); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_create.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | t_suite *suite_create(char *name, t_suite_fn *fn) 5 | { 6 | t_suite *suite; 7 | 8 | suite = malloc(sizeof(t_suite)); 9 | bzero(suite, sizeof(t_suite)); 10 | suite->name = strdup(name); 11 | 12 | suite->tests = mt_lst_init(); 13 | suite->fn = fn; 14 | return (suite); 15 | } 16 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_del.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void suite_del(t_suite *suite) 4 | { 5 | mt_lst_del(suite->tests, test_del); 6 | free(suite->name); 7 | free(suite); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_exec.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static void suite_print_prefix(t_suite *suite) 8 | { 9 | int ut_len; 10 | char *file_suffix = ".spec.c"; 11 | char suite_name[10 * 1000]; 12 | 13 | ut_len = 5; 14 | 15 | // printf("\r"); 16 | printf("%s", ""C_YELLOW">>>> "C_CLEAR); 17 | sprintf(suite_name, "%s%s %.*s", 18 | suite->name, 19 | file_suffix, 20 | (MAIN_COL_WIDTH 21 | - ut_len 22 | - (int)strlen(suite->name) 23 | - (int)strlen(file_suffix) 24 | - 8), 25 | "---------------------------------------------------------------------"); 26 | printf("%.*s", MAIN_COL_WIDTH - 12, suite_name); 27 | } 28 | 29 | static void suite_print_first_failure(t_suite *suite) 30 | { 31 | t_test *test; 32 | t_mt_lst_elem *elem; 33 | size_t max_msg_length = 80; 34 | char *suffix; 35 | 36 | elem = mt_lst_find(suite->tests, (void *)test_filter_failed); 37 | if (!elem) 38 | return ; 39 | test = elem->data; 40 | printf(C_RED); 41 | printf(" [%s]", test_get_failure_type(test)); 42 | fprintf(stdout, " %s", test->name); 43 | if (test->msg) 44 | suffix = test->msg; 45 | else 46 | suffix = test->last_assert_cond; 47 | 48 | printf(" -> %.*s", (int)max_msg_length, suffix); 49 | if (suffix && (strlen(suffix) > max_msg_length)) 50 | printf("..."); 51 | printf(C_CLEAR); 52 | } 53 | 54 | static void suite_print_suite_summary(t_suite *suite) 55 | { 56 | if (!mt_lst_len(suite->tests)) 57 | fprintf(stdout, "[\?\?\?\?]"); 58 | else if (suite_count_failed_tests(suite)) 59 | fprintf(stdout, C_RED"[FAIL]"C_CLEAR); 60 | else 61 | fprintf(stdout, C_GREEN"[Ok !]"C_CLEAR); 62 | } 63 | 64 | static void suite_print_result(t_suite *suite) 65 | { 66 | suite_print_prefix(suite); 67 | fprintf(stdout, " "); 68 | suite_print_suite_summary(suite); 69 | fprintf(stdout, " "); 70 | mt_lst_iter(suite->tests, (void *)test_print); 71 | suite_print_first_failure(suite); 72 | } 73 | 74 | void suite_exec(t_mt_lst_elem *elem) 75 | { 76 | t_suite *suite; 77 | 78 | suite = elem->data; 79 | // suite_print_result(suite); 80 | suite->fn(suite); 81 | mt_lst_iter(suite->tests, (void *)test_exec); 82 | suite_print_result(suite); 83 | puts(""); 84 | } 85 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/suite/suite_filter_failed.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int suite_filter_failed(t_suite *suite) 4 | { 5 | return (mt_lst_find(suite->tests, (void *)test_filter_failed) != NULL); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_assert.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void test_assert(t_test *test, int cond_res) 7 | { 8 | if (cond_res == 0) 9 | raise(SIGUSR1); 10 | (void)test; 11 | } 12 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_assert_prep.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void test_assert_prep(t_test *test, char *cond, char *msg, int expected_signum) 6 | { 7 | test->last_assert_cond = cond; 8 | test->msg = msg; 9 | test->expected_signum = expected_signum; 10 | } 11 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_create.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | t_test *test_create(char *name, t_test_fn *fn, int timeout) 5 | { 6 | t_test *test; 7 | 8 | test = (t_test *)malloc(sizeof(t_test)); 9 | bzero(test, sizeof(t_test)); 10 | test->name = strdup(name); 11 | test->sig = 0; 12 | test->fn = fn; 13 | test->debug = 0; 14 | test->timeout = timeout; 15 | return (test); 16 | } 17 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_del.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void test_del(t_test *test) 5 | { 6 | free(test->name); 7 | free(test); 8 | } 9 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_exec.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | # define DEFAULT_TIMEOUT_UINTERVAL 1 * 1000 * 1000 16 | 17 | jmp_buf env_buffer; 18 | 19 | static void sig_handler_jmp(int signum) 20 | { 21 | longjmp(env_buffer, signum); 22 | } 23 | 24 | static void test_exec_do(t_test *test) 25 | { 26 | signal(SIGUSR1, sig_handler_jmp); 27 | signal(SIGABRT, sig_handler_jmp); 28 | signal(SIGSEGV, sig_handler_jmp); 29 | signal(SIGBUS, sig_handler_jmp); 30 | signal(SIGALRM, sig_handler_jmp); 31 | 32 | test->is_fail = 0; 33 | if (!(test->sig = setjmp(env_buffer))) 34 | { 35 | ualarm(test->timeout, DEFAULT_TIMEOUT_UINTERVAL); 36 | test->fn(test); 37 | } 38 | if (test->expected_signum != test->sig) 39 | test->is_fail = 1; 40 | capture_close_saved_stdout(); 41 | } 42 | 43 | void test_exec(t_mt_lst_elem *elem) 44 | { 45 | t_test *test; 46 | 47 | test = elem->data; 48 | test_exec_do(test); 49 | // test_print(elem); 50 | // usleep(300 * 1000); 51 | } 52 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_filter_failed.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int test_filter_failed(t_test *test) 4 | { 5 | return (test->is_fail); 6 | } 7 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_get_failure_type.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | char *test_get_failure_type(t_test *test) 7 | { 8 | if (test->is_fail) 9 | { 10 | if (test->sig == SIGABRT) 11 | return (strdup("ABRT")); 12 | else if (test->sig == SIGSEGV) 13 | return (strdup("SEGV")); 14 | else if (test->sig == SIGBUS) 15 | return (strdup("BUS!")); 16 | else if (test->sig == SIGALRM) 17 | return (strdup("TIME")); 18 | else 19 | return (strdup("FAIL")); 20 | } 21 | else 22 | { 23 | return (strdup("OK !")); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/test/test_print.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void test_print(t_mt_lst_elem *elem) 7 | { 8 | char *symbol; 9 | t_test *test; 10 | 11 | test = elem->data; 12 | if (test->is_fail) 13 | { 14 | if (test->sig == SIGABRT) 15 | symbol = C_RED "A" C_CLEAR; 16 | else if (test->sig == SIGSEGV) 17 | symbol = C_RED "S" C_CLEAR; 18 | else if (test->sig == SIGBUS) 19 | symbol = C_RED "B" C_CLEAR; 20 | else if (test->sig == SIGALRM) 21 | symbol = C_RED "T" C_CLEAR; 22 | else 23 | symbol = C_RED "F" C_CLEAR; 24 | } 25 | else 26 | symbol = C_GREEN "." C_CLEAR; 27 | printf("%s", symbol); 28 | } 29 | -------------------------------------------------------------------------------- /moulitest_files/testframework/v3/srcs/utils/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | # define UTILS_H 3 | 4 | #endif -------------------------------------------------------------------------------- /moulitest_files/testframework/v3_templates/Makefile_template.mk: -------------------------------------------------------------------------------- 1 | # **************************************************************************** # 2 | # # 3 | # ::: :::::::: # 4 | # Makefile :+: :+: :+: # 5 | # +:+ +:+ +:+ # 6 | # By: yyang +#+ +:+ +#+ # 7 | # +#+#+#+#+#+ +#+ # 8 | # Created: 2015/01/18 09:55:13 by yyang #+# #+# # 9 | #* Updated: 2016/01/19 00:16:54 by mtassett ### ########.fr *# 10 | # # 11 | # **************************************************************************** # 12 | # 13 | # **************************************************************************** # 14 | 15 | #=============================================================================== 16 | # REQUIRED CONFIGS 17 | #=============================================================================== 18 | 19 | # NAME = 20 | # RENDU_PATH_KEY = 21 | 22 | #=============================================================================== 23 | # DEFAULTS 24 | #=============================================================================== 25 | POST_PATTERN = "" 26 | CC_FLAGS = -g 27 | 28 | FRAMEWORK_PATH = ../testframework/v3/ 29 | RENDU_MAKE_ARG = re 30 | CONFIG_INI_PATH = ../config.ini 31 | PATTERN ?= spec.c$$ 32 | define FIRST_RULE 33 | make exec_tests 34 | endef 35 | 36 | ifeq ("$(RENDU_PATH)", "") 37 | RENDU_PATH ?= $(shell grep $(RENDU_PATH_KEY) $(CONFIG_INI_PATH) | cut -d '=' -f 2 | sed -E "s/^[ \"]*//" | sed -E "s/[ \"]*$$//") 38 | endif 39 | 40 | all: 41 | $(FIRST_RULE) 42 | 43 | #=============================================================================== 44 | # INCLUDES 45 | #=============================================================================== 46 | 47 | include Makefile_cfg.mk 48 | 49 | #=============================================================================== 50 | # COMMON 51 | #=============================================================================== 52 | TESTS_PATH = tests 53 | CC_LIBFT_LIB_DEFAULT = -L $(LIBFT_PATH) -lft 54 | CC_FRAMEWORK_LIB = -L$(FRAMEWORK_PATH) -lmt_framework 55 | CC_INCLUDES = -I . -I $(FRAMEWORK_PATH)/includes -I $(RENDU_PATH) -I $(RENDU_PATH)/includes -I $(RENDU_PATH)/includes/builtin -I $(RENDU_PATH)/libs/libtowel/includes -I $(RENDU_PATH)/libft/includes -I $(RENDU_PATH)/srcs/libft/includes 56 | TEST_FILES = $(shell find tests -name "*.spec.c" -type f -follow -print | grep $(PATTERN)) 57 | CC_SOURCE = $(TEST_FILES) main.c utils.c $(CC_SOURCE_EXTRA) 58 | LIBFT_PATH = $(RENDU_PATH)/libft 59 | ADD_TESTS = $(shell echo "$(TEST_FILES)" | perl -pe "s/.*?\/([^\/ ]*)\.spec\.c/MT_ADD_SUITE\(mt, \1, suite_\1); /g") 60 | PROTOTYPES = $(shell echo "$(TEST_FILES)" | perl -pe "s/.*?\/([^\/ ]*)\.spec\.c/MT_ADD_PROTO\(\1\); /g") 61 | CC_DEFINES = -D__MOULITEST__ -DPROTOTYPES="$(PROTOTYPES)" -DADD_TESTS="$(ADD_TESTS)" -DRENDU_PATH="\"$(RENDU_PATH)\"" 62 | 63 | 64 | C_DIR = $(RENDU_PATH)/srcs 65 | O_DIR = .tmp/objects 66 | 67 | CC_HEADERS = $(CC_INCLUDES) 68 | 69 | C_FILES = $(shell find $(C_DIR) -type f -follow -print | grep ".*\.c$$" | grep -v "\.spec\.c") 70 | C_DIRS = $(shell find $(C_DIR) -type d -follow -print) 71 | 72 | H_FILES = $(shell find $(RENDU_PATH)/includes -type f -follow -print | grep ".*\.h$$") 73 | O_DIRS = $(C_DIRS:$(C_DIR)%=$(O_DIR)%) 74 | O_FILES = $(C_FILES:$(C_DIR)%.c=$(O_DIR)%.o) 75 | CC_OPTIONS = -D__MOULITEST__ -g $(CC_HEADERS) $(CC_FLAGS_EXTRA) 76 | 77 | $(O_DIR)%.o: $(C_DIR)%.c $(H_FILES) 78 | @mkdir -p $(O_DIRS) $(O_DIR) 79 | @gcc $(CC_OPTIONS) $(CONFIG_EXTRA_H) $(LIB_TOWEL_INCLUDES) -o $@ -c $< \ 80 | && printf "." 81 | 82 | exec_tests: $(O_FILES) 83 | echo "$(TEST_FILES)" 84 | ifneq ("$(wildcard $(RENDU_PATH)/libft/Makefile)","") 85 | make $(RENDU_MAKE_ARG) -k -C $(LIBFT_PATH) 86 | $(eval CC_LIBFT_LIB = $(CC_LIBFT_LIB_DEFAULT)) 87 | endif 88 | ifneq ("$(wildcard $(RENDU_PATH)/Makefile)","") 89 | make $(RENDU_MAKE_ARG) -k -C $(RENDU_PATH) $(CC_LIBFT_LIB) 90 | endif 91 | make -k -C $(FRAMEWORK_PATH) 92 | $(CC) $(CC_FLAGS) $(CC_INCLUDES) $(CC_DEFINES) $(CC_SOURCE) $^ -o $(NAME) $(CC_FRAMEWORK_LIB) $(CC_LIBS) 93 | $(shell pwd)/$(NAME) 94 | 95 | clean: 96 | rm -f $(OBJECTS) 97 | 98 | fclean: clean 99 | make -k -C $(RENDU_PATH) fclean 100 | make -k -C $(FRAMEWORK_PATH) fclean 101 | rm -f $(NAME) 102 | 103 | re: clean fclean all project 104 | -------------------------------------------------------------------------------- /test_basic.txt: -------------------------------------------------------------------------------- 1 | Hello 2 | World 3 | -------------------------------------------------------------------------------- /test_basic_dino.txt: -------------------------------------------------------------------------------- 1 | Hello World, 2 | 3 | This file contains some very important things: Jurassic Park quotes. 4 | [1] - "Spared no expense." 5 | [2] - "Ah! Ah! Ah! You didn't say the magic word!" 6 | [3] - "Hold on to your butts." 7 | [4] - "What do you call a blind dinosaur? ... What? Doyouthinkhesarus. 8 | ... What do you call a blind dinosaurs dog? ... No idea. 9 | Doyouthinkhesarus Rex" 10 | [5] - "Huh haaaww eh he hawww ehh huh hawww" [Ian Malcom's Laugh] 11 | I hope you enjoyed this document... Or else. 12 | 13 | -------------------------------------------------------------------------------- /test_null_cases.txt: -------------------------------------------------------------------------------- 1 | What the fuck did you just fucking say about me, you little bitch? 2 | I’ll have you know I graduated top of my class in the Navy Seals, and I’ve been involved in numerous secret raids on Al-Quaeda, and I have over 300 confirmed kills. 3 | I am trained in gorilla warfare and I’m the top sniper in the entire US armed forces. 4 | You are nothing to me but just another target. 5 | I will wipe you the fuck out with precision the likes of which has never been seen before on this Earth, mark my fucking words. 6 | You think you can get away with saying that shit to me over the Internet? 7 | Think again, fucker. 8 | As we speak I am contacting my secret network of spies across the USA and your IP is being traced right now so you better prepare for the storm, maggot. 9 | The storm that wipes out the pathetic little thing you call your life. 10 | You’re fucking dead, kid. 11 | I can be anywhere, anytime, and I can kill you in over seven hundred ways, and that’s just with my bare hands. 12 | Not only am I extensively trained in unarmed combat, but I have access to the entire arsenal of the United States Marine Corps and I will use it to its full extent to wipe your miserable ass off the face of the continent, you little shit. 13 | If only you could have known what unholy retribution your little “clever” comment was about to bring down upon you, maybe you would have held your fucking tongue. 14 | But you couldn’t, you didn’t, and now you’re paying the price, you goddamn idiot. 15 | I will shit fury all over you and you will drown in it. 16 | You’re fucking dead, kiddo. -------------------------------------------------------------------------------- /timmy_test_a.txt: -------------------------------------------------------------------------------- 1 | "He can't go out! He shan't go out! 2 | He won't be safe!" she said - 3 | She sadly sighed and cried with doubt: 4 | "He'll stay inside instead! 5 | 6 | The world's a dark and dreadful 7 | place For tiny helpless boys - 8 | We have to make a safer space; 9 | A shielded life of joys!" 10 | 11 | "There's evil beasts at every bend, 12 | And danger waits ahead! 13 | It has to stop. It has to end. 14 | He can't go out!" she said. 15 | 16 | "Oh dearest darling wife of mine," The other whispered, sad: 17 | "Just let him go - and he'll be fine," Said Little Timmy's dad. 18 | 19 | So Little Timmy's mum agreed, And Timmy went outside. 20 | But Timmy met one of those kidnapping-rapist-pedo-meth-addicts that are everywhere nowadays. 21 | And Timmy fucking died. -------------------------------------------------------------------------------- /timmy_test_b.txt: -------------------------------------------------------------------------------- 1 | When Little Timmy took an 'E' 2 | To while away the night: 3 | 'I barely felt a thing,' said he, 4 | And spoke, 'this can't be right.' 5 | 6 | He waited half a second's span - 7 | A moment more, or two - 8 | And when, at last, the next began, 9 | He wondered what to do. 10 | 11 | 'Perhaps it takes a few before 12 | It settles in,' he sighed. 13 | So Timmy swallowed sixty more. 14 | 15 | And Timmy fucking died. -------------------------------------------------------------------------------- /timmy_test_interleave.txt: -------------------------------------------------------------------------------- 1 | Here are two poems from a reddit user /u/poem_for_your_sprog. 2 | They describe the life of a little boy named Timmy. 3 | 4 | =========== Poem A =========== 5 | =========== Poem B =========== 6 | ============ DONE ============ 7 | 8 | And now you know, the tale of little Timmy. 9 | What an asshole. --------------------------------------------------------------------------------