feat/stdout (#3)

* feat: disable standard output for tests

* fuck les fds

* patch some complation issues

* style: norm

* feat: timeout

* fix: patc more stuff

* fix: patch merge

* feat: more tests
This commit is contained in:
Erwann Lagouche
2026-01-25 16:43:39 +01:00
committed by GitHub
parent 442619f4cb
commit cf491b279d
30 changed files with 332 additions and 132 deletions

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 16:22:35 by dgaillet #+# #+# */
/* Updated: 2026/01/24 16:22:36 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:32:35 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,10 +18,10 @@ int atoi_launcher(void)
size_t res;
testlist = NULL;
load_test(&testlist, "Basic test", &atoi_basic_test);
load_test(&testlist, "INT MAX test", &atoi_int_max_test);
load_test(&testlist, "INT MIN test", &atoi_int_min_test);
load_test(&testlist, "NULL test", &atoi_null_test);
load_test(&testlist, "Basic test", &atoi_basic_test, 0);
load_test(&testlist, "INT MAX test", &atoi_int_max_test, 0);
load_test(&testlist, "INT MIN test", &atoi_int_min_test, 0);
load_test(&testlist, "NULL test", &atoi_null_test, 0);
res = launch_tests(testlist, "atoi");
clear_tests(&testlist);
return (res);

View File

@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 01_ok.c :+: :+: :+: */
/* 01_basic.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 17:22:48 by dgaillet #+# #+# */
/* Updated: 2026/01/24 17:22:51 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:33:19 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,5 +15,5 @@
int atoi_basic_test(void)
{
return (ft_atoi("42") == 42);
return (!(ft_atoi("42") == 42));
}

View File

@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 02_ko.c :+: :+: :+: */
/* 02_int_max.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 17:23:00 by dgaillet #+# #+# */
/* Updated: 2026/01/24 17:23:01 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:33:35 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int atoi_int_max_test(void)
{
return (ft_atoi("2147483647") == 2147483647);
return (!(ft_atoi("2147483647") == 2147483647));
}

View File

@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 03_sigsegv.c :+: :+: :+: */
/* 03_int_min.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 17:23:10 by dgaillet #+# #+# */
/* Updated: 2026/01/24 17:23:11 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:33:46 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int atoi_int_min_test(void)
{
return (ft_atoi("-2147483648") == -2147483648);
return (!(ft_atoi("-2147483648") == -2147483648));
}

View File

@@ -6,7 +6,7 @@
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:32:32 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:34:12 by elagouch ### ########.fr */
/* Updated: 2026/01/25 15:13:57 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,9 +18,9 @@ int strlen_launcher(void)
size_t res;
testlist = NULL;
load_test(&testlist, "null", &test_null);
load_test(&testlist, "basic", &test_basic);
load_test(&testlist, "large", &test_large);
load_test(&testlist, "null", &test_null, 0);
load_test(&testlist, "basic", &test_basic, 0);
load_test(&testlist, "large", &test_large, 0);
res = launch_tests(testlist, "strlen");
clear_tests(&testlist);
return (res);

View File

@@ -6,7 +6,7 @@
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:17:14 by elagouch ### ########.fr */
/* Updated: 2026/01/25 15:16:59 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int test_basic(void)
{
return (ft_strlen("hello, world") == 12);
return (!(ft_strlen("hello, world") == 12));
}

View File

@@ -6,7 +6,7 @@
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:17:04 by elagouch ### ########.fr */
/* Updated: 2026/01/25 15:16:28 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int test_null(void)
{
return (ft_strlen(NULL) == 0);
return (!(ft_strlen(NULL) == 0));
}

View File

@@ -6,7 +6,7 @@
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:36:42 by elagouch ### ########.fr */
/* Updated: 2026/01/25 15:16:42 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -23,5 +23,5 @@ int test_large(void)
s[i] = ' ';
i++;
}
return (ft_strlen(s) == sizeof(s) + 1);
return (!(ft_strlen(s) == sizeof(s) + 1));
}

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/25 12:05:05 by dgaillet #+# #+# */
/* Updated: 2026/01/25 12:05:17 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:35:04 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -18,9 +18,9 @@ int strncmp_launcher(void)
size_t res;
testlist = NULL;
load_test(&testlist, "Basic test", &strncmp_basic_test);
load_test(&testlist, "Len test", &strncmp_len_test);
load_test(&testlist, "High len test", &strncmp_high_len_test);
load_test(&testlist, "Basic test", &strncmp_basic_test, 0);
load_test(&testlist, "Len test", &strncmp_len_test, 0);
load_test(&testlist, "High len test", &strncmp_high_len_test, 0);
res = launch_tests(testlist, "ft_strncmp");
clear_tests(&testlist);
return (res);

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/25 12:05:24 by dgaillet #+# #+# */
/* Updated: 2026/01/25 12:05:25 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 15:15:39 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int strncmp_basic_test(void)
{
return (!ft_strncmp("test", "test", 4));
return (ft_strncmp("test", "test", 4));
}

View File

@@ -1,12 +1,12 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 02_ko.c :+: :+: :+: */
/* 02_len.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/25 12:05:30 by dgaillet #+# #+# */
/* Updated: 2026/01/25 12:05:32 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:34:24 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int strncmp_len_test(void)
{
return (!ft_strncmp("test123", "test", 4));
return (ft_strncmp("test123", "test", 4));
}

View File

@@ -6,7 +6,7 @@
/* By: dgaillet <dgaillet@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/25 16:01:01 by dgaillet #+# #+# */
/* Updated: 2026/01/25 16:01:03 by dgaillet ### ########lyon.fr */
/* Updated: 2026/01/25 16:35:34 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,5 +14,5 @@
int strncmp_high_len_test(void)
{
return (!ft_strncmp("test", "test", 42));
return (ft_strncmp("test", "test", 42));
}