mirror of
https://github.com/DavidGailleton/42-Push_Swap.git
synced 2026-01-27 00:41:57 +00:00
62 lines
1.8 KiB
C
62 lines
1.8 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* test_one.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: mteriier <mteriier@student.lyon42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2025/12/22 12:33:58 by mteriier #+# #+# */
|
|
/* Updated: 2025/12/22 12:34:35 by mteriier ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "push_swap.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
|
|
int test1(int argc, char **argv)
|
|
{
|
|
t_stacks *piles;
|
|
t_tab *preset;
|
|
|
|
piles = NULL;
|
|
if (argc > 1)
|
|
{
|
|
piles = init_big_stacks(argc, argv);
|
|
preset = get_tabs(piles->a, range_bucket(piles->a));
|
|
bucket_algo(piles, preset, range_bucket(piles->a));
|
|
}
|
|
if (piles->a)
|
|
stack_clear_all(piles->a, piles->a);
|
|
if (piles->b)
|
|
stack_clear_all(piles->b, piles->b);
|
|
free(piles);
|
|
return (0);
|
|
}
|
|
|
|
int test2(char **argv)
|
|
{
|
|
int *tab;
|
|
int len;
|
|
t_tab *preset;
|
|
t_stacks *piles;
|
|
|
|
len = ft_atoi(argv[2]);
|
|
if (len < 1)
|
|
{
|
|
printf("WRONG LEN PLS BE SMART.\n");
|
|
return (0);
|
|
}
|
|
tab = auto_shuffle(len);
|
|
piles = init_big_stacks2(tab, len);
|
|
preset = get_tabs(piles->a, range_bucket(piles->a));
|
|
bucket_algo(piles, preset, range_bucket(piles->a));
|
|
free(tab);
|
|
if (piles->a)
|
|
stack_clear_all(piles->a, piles->a);
|
|
if (piles->b)
|
|
stack_clear_all(piles->b, piles->b);
|
|
free(piles);
|
|
return (0);
|
|
}
|