SB-012-TESTING_FRAMEWORK.md
(P2, 743 lines)
- Comprehensive test framework for unit, integration, and hardware
testing on emulator/real hardware
- Architecture: Test Runner → Test Suites (Unit/Integration/Hardware)
→ Test Utilities (Assert/Mock/Benchmark)
- All features implemented in
test_framework.c and
test_framework.h (~37KB)
- Data structures:
d3tui_test_result_t
(PASSED/FAILED/SKIPPED/ERROR), d3tui_test_case_t,
d3tui_test_suite_t, d3tui_test_runner_t
- API: init/shutdown, register_suite/case, run_all/run_suite/run_case,
get_stats
- Assertions: true/false, equal/not_equal, null/not_null, string
equality/contains, memory equality, float with epsilon
- Mocking framework:
d3tui_mock_function/unmock/was_called/get_call_count/get_call_args/reset
- Benchmarking: bench_start/end/get_results/print_results/reset
- Automatic test discovery via
D3TUI_TEST(suite, name)
macro with __attribute__((constructor))
- Configuration via
d3tui.test.ini with suites, filters,
timeouts
- CLI:
d3tui_test --suite unit --test test_name --verbose --stop-on-failure --format json --output results.json
- CI test matrix: Linux unit/integration every commit, Flycast
hardware nightly, real hardware on demand
- Owner: from-minimax-01