GoogleTest + CTest. Built by default; disable with -DENGINE_BUILD_TESTS=OFF.
| Tree | Contents |
|---|---|
unit/ |
Fast, isolated tests of a single module's behavior. |
integration/ |
Tests spanning module boundaries or exercising real end-to-end flows. |
common/ |
Shared helper library (engine::test_common), included as #include "common/...". |
fixtures/ |
Committed golden data generated by tools/ (HuggingFace reference outputs). |
ctest --test-dir build # everything
ctest --test-dir build -j 8 # parallel across test binaries
ctest --test-dir build -L unit # one tree only (labels: unit, integration)
ctest --test-dir build -R FixturesDir # by name regex
ctest --test-dir build --output-on-failure # print failing tests' outputEach test file builds as its own executable under build/tests/, so a single
file can also be run directly (with gtest flags):
./build/tests/unit/unit_smoke_test --gtest_filter='UnitSmoke.*'- Create
tests/unit/<name>_test.cpp(ortests/integration/...). File names end in_test.cpp; one focused topic per file. - Add the file name to the
SOURCESlist in that tree'sCMakeLists.txt. That is the only registration step — CTest discovery is automatic.
To link the module under test, pass it via DEPS:
engine_add_tests(TREE unit
SOURCES
smoke_test.cpp
status_test.cpp
DEPS engine::core)DEPS applies to every file in the call; use a second engine_add_tests call
in the same file for tests needing different dependencies.
- Tests link the project warning set (
-Werror); test code is held to the same style bar as engine code. - Numerical tests state their tolerance explicitly at the comparison site.
- Fixture-driven tests locate golden data via
engine::testing::FixturesDir()(common/paths.h) — never via relative paths or the working directory.
The correctness ladder: HuggingFace fixtures validate the scalar
reference implementations; the scalar reference validates every vectorized
(NEON/AVX2) and optimized kernel. A kernel test therefore never invents
expected values — it computes them with the reference implementation. The
suite runs the best ISA the host offers plus a forced-scalar pass
(ENGINE_FORCE_ISA=scalar), so CI on x86-64 and the arm64 dev machine
together cover every backend and no test is skipped for lack of hardware.
The concrete fixture and helper patterns land with the SIMD dispatch
infrastructure (M3-T05/T06) and will be documented here.