syle: norm

This commit is contained in:
airone01
2026-01-24 18:56:42 +01:00
parent 932732c1e5
commit 1ee5334149
17 changed files with 108 additions and 160 deletions

View File

@@ -10,16 +10,16 @@
/* */
/* ************************************************************************** */
#include "libunit.h"
#include "libft/libft.h"
#include "libunit.h"
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
static size_t interpret_status(int status, const char *fn_name
, char *test_name)
static size_t interpret_status(int status, const char *fn_name,
char *test_name)
{
ft_putstr_fd((char *) fn_name, 1);
ft_putstr_fd((char *)fn_name, 1);
ft_putstr_fd(" : ", 1);
ft_putstr_fd(test_name, 1);
ft_putstr_fd(" : ", 1);
@@ -45,13 +45,13 @@ static size_t interpret_status(int status, const char *fn_name
static void print_passed_test(size_t ok_tests, t_unit_test *test_list)
{
size_t total;
size_t total;
total = count_tests(test_list);
if (ok_tests == total)
ft_putstr_fd("\x1B[32m", 1);
else
ft_putstr_fd("\x1B[31m", 1);
total = count_tests(test_list);
if (ok_tests == total)
ft_putstr_fd("\x1B[32m", 1);
else
ft_putstr_fd("\x1B[31m", 1);
ft_putnbr_fd(ok_tests, 1);
ft_putchar_fd('/', 1);
ft_putnbr_fd((int)total, 1);
@@ -60,10 +60,10 @@ static void print_passed_test(size_t ok_tests, t_unit_test *test_list)
int launch_tests(t_unit_test *test_list, const char *fn_name)
{
size_t ok_tests;
pid_t wpid;
int status;
int i;
size_t ok_tests;
pid_t wpid;
int status;
int i;
ok_tests = 0;
i = -1;
@@ -79,8 +79,8 @@ int launch_tests(t_unit_test *test_list, const char *fn_name)
wpid = wait(&status);
if (wpid < 0)
return (1);
ok_tests += interpret_status(status, fn_name,
get_test_at(test_list, i)->title);
ok_tests += interpret_status(status, fn_name, get_test_at(test_list,
i)->title);
}
}
print_passed_test(ok_tests, test_list);

View File

@@ -6,12 +6,12 @@
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 14:38:40 by elagouch #+# #+# */
/* Updated: 2026/01/24 18:40:36 by elagouch ### ########.fr */
/* Updated: 2026/01/24 18:56:03 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef UTIL_UNIT_H
# define UTIL_UNIT_H
#ifndef LIBUNIT_H
# define LIBUNIT_H
# include "libft.h"
# include <sys/types.h>
@@ -66,4 +66,4 @@ void clear_tests(t_unit_test **head_ptr);
int launch_tests(t_unit_test *test_list,
const char *fn_name);
#endif // !UTIL_UNIT_H
#endif // !LIBUNIT_H