remove test_one

This commit is contained in:
2026-01-14 13:59:05 +01:00
parent 78ec8a3fa4
commit c2e7da01f4
3 changed files with 26 additions and 42 deletions

View File

@@ -26,7 +26,7 @@ INCLUDES = includes
# ALL FILES WITHOUT PATH
#============================
SRC = main.c test_one.c ft_putnbr.c secure_write.c
SRC = main.c ft_putnbr.c secure_write.c
INSERTION = insertion.c

26
main.c
View File

@@ -16,6 +16,30 @@
#include "flags.h"
#include <unistd.h>
static int push_swap(char **tab, int len, int mod)
{
t_stacks *stacks;
stacks = NULL;
if (mod == -1)
return (0);
stacks = init_stacks(len, tab, mod);
indexer(stacks);
if (!stacks)
return (0);
if (check_order(stacks->a))
{
free_all(stacks);
return (0);
}
stacks->disorder = compute_disorder(tab, wich_mod(mod));
flags(pos_flag(tab, mod), pos_bench(tab, mod), tab, stacks);
if (stacks->bench == 1)
print_bench(stacks);
free_all(stacks);
return (0);
}
int main(int argc, char **argv)
{
char **tab;
@@ -30,7 +54,7 @@ int main(int argc, char **argv)
len = len_split(tab);
mod = calcul_mod(len, tab);
if (check_error(tab, mod))
test1(tab, len, mod);
push_swap(tab, len, mod);
else
write(2, "Error\n", 6);
free_tab(tab);

View File

@@ -1,40 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* test_one.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mteriier <mteriier@student.lyon42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/12/22 12:33:58 by mteriier #+# #+# */
/* Updated: 2026/01/08 15:35:43 by dgaillet ### ########lyon.fr */
/* */
/* ************************************************************************** */
#include "push_swap.h"
#include "flags.h"
#include "parsing.h"
#include "medium_headers.h"
int test1(char **tab, int len, int mod)
{
t_stacks *stacks;
stacks = NULL;
if (mod == -1)
return (0);
stacks = init_stacks(len, tab, mod);
indexer(stacks);
if (!stacks)
return (0);
if (check_order(stacks->a))
{
free_all(stacks);
return (0);
}
stacks->disorder = compute_disorder(tab, wich_mod(mod));
flags(pos_flag(tab, mod), pos_bench(tab, mod), tab, stacks);
if (stacks->bench == 1)
print_bench(stacks);
free_all(stacks);
return (0);
}