Skip to content

Commit

Permalink
testing new function - ft_lstend_int
Browse files Browse the repository at this point in the history
  • Loading branch information
biralavor committed May 20, 2024
1 parent b060ffa commit 999b98b
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion _ci_tdd/test_files/test_main_miunit.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,39 @@
/* By: umeneses <umeneses@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/09 19:06:12 by umeneses #+# #+# */
/* Updated: 2024/05/13 16:10:15 by umeneses ### ########.fr */
/* Updated: 2024/05/20 12:36:49 by umeneses ### ########.fr */
/* */
/* ************************************************************************** */

#include "minunit.h"
#include "push_swap.h"
#include "../../program_to_test/src/push_functions.c"

MU_TEST(test_swap_a)
{
// ARRANGE
int top = 5;
int bottom = 11;
int actual_result;
int expected_result;
t_stack_a *stack_a;

stack_a = (t_stack_a *)ft_calloc(1, sizeof(t_stack_a));
stack_a->next = NULL;
stack_a->prev = NULL;
stack_a->nbr = top;
expected_result = bottom;

// ACT
stack_a = ft_lstend_int(stack_a, top);
stack_a = ft_lstend_int(stack_a, bottom);
swap_a(&stack_a);
actual_result = stack_a->nbr;

// ASSERT
mu_assert_int_eq(expected_result, actual_result);
}

MU_TEST(test_pushadd_5plus4)
{
// ARRANGE
Expand Down Expand Up @@ -44,6 +69,7 @@ MU_TEST_SUITE(first_tests)
{
MU_RUN_TEST(test_pushadd_5plus4);
MU_RUN_TEST(test_pushsubtract_5minus3);
MU_RUN_TEST(test_swap_a);
}

int main(void)
Expand Down

0 comments on commit 999b98b

Please sign in to comment.