style: norm

This commit is contained in:
airone01
2026-01-24 14:39:08 +01:00
parent dda5944890
commit 74ccfde56e
2 changed files with 125 additions and 67 deletions

View File

@@ -1,32 +1,45 @@
#ifndef UTIL_UNIT_H
#define UTIL_UNIT_H
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* util_unit.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 14:38:40 by elagouch #+# #+# */
/* Updated: 2026/01/24 14:38:41 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft/libft.h"
#include <sys/types.h>
#include <unistd.h>
#ifndef UTIL_UNIT_H
# define UTIL_UNIT_H
# include "libft/libft.h"
# include <sys/types.h>
# include <unistd.h>
/**
* @brief singular unit test def
*/
typedef struct s_unit_test {
char *title;
int (*func)(void);
struct s_unit_test *next;
} t_unit_test;
typedef struct s_unit_test
{
char *title;
int (*func)(void);
struct s_unit_test *next;
} t_unit_test;
/**
* @brief finds a test at index
*
* @return test or NULL
*/
t_unit_test *get_test_at(t_unit_test *head, size_t target_idx);
t_unit_test *get_test_at(t_unit_test *head, size_t target_idx);
/**
* @brief count tests
*
* @return size_t test count
*/
size_t count_tests(t_unit_test *head);
size_t count_tests(t_unit_test *head);
/**
* @brief adds a new test
@@ -39,12 +52,12 @@ size_t count_tests(t_unit_test *head);
*
* @return -1 on error, 0 on success
*/
size_t load_test(t_unit_test **head_ptr, const char *title,
int (*test_func)(void));
size_t load_test(t_unit_test **head_ptr, const char *title,
int (*test_func)(void));
/**
* @brief clears the tests memory
*/
void clear_tests(t_unit_test **head_ptr);
void clear_tests(t_unit_test **head_ptr);
#endif // !UTIL_UNIT_H