Skip to content

Releases: biralavor/42_pushswap

v0.5 Basic functions fully working

28 May 21:50
Compare
Choose a tag to compare

All basic functions are now ready for production

Screenshot from 2024-05-28 18-52-56

All memory leaks were solved \o/

Screenshot from 2024-05-28 18-53-53

Next Steps:

  • capture client arguments (argc + argv) at terminal from main()
  • update Makefile to simulate client argument inputs

Basic Functions working, but with memory leaks

24 May 13:27
30d267a
Compare
Choose a tag to compare

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);

Screenshot from 2024-05-24 10-21-04

However, there is has some memory leaks T.T

Screenshot from 2024-05-24 10-26-56

Github Actions now working with CUnit, Valgrind and Norminette

22 May 17:08
3f230e0
Compare
Choose a tag to compare

Using CUnit

Now, I'm using the CUnit framework for building tests to my program: push_swap.
Screenshot from 2024-05-22 13-56-35

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
Screenshot from 2024-05-22 14-03-06

Using Norminette with GitHub Actions

It is an amazing feeling after pushing new commits into the repo and having a norminette verification!
Screenshot from 2024-05-22 14-03-56

Github Actions now working - my own tester

13 May 19:08
Compare
Choose a tag to compare

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...

10 May 16:20
Compare
Choose a tag to compare

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

image

However, as my file test_main.c has another main(), the compiler didn't run the last step ./tester, which it usually prohibited
image

So, now, I'll try to install and use the framework for testing called: CUnit