From c2e7da01f4339c5a7274d343a57ad1a6a25da48e Mon Sep 17 00:00:00 2001 From: David GAILLETON Date: Wed, 14 Jan 2026 13:59:05 +0100 Subject: [PATCH] remove test_one --- Makefile | 2 +- main.c | 26 +++++++++++++++++++++++++- test_one.c | 40 ---------------------------------------- 3 files changed, 26 insertions(+), 42 deletions(-) delete mode 100644 test_one.c diff --git a/Makefile b/Makefile index e1662ef..8a19551 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/main.c b/main.c index b4e75b5..44544dd 100644 --- a/main.c +++ b/main.c @@ -16,6 +16,30 @@ #include "flags.h" #include +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); diff --git a/test_one.c b/test_one.c deleted file mode 100644 index 885422b..0000000 --- a/test_one.c +++ /dev/null @@ -1,40 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* test_one.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: mteriier +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* 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); -}