feat: finally tests
This commit is contained in:
28
tests/ft_strlen/00_launcher.c
Normal file
28
tests/ft_strlen/00_launcher.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 00_launcher.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "../../util_unit.h"
|
||||
#include "../tests.h"
|
||||
|
||||
int strlen_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);
|
||||
}
|
||||
17
tests/ft_strlen/01_basic_test.c
Normal file
17
tests/ft_strlen/01_basic_test.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 01_basic_test.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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int test_basic(void) {
|
||||
return (ft_strlen("hello, world") == 12);
|
||||
}
|
||||
17
tests/ft_strlen/02_null_test.c
Normal file
17
tests/ft_strlen/02_null_test.c
Normal file
@@ -0,0 +1,17 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* 02_null_test.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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
|
||||
int test_null(void) {
|
||||
return (ft_strlen(NULL) == 0);
|
||||
}
|
||||
18
tests/main.c
Normal file
18
tests/main.c
Normal file
@@ -0,0 +1,18 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* main.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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "tests.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
strlen_launcher();
|
||||
}
|
||||
23
tests/tests.h
Normal file
23
tests/tests.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* tests.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* 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 */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TESTS_H
|
||||
# define TESTS_H
|
||||
|
||||
// LAUNCHERS
|
||||
int strlen_launcher(void);
|
||||
|
||||
// strlen
|
||||
int test_basic(void);
|
||||
int test_null(void);
|
||||
|
||||
#endif // !TESTS_H
|
||||
Reference in New Issue
Block a user