Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Maly Libft Tester

The Maly Libft Tester Showcase Video on Youtube (1.1.0)

Currently up-to-date with Libft subject version 19.2.

A fast, cross-platform (Linux/macOS) Libft tester for 42 students. This tester executes over 500 tests in under 0.02 seconds.

Table of Contents

  1. Prerequisites
  2. Building and Running the Tester
  3. What this tester DOES check
  4. What this tester does NOT check
  5. Setting up automated tests in your Makefile
  6. Acknowledgments

Tester UI

Prerequisites

  • Linux or MacOS
  • GCC or Clang compiler
  • Your compiled libft.a library

Building and Running the Tester

Use the provided build.sh script.
Pass the path to your compiled libft.a archive as the only argument.

./build.sh <path/to/libft.a>

Run the tester:

./tester

For more information about command-line arguments that can be parsed, run:

./tester help

What this tester DOES check

  • Checks correct outputs for all Libft functions.
  • Checks memory leaks (using linker-level wrapping on Linux and flat namespace overrides on macOS).
  • Checks segmentation faults, timeouts, bus errors, double frees using process isolation.
  • Provides detailed hex and string memory dumps in failed_reports.txt for any failed tests.

What this tester does NOT check

  • Does NOT check if your libft project was written in accordance with the 42 Norm.
  • Does NOT check your libft project's Makefile and its rules, flags, relinking, etc.
  • Does NOT check if you declared any global variables in your project.
  • Does NOT check if you used any unallowed functions in your project.
  • Does NOT check for any README requirements.

Setting up automated tests in your Makefile

Create one variable for the Tester's directory path and one for optional Tester's arguments.

#  Example setup
TESTER_DIRECTORY_PATH := ../maly_libft_tester
TESTER_ARGUMENTS := --set-timeout-ms 50

Create a new rule named test:

test: $(NAME)
	$(TESTER_DIRECTORY_PATH)/build.sh ./$(NAME)
	./tester $(TESTER_ARGUMENTS)

And declare it as .PHONY so it always runs:

.PHONY: all clean fclean re test

Add the compiled tester executable to your existing fclean rule so it gets properly removed alongside your library:

fclean: clean
	$(RM) $(NAME)
	$(RM) tester

That is it!

Acknowledgments

The base and OS layers of this project are derived from RADDebugger by Epic Games. I would like to thank the RAD team for sharing their high-quality code, which significantly improved the robustness and portability of this tester.

About

A fast, cross-platform (Linux/macOS) Libft tester for 42 students. Executes 500+ strict tests in under 0.02 seconds. Subject v19.2 compliant.

Topics

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages