test_runner.c
Entry point for the 42sh unit test suite.
Run with: make test
- Author
pulgamecanica (arosado-)
Functions
-
void test_dlist_suite(void)
Run all doubly-linked list assertions.
Builds a three-node list
[1 <-> 2 <-> 3], verifies size, forward and backward links, sentinel NULL values at both ends, then calls ft_dlstclear() and asserts the head pointer is NULL afterwards.
-
void test_list_suite(void)
Run all singly-linked list assertions.
Builds an append-order list
[alpha(1) -> beta(2) -> gamma(3)], verifies ft_lstsize() and forward traversal via->next, then exercises ft_lstdel() (freeing all nodes with del_dummy) and asserts the head pointer is NULL afterwards.A second sub-test uses ft_lstadd() (prepend) to verify that two nodes inserted as
[first, second]are stored as[second -> first]in the list.Precondition:
Libft/srcs/ft_stdlib/must be compiled and linked.
-
void test_history_suite(void)
Run all history module assertions.
history_file_path: $HISTFILE takes priority.
history_file_path: falls back to $HOME/.sh_history when $HISTFILE unset.
history_save / history_load round-trip preserves all entries.
-
void test_executor_suite(void)
-
void test_lexer_suite(void)
Run all lexer unit tests.
Called by test_runner.c via MU_RUN(test_lexer_suite).
-
void test_btree_suite(void)
-
void test_parser_suite(void)
-
void test_builtin_echo_suite(void)
-
int main(void)
Variables
-
int g_mu_passed = 0
Running total of assertions that passed.
Defined in test_runner.c; all test translation units share this counter through the
externdeclaration in this header.
-
int g_mu_failed = 0
Running total of assertions that failed.
A non-zero value causes MU_SUMMARY() to return exit code 1 so that
makecan detect and report test failures.