| name | add-test |
| description | Adds Spectra unit tests, golden image tests, or Google Benchmark cases with correct CMake labels (gpu, golden). Use when adding test coverage, fixing regressions, or creating visual baselines in tests/. |
Add Tests
Unit tests
tests/unit/test_<feature>.cpp — Google Test TEST(Suite, Name)
- Register in
tests/CMakeLists.txt (add_spectra_test or equivalent)
- GPU needs Vulkan:
set_tests_properties(... PROPERTIES LABELS "gpu")
- Run:
ctest --test-dir build -R test_name --output-on-failure
Golden tests
- Case in
tests/golden/golden_test*.cpp — headless PNG
- Baseline:
tests/golden/baseline/
- Run:
ctest --test-dir build -L golden -j1
Benchmarks
tests/bench/bench_<feature>.cpp with BENCHMARK(...)
- Run:
./build/tests/bench_<feature>
UI smoke
Optional: spectra-mcp instead of a C++ harness for interaction.
Conventions
- One behavior per
TEST
- Descriptive names:
TEST(Layout, SubplotGridSpacing)
- GPU tests excluded from sanitizer CI (
-LE gpu)