ca fait bcp la non
This commit is contained in:
29
tests/libunit/00_launcher.c
Normal file
29
tests/libunit/00_launcher.c
Normal 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
16
tests/libunit/01_ok.c
Normal 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
15
tests/libunit/02_ko.c
Normal 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);
|
||||
}
|
||||
18
tests/libunit/03_sigsegv.c
Normal file
18
tests/libunit/03_sigsegv.c
Normal 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
18
tests/libunit/04_sigbus.c
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user