Testing Strategy
Objectives
Section titled “Objectives”The testing strategy validates four guarantees:
- parser correctness on valid and invalid
.cubinputs - map safety before runtime (spawn rules, symbol rules, enclosure)
- runtime stability (init/render loop/exit paths)
- resource safety (no leaks, no file-descriptor leaks, clean shutdown)
Test Layers
Section titled “Test Layers”1. Parser and config tests
Section titled “1. Parser and config tests”Scope:
- extension checks
- unknown identifiers
- duplicates/missing headers
- texture path/extension failures
- RGB format/range errors
Assets:
tests/mandatory/parser/tests/mandatory/init/
Execution:
make test- targeted runs:
./cub3D <test_map.cub>
Expected result:
- valid files enter the runtime path, which the smoke script currently treats as a
timeout-based “still running” success - invalid files fail early with controlled
Error\n...
2. Map validation tests
Section titled “2. Map validation tests”Scope:
- allowed/forbidden symbols
- single player spawn requirement
- open map detection
- irregular row handling
- unreachable/open leak detection
Assets:
tests/mandatory/validation/
Execution:
make test- manual targeted run for edge maps
Expected result:
- invalid topology rejected before MLX init
- valid enclosed maps accepted before runtime starts
3. Rendering and runtime smoke tests
Section titled “3. Rendering and runtime smoke tests”Scope:
- window init
- frame loop stability
- textured wall rendering path
- movement/rotation response
- clean close on ESC/window destroy
Assets:
tests/mandatory/render/- nominal valid maps under
tests/mandatory/...
Execution:
make test- manual visual checks in graphical session
Expected result:
- no crashes in normal control flow
- visible reaction to input and rendering updates
4. Bonus integration tests
Section titled “4. Bonus integration tests”Scope:
- bonus symbol linkage
- minimap/sprite/door/pickup runtime path
- retro flow and bonus maps
- next-level trigger path (
F4)
Assets:
tests/bonus/tests/run_bonus.sh
Execution:
make test_bonus- optional direct run:
./cub3D_bonus <bonus_map.cub>
Expected result:
- bonus binary enters stable runtime on valid bonus maps
- invalid bonus-related setup still fails safely
Automation vs Manual Coverage
Section titled “Automation vs Manual Coverage”Automated (script-based)
Section titled “Automated (script-based)”tests/run.shtests/run_bonus.sh- Makefile targets (
test,test_bonus)
Practical note:
- the repository smoke scripts rely on helpers such as
timeout,python3, and optionallynmfor bonus symbol checks
Manual (defense-critical)
Section titled “Manual (defense-critical)”- movement smoothness and collision behavior
- texture orientation correctness (N/S/E/W)
- door interaction consistency (open/close/passability)
- HUD readability and sprite occlusion behavior
- level transition (
F4) in active bonus session
Static and Quality Checks
Section titled “Static and Quality Checks”norminette include srcs srcs_bonus
Goal:
- 42 style compliance before submission
Valgrind / FD checks
Section titled “Valgrind / FD checks”Recommended commands:
valgrind --leak-check=full --track-fds=yes ./cub3D <map.cub>valgrind --leak-check=full --track-fds=yes ./cub3D_bonus <map.cub>Goal:
- no leak regressions
- no project-owned file descriptors leaked at exit
Regression Discipline
Section titled “Regression Discipline”After any change in parsing/render/bonus subsystems:
makemake bonusmake testmake test_bonus- targeted manual scenario for edited subsystem
norminette+valgrindspot check
This sequence catches most functional and cleanup regressions before the defense.
Known Environment Constraint
Section titled “Known Environment Constraint”In headless environments, mlx_init may fail even when parser/tests are otherwise correct.
Because valid-map smoke tests expect the binary to stay alive long enough for timeout to return 124, headless runs can produce false negatives on otherwise valid parsing paths.
Parser and validation failures remain meaningful in such environments, but full runtime smoke tests require an active X11 session.