ca fait bcp la non
This commit is contained in:
@@ -6,22 +6,24 @@
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:32:32 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 15:44:00 by elagouch ### ########.fr */
|
||||
/* Updated: 2026/01/24 16:16:24 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../util_unit.h"
|
||||
#include "../tests.h"
|
||||
|
||||
int strlen_launcher(void)
|
||||
{
|
||||
t_unit_test *testlist;
|
||||
size_t res;
|
||||
int libunit_launcher(void) {
|
||||
t_unit_test *testlist;
|
||||
size_t res;
|
||||
|
||||
testlist = NULL;
|
||||
load_test(&testlist, "null test", &test_null);
|
||||
load_test(&testlist, "basic test", &test_basic);
|
||||
res = launch_tests(testlist, "strlen");
|
||||
clear_tests(&testlist);
|
||||
return (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);
|
||||
}
|
||||
@@ -1,18 +1,16 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 02_null_test.c :+: :+: :+: */
|
||||
/* 01_ok.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 15:40:42 by elagouch ### ########.fr */
|
||||
/* Updated: 2026/01/24 16:16:32 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int test_null(void)
|
||||
int test_ok(void)
|
||||
{
|
||||
return (ft_strlen(NULL) == 0);
|
||||
return (1);
|
||||
}
|
||||
@@ -1,18 +1,15 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.c :+: :+: :+: */
|
||||
/* 02_ko.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:40:58 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 15:41:56 by elagouch ### ########.fr */
|
||||
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 16:16:37 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
strlen_launcher();
|
||||
int test_ko(void) {
|
||||
return (0);
|
||||
}
|
||||
@@ -1,18 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 01_basic_test.c :+: :+: :+: */
|
||||
/* 03_sigsegv.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 15:39:06 by elagouch ### ########.fr */
|
||||
/* Updated: 2026/01/24 16:19:43 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <signal.h>
|
||||
|
||||
int test_basic(void)
|
||||
{
|
||||
return (ft_strlen("hello, world") == 12);
|
||||
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);
|
||||
}
|
||||
@@ -6,18 +6,26 @@
|
||||
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2026/01/24 15:32:30 by elagouch #+# #+# */
|
||||
/* Updated: 2026/01/24 15:41:32 by elagouch ### ########.fr */
|
||||
/* Updated: 2026/01/24 16:16:20 by elagouch ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TESTS_H
|
||||
# define TESTS_H
|
||||
|
||||
# include "libunit.h"
|
||||
|
||||
// LAUNCHERS
|
||||
int strlen_launcher(void);
|
||||
int strlen_launcher(void);
|
||||
|
||||
// libunit
|
||||
int test_ok(void);
|
||||
int test_ko(void);
|
||||
int test_sigsegv(void);
|
||||
int test_sigbus(void);
|
||||
|
||||
// strlen
|
||||
int test_basic(void);
|
||||
int test_null(void);
|
||||
int test_basic(void);
|
||||
int test_null(void);
|
||||
|
||||
#endif // !TESTS_H
|
||||
|
||||
Reference in New Issue
Block a user