Releases: biralavor/42_pushswap
v0.5 Basic functions fully working
Basic Functions working, but with memory leaks
All basic functions are working!
void ft_swap(t_stack **stack);
void ft_swap_ab(t_stack **stack_a, t_stack **stack_b);
void ft_push_a(t_stack **stack_a, t_stack **stack_b);
void ft_push_b(t_stack **stack_a, t_stack **stack_b);
void ft_rotate(t_stack **stack);
void ft_rotate_ab(t_stack **stack_a, t_stack **stack_b);
void ft_reverse_rotate(t_stack **stack);
void ft_reverse_rotate_ab(t_stack **stack_a, t_stack **stack_b);
However, there is has some memory leaks T.T
Github Actions now working with CUnit, Valgrind and Norminette
Using CUnit
Now, I'm using the CUnit framework for building tests to my program: push_swap.
Using Valgrind with GitHub Actions
This is so awesome! The GitHub is checking memory leaks with Valgrind automatically.
TODO >> However, I fell that I will need to update this code to make return an error, if Valgrind found a memory leak. << TODO
Using Norminette with GitHub Actions
It is an amazing feeling after pushing new commits into the repo and having a norminette verification!
Github Actions now working - my own tester
I had write a super simplified tester, just to understand how Github Action works.
While I was into this endeavor, I had several issues:
- LIBFT not linking
- two main() functions -> my tester and my program to test
- CUnit not fully working
- and more...
So..., I tried to reduce scope. That's why I built my own tester.
This is the main code, after spliting the functions and main at my program to test:
#include <stdio.h>
#include "push_swap.h"
#include "../../program_to_test/src/push_functions.c"
void test_pushadd_5plus4()
{
// ARRANGE
int actual_result;
int expected_result = 9;
// ACT
actual_result = push_add(5, 4);
// ASSERT
if (expected_result != actual_result)
{
ft_error_msg("Test failed: test_pushadd_5plus4\n");
}
}
void test_pushsubtract_5minus3()
{
// ARRANGE
int actual_result;
int expected_result = 2;
// ACT
actual_result = push_subtract(5, 3);
// ASSERT
if (expected_result != actual_result)
{
ft_error_msg("Test failed: test_pushsubtract_5minus3\n");
}
}
int main(void)
{
int index;
index = 0;
ft_printf("\033[0;36m");
ft_printf("Runing test [%d] test_pushadd_5plus4\n", ++index);
test_pushadd_5plus4();
ft_printf("Runing test [%d] test_pushsubtract_5minus3\n", ++index);
test_pushsubtract_5minus3();
ft_printf("All tests passed\n");
return (0);
}
Github Actions runnning, but...
I have successfully configured the GitHub Actions to:
- Call a Makefile tester, that:
- Calls another Makefile named of
push_swap
, that needs to:- Call another Makefile named of
libft.a
- Call another Makefile named of
- Calls another Makefile named of
However, as my file test_main.c
has another main(), the compiler didn't run the last step ./tester
, which it usually prohibited
So, now, I'll try to install and use the framework for testing called: CUnit