Libft tester trying to make sure no test cases get unnoticed and focussing on a good user experience :P
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:
Don't forget to recompile once you edit your libft files!
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
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