ca fait bcp la non

This commit is contained in:
airone01
2026-01-24 16:20:53 +01:00
parent 1b48b0bb13
commit 6e652d3b24
20 changed files with 232 additions and 40 deletions

View File

@@ -0,0 +1,29 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 00_launcher.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:32:32 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:16:24 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include "../tests.h"
int libunit_launcher(void) {
t_unit_test *testlist;
size_t res;
testlist = NULL;
load_test(&testlist, "successful", &test_ok);
load_test(&testlist, "unsuccessful", &test_ko);
load_test(&testlist, "sigsegv", &test_ko);
load_test(&testlist, "sigbus", &test_ko);
res = launch_tests(testlist, "libunit");
clear_tests(&testlist);
return (res);
}

16
tests/libunit/01_ok.c Normal file
View File

@@ -0,0 +1,16 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 01_ok.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:16:32 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
int test_ok(void)
{
return (1);
}

15
tests/libunit/02_ko.c Normal file
View File

@@ -0,0 +1,15 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 02_ko.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:16:37 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
int test_ko(void) {
return (0);
}

View File

@@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 03_sigsegv.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:19:43 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include <signal.h>
int test_sigsegv(void) {
raise(SIGSEGV);
return (1);
}

18
tests/libunit/04_sigbus.c Normal file
View File

@@ -0,0 +1,18 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 04_sigbus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/24 16:19:50 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include <signal.h>
int test_sigbus(void) {
raise(SIGBUS);
return (1);
}