A easy to use ft_printf project tester for 42 school.
%d, %i, %c, %s, %x, %X, %p, %u, and string only with the options "-0.*".
Simply run:
sh run.sh
or
sh run.sh PATH LIB TIMER
- PATH = Your ft_printf project directory (Default: ../ft_printf)
- LIB = Your ft_printf library name (Default: libftprintf.a)
- TIMER = Time to wait after each setup log in seconds (Default: 0)
Default values can be edited in run.sh (From line 3 to 5).
-
Create a new file in tests folder (ex: "my_own_test.c")
-
Add the below code in:
#include "../tester.h" void my_own_test(t_res *res) { testing("My own test"); // Only used as separotor for tests test(res, printf("[%s !!!]", "my test value"), ft_printf("'%s !!!'", "my test value")); // Real test }
-
Put yout prototype in tester.h (ex: void my_own_test(t_res *res);)
-
Finnaly call your test in tester.c > main:
#include "../tester.h" void main() { ... my_own_test(res); ... }
Remark that you can use different char to enclose the string and therefore know which one produced each output. (ex: [] for printf and '' for your function) Feel free to open a pull request to add tests !