Skip to content

Organize unit tests into modular structure following 42 norms - #30

Draft
vasco-castro with Copilot wants to merge 3 commits into
masterfrom
copilot/make-useful-tests
Draft

Organize unit tests into modular structure following 42 norms#30
vasco-castro with Copilot wants to merge 3 commits into
masterfrom
copilot/make-useful-tests

Conversation

Copilot AI commented Nov 16, 2025

Copy link
Copy Markdown

The repository had confusing example tests mixed into src/main.c with no organized test suite. Tests need to follow 42 School coding standards (max 5 functions per file, norminette compliance).

Changes

Test Infrastructure

  • Created /tests directory with module-based organization mirroring src/ structure
  • Built test runner with color-coded output and per-module test grouping
  • Split tests across 19 files to comply with 5-function limit

Test Coverage

Added 40+ unit tests covering:

  • Memory: memset, bzero, memcpy, memmove, memchr, memcmp, calloc
  • Strings: strlen, strchr, strrchr, strncmp, strcmp, strnstr, strdup, substr, strjoin, strtrim, split
  • Converts: atoi, itoa, toupper, tolower
  • Ctype: isalpha, isdigit, isalnum, isascii, isprint, isupper, islower, issign
  • Lists: lstnew, lstadd_front, lstadd_back, lstsize
  • Prints: printchar, printstr, printf, printbool
  • Files: isfile
  • Debug: debug_mode

Build System

  • Updated test.mk to compile all test modules
  • Fixed targets.mk to include missing ft_tknlen and ft_tkncount (required by ft_split)
  • Replaced src/main.c with informative message pointing to new test suite

Run tests with make test or make t. All files pass norminette validation.

Original prompt

This section details on the original issue you should resolve

<issue_title>Make usefull tests</issue_title>
<issue_description>Create useful unit tests in folder /tests

Remove confusing tests, separate them into more readable and organized tests.

Divide them by different c files and different folders.</issue_description>

<agent_instructions>Follow 42 norms. Use norminette to validate it ;)</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 16, 2025 18:04
Co-authored-by: vasco-castro <61548183+vasco-castro@users.noreply.github.com>
Co-authored-by: vasco-castro <61548183+vasco-castro@users.noreply.github.com>
Copilot AI changed the title [WIP] Create and organize useful unit tests Organize unit tests into modular structure following 42 norms Nov 16, 2025
Copilot AI requested a review from vasco-castro November 16, 2025 18:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make usefull tests

2 participants