Quarkonium-System

7. Testing, and bugs worth remembering

The principle

Every formula is checked against something that does not share its derivation: quadrature, finite differences, an exactly solvable case, a published number, or a second method. See validation.

Bugs and traps

what happened lesson
The D-wave amplitude in the S–D leptonic width had the wrong sign (fixed in 1.1.0). All tests passed, because they shared the convention. Test signs against an independent construction; test_sd_sign.cpp integrates the Dirac current numerically.
The linear decay test could not reject any overprediction, because its error grew with the prediction. Found only after the final fits. Think about a test’s behaviour at extremes before registering it; document amendments openly.
A “theory error” estimated from the residuals made (\chi^2/\nu=1) by construction. An error bar derived from the misfit cannot grade the fit (1.3.0 moved to an a-priori estimate).
Upward recursion for screened moments and the closed form of (\langle e^{-\mu r}\rangle) lost all digits at large arguments. Compare with quadrature at extreme parameters, not only typical ones.
A fit could lower (\chi^2) by letting a smeared contact term become narrower than the basis. Refuse inputs whose answer is set by the basis.
A running-coupling fit from the default start can stop with the smearing width on its bound and a floor 25 times too large. Look at bounds and errors; use --multistart.
Relativized fits have several minima; different minimisers land in different ones. Multistart, nested seeds, two minimisers.

Working on the code

cmake --preset asan && cmake --build --preset asan && ctest --preset asan
clang-format -i $(git ls-files 'src/*.[ch]pp' 'tests/*.[ch]pp')

Commits follow Conventional Commits and versions follow Semantic Versioning, the public interface being the qs command line and its JSON.