Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

patrick-hacks/libft-pain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libft-pain

Pain

Libft tester trying to make sure no test cases get unnoticed and focussing on a good user experience :P

Usage

libft folder either inside the test directory or one directory above:

├─ libft/
│  ├─ ft_atoi.c
│  ├─ ft_itoa.c
│  ├─ ft_split.c
├─ libft-pain/
│  ├─ pain.sh

If you are not familiar with cmake run pain.sh

Install C++ TestMate extension for Vscode!

Click on the button on the left: image

Don't forget to recompile once you edit your libft files!

Advanced Usage

in the build directory, you can run ctest to run a specific test, with output you can run ctest -L split --output-on-failure For a full list of options, check out: https://cmake.org/cmake/help/latest/manual/ctest.1.html

build/Testing/LastTest.log shows you the detailed output of the last test

Leaks on ft_split

A lot of people have a hard time figuring out why/where ft_split is leaking, so here the solution:

Malloc array of pointers to strings

If array == Null  // Allocation failed
	return NULL;
	
while (splits left) 
{
	Malloc string
	If (string == null)  // Allocation failed
	{ 
		free ALL previously allocated strings
		free array
		return NULL
	}
	Fill string
}
return array

About

libft tester, not the fanciest one but has some useful features

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published