Skip to content

Running the tests

The tests are written with Catch2, which CMake fetches automatically.

The suite is split in two:

  • Unit tests, in tests/unit/, test a single class or function each. Their folders mirror include/.
  • Feature tests, in tests/feature/, test larger parts of the program, often on real structures and data, and take longer.

Run them with the scripts/run_test.py script from the repository root, after configuring the build in build/ as described in compiling from source. It builds the tests it needs, and runs every test case in its own process:

python scripts/run_test.py utest             # every unit test
python scripts/run_test.py <test file>       # one test file, unit or feature
python scripts/run_test.py utest hist/       # every unit test in a folder
python scripts/run_test.py "<test case>"     # only this test case

Prefix a file or folder with utest or ftest to choose between the unit and feature tests explicitly; this is required when the name exists in both. Running the whole feature suite takes a long time, so run the tests relevant to your change locally and leave the rest to the CI.