Skip to content

Commit

Permalink
Now working but norminette fails (#23)
Browse files Browse the repository at this point in the history
* adding working version files

* repalcing is_space to is_blank (to add 'tab')

* replacing sort-5 to sort-4

* applying ft_is_blank, instead of is_space

* protecting if list_size is 1

* applying sort_four_or_more

* protecting null pointer

* removing unused functions and updating function names

* updating function names and files

* applying norminette

* removing sort B, after push_b

* moving tester files and aplications
  • Loading branch information
biralavor authored Jul 5, 2024
1 parent 8f28318 commit 435d2a7
Show file tree
Hide file tree
Showing 1,170 changed files with 108 additions and 115 deletions.
2 changes: 1 addition & 1 deletion _ci_tdd/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/05/10 10:09:44 by umeneses #+# #+# #
# Updated: 2024/06/27 17:02:35 by umeneses ### ########.fr #
# Updated: 2024/07/04 15:53:05 by umeneses ### ########.fr #
# #
# **************************************************************************** #

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
# E por fim, vários testes./p com 10 números
# Pode por quantos números quiser
# Mas na régua só será testado: [3, 5, 100, 500]
test_groups = [3, 5, 10, 15, 100, 500]
#test_groups = [3, 4, 5, 10, 15, 100, 500]
test_groups = [3, 4, 5, 10, 15, 100, 500]
#test_groups = range(1, 5)

# -7 -4 -1 -6 3 2 -5 -3 1 -2
Expand All @@ -43,7 +44,7 @@
# números do `test_groups`
# Se colocar muito, vai demorar demais para acabar
# Padrão = 100
test_num = 100
test_num = 10


# Daqui para baixo não precisa mexer
Expand Down
36 changes: 36 additions & 0 deletions _ci_tdd/test_files/print_stack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "push_swap.h"

#include <stdio.h>

void print_stack(t_stack *a, t_stack *b)
{
t_stack *aux;

(void)a;
aux = a;
fprintf(stderr, "\n\n");
fprintf(stderr, "|----------|\n");
fprintf(stderr, "| stack a: |\n");
fprintf(stderr, "|-------|--|-----------|---------------|--------|--------|----------------|\n");
fprintf(stderr, "| value | sorted index | current index | cost_a | cost_b | next |\n");
fprintf(stderr, "|-------|--------------|---------------|--------|--------|----------------|\n");
while (aux)
{
fprintf(stderr, "| %5d | %12d | %13d | %6d | %6d | %14p |\n", aux->nbr, aux->final_pos, aux->origin, aux->cost_a, aux->cost_b, aux->next);
aux = aux->next;
}
fprintf(stderr, "|-------|--------------|---------------|--------|--------|----------------|\n\n");
aux = b;
fprintf(stderr, "|----------|\n");
fprintf(stderr, "| stack b: |\n");
fprintf(stderr, "|-------|--|-----------|---------------|--------|--------|----------------|\n");
fprintf(stderr, "| value | sorted index | current index | cost_a | cost_b | next |\n");
fprintf(stderr, "|-------|--------------|---------------|--------|--------|----------------|\n");
while (aux)
{
fprintf(stderr, "| %5d | %12d | %13d | %6d | %6d | %14p |\n", aux->nbr, aux->final_pos, aux->origin, aux->cost_a, aux->cost_b, aux->next);
aux = aux->next;
}
fprintf(stderr, "|-------|--------------|---------------|--------|--------|----------------|\n");
fflush(stderr);
}
23 changes: 7 additions & 16 deletions _ci_tdd/test_files/test_main_miunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/09 19:06:12 by umeneses #+# #+# */
/* Updated: 2024/07/04 19:03:09 by umeneses ### ########.fr */
/* Updated: 2024/07/05 12:05:10 by umeneses ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -31,17 +31,14 @@
#include "../../program_to_test/src/ft_do_sort.c"
#include "../../program_to_test/src/ft_do_move_with_cost.c"
#include "../../program_to_test/src/ft_sort_until3.c"
#include "../../program_to_test/src/ft_sort_until4.c"
#include "../../program_to_test/src/ft_sort_5_or_more.c"
#include "../../program_to_test/src/ft_sort_4_or_more.c"
#include "../../program_to_test/src/ft_sort_4_utils.c"

// TODO:
// optimize sorting method for more than 6 numbers

int ft_minunit_array_counter(char **array);
void ft_array_clear(char **array, int arr_size);
void ft_array_printer(char **array, int arr_size);


MU_TEST(test_3neg_min_at_thrid_pos_big_nbrs_v02)
{
// ARRANGE
Expand Down Expand Up @@ -905,7 +902,6 @@ MU_TEST(test_sort_four_nbrs_v05)
mu_assert_int_eq(expected_bottom_a, actual_bottom_a);
mu_assert_int_eq(expected_size, actual_size);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size);
}

Expand Down Expand Up @@ -934,7 +930,7 @@ MU_TEST(test_sort_four_nbrs_v04)

stack_a = ft_lts_buildstack_argv(&stack_a, argv_simulation);
ft_lst_map_all_indexers(&stack_a);
ft_sort_four_nbrs(&stack_a, &stack_b);
ft_sort_four_or_more_nbr(&stack_a, &stack_b);
actual_top_a = ft_lst_goto_head(stack_a)->nbr;
actual_bottom_a = ft_lst_goto_end(stack_a)->nbr;
actual_size = ft_lst_size(stack_a);
Expand All @@ -944,7 +940,6 @@ MU_TEST(test_sort_four_nbrs_v04)
mu_assert_int_eq(expected_bottom_a, actual_bottom_a);
mu_assert_int_eq(expected_size, actual_size);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size);
}

Expand Down Expand Up @@ -973,7 +968,7 @@ MU_TEST(test_sort_four_nbrs_v03)

stack_a = ft_lts_buildstack_argv(&stack_a, argv_simulation);
ft_lst_map_all_indexers(&stack_a);
ft_sort_four_nbrs(&stack_a, &stack_b);
ft_sort_four_or_more_nbr(&stack_a, &stack_b);
actual_top_a = ft_lst_goto_head(stack_a)->nbr;
actual_bottom_a = ft_lst_goto_end(stack_a)->nbr;
actual_size = ft_lst_size(stack_a);
Expand All @@ -983,7 +978,6 @@ MU_TEST(test_sort_four_nbrs_v03)
mu_assert_int_eq(expected_bottom_a, actual_bottom_a);
mu_assert_int_eq(expected_size, actual_size);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size);
}

Expand Down Expand Up @@ -1012,7 +1006,7 @@ MU_TEST(test_sort_four_nbrs_v02)

stack_a = ft_lts_buildstack_argv(&stack_a, argv_simulation);
ft_lst_map_all_indexers(&stack_a);
ft_sort_four_nbrs(&stack_a, &stack_b);
ft_sort_four_or_more_nbr(&stack_a, &stack_b);
actual_top_a = ft_lst_goto_head(stack_a)->nbr;
actual_bottom_a = ft_lst_goto_end(stack_a)->nbr;
actual_size = ft_lst_size(stack_a);
Expand All @@ -1022,7 +1016,6 @@ MU_TEST(test_sort_four_nbrs_v02)
mu_assert_int_eq(expected_bottom_a, actual_bottom_a);
mu_assert_int_eq(expected_size, actual_size);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size);
}

Expand Down Expand Up @@ -1051,7 +1044,7 @@ MU_TEST(test_sort_four_nbrs_v01)

stack_a = ft_lts_buildstack_argv(&stack_a, argv_simulation);
ft_lst_map_all_indexers(&stack_a);
ft_sort_four_nbrs(&stack_a, &stack_b);
ft_sort_four_or_more_nbr(&stack_a, &stack_b);
actual_top_a = ft_lst_goto_head(stack_a)->nbr;
actual_bottom_a = ft_lst_goto_end(stack_a)->nbr;
actual_size = ft_lst_size(stack_a);
Expand All @@ -1061,7 +1054,6 @@ MU_TEST(test_sort_four_nbrs_v01)
mu_assert_int_eq(expected_bottom_a, actual_bottom_a);
mu_assert_int_eq(expected_size, actual_size);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size);
}

Expand Down Expand Up @@ -1125,7 +1117,6 @@ MU_TEST(test_2nd_miastep_push_b_all_but3_sort_a)
mu_assert_int_eq(expected_top_a_before_push, actual_top_a_before_push);
mu_assert_int_eq(expected_bottom_a_before_push, actual_bottom_a_before_push);
ft_lstclear_single_ptr(stack_a);
ft_lstclear_single_ptr(stack_b);
ft_array_clear(argv_simulation, expected_size_before_push);
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Submodule catch2-src updated from 000000 to c4e376
Submodule imgui-sfml-src updated from 000000 to 82dc20
Submodule imgui-src updated from 000000 to 35b114
Loading

0 comments on commit 435d2a7

Please sign in to comment.