Relativity-Simulator

Rules for writing tests

This guide is mandatory for every test and benchmark. No external test framework, assertion macro or ad-hoc report format is allowed.

File placement

Item Location
Functional test tests/test_<topic>.cpp
Benchmark tests/benchmark_<topic>.cpp
Shared harness tests/support/test_harness.hpp
Scenario generation tests/support/engine_scenario.hpp
Metric invariant checks tests/support/metric_checks.hpp
Suite specification docs/testing/suites/<suite_name>.md
Generated reports docs/testing/results/<suite_name>.md and .json
Status ledger docs/testing/test_catalog.md

<suite_name> is the snake_case identifier passed to TestSuite.

Harness lifecycle

Determinism and tolerances

Benchmarks

CMake

Documentation

Every maintained test has a suite page with: executable, source, link to its generated result, purpose, covered metrics or modes, a table of checks with tolerances and their justification, scenario parameters, limits and acceptance criteria. Every suite page ends with a “Recorded results” section linking to docs/testing/results/<suite_name>.md and .json, and every check of the test must appear in the check table of its page with its tolerance and justification. A test without a suite page, a catalogue entry and committed results is not considered maintained. Commit the generated reports in the same commit as any change that alters a test or the behaviour it covers.

Review checklist

  1. The test fails when the property is broken, not only when it compiles.
  2. Tolerances detect regressions yet allow supported compilers and hardware.
  3. The suite page, catalogue and results index are updated.
  4. The generated result files are committed.