Tests¶
Changed in version 2.12: Migrated from GoogleTest to Catch2. All tests use the TEST_CASE /
TEST_CASE_METHOD macros with Catch2 matchers.
We have a robust test suite consisting of unit tests and integration tests.
All tests are registered via meson’s array iteration pattern and run with
meson test -C builddir.
Test inventory¶
Test |
File |
Data |
What it covers |
|---|---|---|---|
|
|
|
Improved dimer eigenmode search |
|
|
– |
String parsing utilities |
|
|
|
Matter construction, copy, PBC, forces |
|
|
|
LJ potential energy/force sanity |
|
|
|
ZBL potential switching function |
|
|
|
External potential file interface |
|
|
– |
Rotation/translation projection |
|
|
|
Displacement epicenter selection |
|
|
– |
Eigen storage order verification |
|
|
– |
Force call tracking registry |
|
|
|
NEB convergence on Morse cluster |
|
|
|
NEB regression (CI-NEB barrier) |
|
|
|
Eigenmode strategy pattern |
|
|
|
MinModeSaddleSearch integration |
|
|
|
CON file round-trip I/O |
|
|
|
NWChem socket potential (needs nwchem) |
Optional tests (enabled by build flags):
test_ase_pot(with_ase): ASE Python calculatortest_mta(with_metatomic): Metatomic ML potentialtest_xtb(with_xtb): XTB semiempiricaltest_cineb_xtb(with_xtb): CI-NEB with XTBtest_serve_spec(with_serve): Serve mode endpoint parsing
Writing and registering tests¶
Tests use Catch2 (amalgamated, vendored
in thirdparty/catch2/). Each test file is compiled with the amalgamated
source and linked against eonclib.
Registration uses meson’s array iteration:
test_array = [
['test_name', 'TestFile.cpp', 'data_dir'],
]
foreach test : test_array
test(test.get(0),
executable(test.get(0),
sources: ['gtests/' + test.get(1),
'thirdparty/catch2/catch_amalgamated.cpp'],
dependencies: test_deps,
include_directories: _incdirs,
cpp_args: test_args,
link_with: _linkto,
),
workdir: meson.project_source_root()
+ '/client/unit_tests/data/systems/' + test.get(2),
)
endforeach
Test data¶
Test data lives in client/unit_tests/data/systems/. Each subdirectory contains
the config.ini, pos.con, and any other files needed by the test. The
neb_morse dataset (7-atom LJ cluster) is shared by most tests.
Running tests¶
# All tests
pixi run -e dev meson test -C builddir
# Single test
pixi run -e dev meson test -C builddir test_neb_lj
# With verbose output
pixi run -e dev meson test -C builddir -v