Skip to content

Latest commit

 

History

History
69 lines (53 loc) · 2.63 KB

File metadata and controls

69 lines (53 loc) · 2.63 KB

Tests

GoogleTest + CTest. Built by default; disable with -DENGINE_BUILD_TESTS=OFF.

Layout

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).

Running

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' output

Each 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.*'

Adding a test

  1. Create tests/unit/<name>_test.cpp (or tests/integration/...). File names end in _test.cpp; one focused topic per file.
  2. Add the file name to the SOURCES list in that tree's CMakeLists.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.

Conventions

  • 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.

SIMD kernel tests (CPU-first, ADR-004)

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.