Skip to content

A comprehensive Libft 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/libft_tester

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ› οΈ Libft Tester

Last Commit

A comprehensive and strict tester for the 42 Libft project.

This tester includes Smart Memory Leak Detection via Valgrind. To ensure maximum speed without sacrificing safety, Valgrind is only active for functions that require memory allocation (e.g., ft_split, ft_calloc).

Standard checks (Segfaults and Timeouts) are performed on all functions.

✨ Features

  • Smart Valgrind Integration: Runs slow memory checks only where necessary.
  • Detailed Logging: Generates a tests_log.log file with specific failure details.
  • Crash & Timeout Protection: Detects segfaults and infinite loops.
  • Norminette Check: Includes a quick Norminette pass.
  • Forbidden Functions Check: Verifies that no forbidden functions are used in your binary.

πŸ“ 1. Installation

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

Correct Directory Structure:

/libft_root
    β”œβ”€β”€ Makefile
    β”œβ”€β”€ libft.h
    β”œβ”€β”€ *.c (your source files)
    └── libft_tester/       <--- YOU ARE HERE
          β”œβ”€β”€ .launch.sh
          β”œβ”€β”€ Makefile
          β”œβ”€β”€ CHANGELOG.md
          β”œβ”€β”€ README.md
          └── tests_log.log (generated after run)

**Important:** To avoid accidentally committing the tester to your repository, add `libft_tester/` to your `.gitignore` file:
echo "libft_tester/" >> .gitignore

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

   TIMEOUT_TIME=5

βš™οΈ 2. Usage Commands


The tester supports different modes and optional integration with Valgrind.

Command,Description
make   launches tests on all libft
make "function name"  launches tests only on the function 

⚠️ THE FUNCTION NAME MUST NOT INCLUDE ft_ ⚠️

πŸ“Š 3. Results Legend


[OK]      : The printed output and the return value are identical to the original.
[KO]      : There is a discrepancy. Check the log file for details.
[LEAK]    : There are memory leaks in your function.
[CRASH]   : Your function segfaulted (Segmentation Fault).
[TIMEOUT] : Your function caused an infinite loop (adjust TIMEOUT_TIME in .sh if needed).

πŸ“ 4. Use of AI


   Many of the tests were made by AI.

   I personally checked them all before publishing this tester.
   If you have any doubt on the results please contact me on my email (you can find it on my GitHub main page)

Happy debugging!πŸ–₯️

πŸ› οΈ More 42 Tools

Explore my full suite of testers:

ft_printf get_next_line push_swap

About

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

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published