-
Notifications
You must be signed in to change notification settings - Fork 435
TestSuite
It's extremely important for the test suite to be maintained, especially when new code is added. It's easy to add new cases, just follow these steps:
- Make a folder in psi4/tests.
- Put a Makefile.in (see below) in there.
- Put an input.dat (see below) in there.
- Add the new folder's Makefile to the list in psi4/configure.ac
- Add the folder to the list of folders in psi4/tests/Makefile.in.
- If the new test is a nice balance of quick, vital, and representative, add it to the
quicktests
target, too.
The input file should be just a simple Psi input file to run the test, with small modifications.
#! RI-SCF cc-pVTZ energy of water, with Z-matrix input and cc-pVTZ-RI auxilliary basis. #! Also a bit more to force a second line. nucenergy = 8.801466202085710 #TEST refenergy = -76.05098402733282 #TEST molecule h2o { symmetry c1 O H 1 1.0 H 1 1.0 2 104.5 } set { basis cc-pVTZ scf_type df df_basis_scf cc-pVTZ-RI e_convergence 10 } thisenergy = energy('rhf') compare_values(nucenergy, h2o.nuclear_repulsion_energy(), 9, "Nuclear repulsion energy") #TEST compare_values(refenergy, thisenergy, 9, "Reference energy") #TEST compare_values(refenergy, get_variable('scf total energy'), 9, "Reference energy") #TEST
Of those small modifications, first, note the special comment at the top (starting with the #!
comment marker). This should be very descriptive since it is inlined into the manual (unless !nosample
is present in this comment) to serve as a listing of the example inputs available.
The reference values are assigned to variables for later use. The :py:func:`~compare_values` function (found in psi4/lib/python/p4util/util.py along with several relatives for comparing strings, matrices, etc.) checks that the computed values match these reference values to suitable precision. This function prints an error message and signals that the test failed to the make system, if the values don't match. Any lines of the input associated with the validation process should be flagged with #TEST
at the end of each line, so that they can be removed when copying from the tests to the samples directory.
All tests Makefiles look the same.
SRCDIR = @srcdir@ include ../MakeVars include ../MakeRules