Skip to content

A comprehensive Printf Tester for 42 students. Includes strict tests, unit testing, and smart Valgrind memory leak checks.

Notifications You must be signed in to change notification settings

Sfabi28/printf_tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ft_printf Tester

Last Commit

A comprehensive and strict tester for the 42 ft_printf project. It supports both Mandatory and Bonus parts, includes memory leak detection via Valgrind, and generates detailed logs for debugging.

πŸ“ 1. Installation

Ensure that the folder of this tester (printf_tester) is located INSIDE the root of your ft_printf project.

Correct Directory Structure:

/ft_printf_root
    β”œβ”€β”€ Makefile
    β”œβ”€β”€ ft_printf.h
    β”œβ”€β”€ *.c (your source files)
    └── printf_tester/       <--- YOU ARE HERE
          β”œβ”€β”€ .launch.sh
          β”œβ”€β”€ Makefile
          β”œβ”€β”€ README.md
          β”œβ”€β”€ CHANGELOG.md
          β”œβ”€β”€ test_result.log
          └── srcs

Important: To avoid accidentally committing the tester to your repository, add printf_tester/ to your .gitignore file:

echo "printf_tester/" >> .gitignore

Ensure that the path is right and set a proper timeout time INSIDE the launch.sh file

   SOURCE_PATH="../"
   TIME=3 (valgrind has x3)

βš™οΈ 2. Usage Commands


The tester supports different modes and optional integration with Valgrind.

Command,Description
make,Runs ALL tests (Mandatory + Bonus).
make m,Runs MANDATORY tests only.
make b,Runs BONUS tests only.

Command,Description
make val,Runs ALL tests with Valgrind checks.
make m val,Runs MANDATORY tests with Valgrind.
make b val,Runs BONUS tests with Valgrind.

πŸ“Š 3. Results Legend


[OK]   : The printed output and the return value (ret) are identical to the original printf.
[KO]   : There is a discrepancy. Check the log file for details.

If Valgrind is active:
[MOK]  : Memory OK. No leaks and no invalid memory access errors.
[MKO]  : Memory KO. Leaks, invalid read/write, or uninitialized variables found.

πŸ“ 4. Debugging with Logs


Test ID: 87 [Bonus #] -> KO
   ORIG Str: '  0xa'       <-- What printf printed
   USER Str: '0x    a'     <-- What your ft_printf printed
   ORIG Ret: 5             <-- Return value of printf
   USER Ret: 7             <-- Return value of ft_printf

Happy debugging!πŸ–₯️

πŸ› οΈ More 42 Tools

Explore my full suite of testers:

libft get_next_line push_swap

About

A comprehensive Printf Tester for 42 students. Includes strict tests, unit testing, and smart Valgrind memory leak checks.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published