...seems ok this time ^^"

corrected stack checker in checker
This commit is contained in:
Tanguy MAZE 2019-03-18 14:42:32 +01:00
parent 558f8edfab
commit e0f584fd30
2 changed files with 8 additions and 4 deletions

View File

@ -6,7 +6,7 @@
# By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ # # By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2019/02/23 14:30:57 by tmaze #+# #+# # # Created: 2019/02/23 14:30:57 by tmaze #+# #+# #
# Updated: 2019/03/17 15:11:39 by tmaze ### ########.fr # # Updated: 2019/03/18 14:27:44 by tmaze ### ########.fr #
# # # #
#******************************************************************************# #******************************************************************************#
@ -103,6 +103,7 @@ clean :
fclean : clean fclean : clean
@echo -e "$(RED)===> $(GRE)$(NAME) : $(RED) Delete Binary File <===$(DEF)" @echo -e "$(RED)===> $(GRE)$(NAME) : $(RED) Delete Binary File <===$(DEF)"
@$(RM) -f $(NAME1) $(NAME2) @$(RM) -f $(NAME1) $(NAME2)
@$(RM) -rf *.dSYM
@$(MAKE) -C $(LIBDIR) fclean @$(MAKE) -C $(LIBDIR) fclean
re : fclean default re : fclean default

View File

@ -6,7 +6,7 @@
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */ /* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2019/02/23 13:35:15 by tmaze #+# #+# */ /* Created: 2019/02/23 13:35:15 by tmaze #+# #+# */
/* Updated: 2019/03/17 17:24:43 by tmaze ### ########.fr */ /* Updated: 2019/03/18 12:28:54 by tmaze ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -46,7 +46,7 @@ void exec_actions(t_psdata *data)
nop = data->op; nop = data->op;
while (nop && (buff = (char*)nop->content)) while (nop && (buff = (char*)nop->content))
{ {
if (ft_strcmp(buff, "rra") == 0 || ft_strcmp(buff, "rrn") == 0) if (ft_strcmp(buff, "rra") == 0 || ft_strcmp(buff, "rrb") == 0)
ps_rerot(data, buff[2]); ps_rerot(data, buff[2]);
else if (ft_strcmp(buff, "rrr") == 0) else if (ft_strcmp(buff, "rrr") == 0)
ps_rrerot(data); ps_rrerot(data);
@ -98,9 +98,10 @@ void check_stack(t_psdata *data)
int nb; int nb;
ind = data->a; ind = data->a;
if (ind)
nb = ind->nb;
while (ind) while (ind)
{ {
nb = ind->nb;
if (ind->nb < nb || data->size_b > 0) if (ind->nb < nb || data->size_b > 0)
{ {
ft_putendl("KO"); ft_putendl("KO");
@ -111,6 +112,8 @@ void check_stack(t_psdata *data)
} }
if (!ind && data->size_b == 0) if (!ind && data->size_b == 0)
ft_putendl("OK"); ft_putendl("OK");
else
ft_putendl("KO");
} }
int main(int ac, char **av) int main(int ac, char **av)