Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up tests and add more coverage
This cleans up the CMake files related to testing. It also adds testing for failures, and other tests that increase test coverage.
- Loading branch information
Showing
5 changed files
with
203 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
#################################################### | ||
# Verifies a Boys function test file | ||
# This verifies a single test file with the given parameters | ||
#################################################### | ||
macro(__verify_test_boys filepath floattype prec extra_m) | ||
get_filename_component(filename ${filepath} NAME) | ||
|
||
if(${prec} EQUAL 0) | ||
set(test_name boys_${filename}_${floattype}_+${extra_m}) | ||
add_test(NAME ${test_name} | ||
COMMAND mirp_verify_test --integral boys | ||
--file ${filepath} | ||
--float ${floattype} | ||
--extra-m ${extra_m} | ||
) | ||
else() | ||
set(test_name boys_${filename}_${floattype}_${prec}_+${extra_m}) | ||
add_test(NAME ${test_name} | ||
COMMAND mirp_verify_test --integral boys | ||
--file ${filepath} | ||
--float ${floattype} --prec ${prec} | ||
--extra-m ${extra_m} | ||
) | ||
endif() | ||
|
||
# Parse the PASS_REGULAR_EXPRESSION, if provided | ||
set(extra_args ${ARGN}) | ||
list(LENGTH extra_args len) | ||
if(${len} GREATER 0) | ||
set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION ${extra_args}) | ||
endif() | ||
endmacro() | ||
|
||
|
||
####################################### | ||
# Verifies a Boys function test file | ||
# This tests with multiple float types, | ||
# precisions, and extra m values | ||
####################################### | ||
macro(verify_test_boys filepath) | ||
__verify_test_boys(${filepath} exact 0 0) | ||
__verify_test_boys(${filepath} exact 0 10) | ||
__verify_test_boys(${filepath} interval 128 0) | ||
__verify_test_boys(${filepath} interval 128 10) | ||
__verify_test_boys(${filepath} interval 332 0) | ||
__verify_test_boys(${filepath} interval 332 10) | ||
endmacro() | ||
|
||
|
||
################################################################ | ||
# Create an Boys test file via create_test, then verify it | ||
################################################################ | ||
macro(create_and_verify_test_boys filepath) | ||
get_filename_component(filename ${filepath} NAME) | ||
add_test(NAME boys_${filename}_create_test | ||
COMMAND mirp_create_test --infile ${filepath} | ||
--outfile boys_${filename}_testcreate.dat | ||
--integral boys --prec 2048 --ndigits 101 | ||
) | ||
verify_test_boys(boys_${filename}_testcreate.dat) | ||
endmacro() | ||
|
||
|
||
############################################################## | ||
# Verify an integral test file | ||
# This verifies a single test file with the given parameters | ||
############################################################## | ||
macro(__verify_test filepath integral floattype prec) | ||
get_filename_component(filename ${filepath} NAME) | ||
if(${prec} EQUAL 0) | ||
set(test_name ${integral}_${filename}_${floattype}) | ||
add_test(NAME ${test_name} | ||
COMMAND mirp_verify_test --integral ${integral} | ||
--file ${filepath} | ||
--float ${floattype} | ||
) | ||
else() | ||
set(test_name ${integral}_${filename}_${floattype}_${prec}) | ||
add_test(NAME ${test_name} | ||
COMMAND mirp_verify_test --integral ${integral} | ||
--file ${filepath} | ||
--float ${floattype} --prec ${prec} | ||
) | ||
endif() | ||
|
||
# Parse the PASS_REGULAR_EXPRESSION, if provided | ||
set(extra_args ${ARGN}) | ||
list(LENGTH extra_args len) | ||
if(${len} GREATER 0) | ||
set_tests_properties(${test_name} PROPERTIES PASS_REGULAR_EXPRESSION ${extra_args}) | ||
endif() | ||
endmacro() | ||
|
||
macro(verify_test filepath integral) | ||
__verify_test(${filepath} ${integral} interval 128) | ||
__verify_test(${filepath} ${integral} interval 332) | ||
__verify_test(${filepath} ${integral} exact 0) | ||
endmacro() | ||
|
||
|
||
#################################################### | ||
# Verify an integral reference file | ||
#################################################### | ||
macro(verify_reference filepath integral) | ||
get_filename_component(filename ${filepath} NAME) | ||
add_test(NAME reference_${integral}_${filename} | ||
COMMAND mirp_verify_reference --integral ${integral} | ||
--file ${filepath} | ||
) | ||
endmacro() | ||
|
||
|
||
################################################################ | ||
# Create an integral test file via create_test, then verify it | ||
################################################################ | ||
macro(create_and_verify_test filepath integral) | ||
get_filename_component(filename ${filepath} NAME) | ||
add_test(NAME ${integral}_${filename}_create_test | ||
COMMAND mirp_create_test --infile ${filepath} | ||
--outfile ${integral}_${filename}_testcreate.dat | ||
--integral ${integral} --prec 2048 --ndigits 101 | ||
) | ||
verify_test(${integral}_${filename}_testcreate.dat ${integral}) | ||
endmacro() | ||
|
||
|
||
################################################################ | ||
# Create a reference file via create_reference, then verify it | ||
################################################################ | ||
macro(create_and_verify_reference integral) | ||
add_test(NAME ${integral}_${geometry}_${basis}_create_reference | ||
COMMAND mirp_create_reference --integral ${integral} | ||
--basis ${CMAKE_CURRENT_LIST_DIR}/generator/basis/sto-3g.bas | ||
--geometry ${CMAKE_CURRENT_LIST_DIR}/generator/geometry/water.xyz | ||
--outfile ${integral}_testref.ref | ||
) | ||
verify_reference(${integral}_testref.ref ${integral}) | ||
endmacro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Testing of this file is expected to fail | ||
# | ||
# This is used to make sure the testing infrastructure can correctly | ||
# detect incorrect values | ||
# | ||
1 101 2048 | ||
32 1.1654761577288435141645663404123e-12 [0.015384615384597989448851358906513336542127790970188751074745882155630219717636012984593279287141872640 +/- 4.20e-103] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Testing of this file is expected to fail | ||
# | ||
# This is used to make sure the testing infrastructure can correctly | ||
# detect incorrect values | ||
# | ||
1 101 2048 | ||
0 1 1 -1.0275129024292187679e-1 -2.2740534643066436648e-1 -2.7896675226993706728 | ||
7.8742584971383121319e-3 5.7730611000421486641e-3 | ||
0 1 1 8.3523545920802648038e-1 -7.9018496590739901763 -5.4052001289434744771 | ||
3.0685797439405440051e-2 1.9177072934115834967e-3 | ||
0 2 1 -3.3207070731144863347e-1 -2.7016781855672112947e-1 -1.5330920733346822219 | ||
1.650044882129425249e+7 9.7728974549573390749e+2 | ||
3.320218573802041738e-5 4.0152890008283762295e-1 | ||
0 2 2 -6.6311943406343432816e-1 9.1645926631222398191e-1 4.6740049726411933463 | ||
4.5904909654730448305e+6 3.6989583204899623791e+4 3.4794263336436944957e-2 | ||
2.4817791487878385728e+3 5.1221349104055463138e+1 2.2310727247558484503e-2 | ||
0 [2.8125644708357361955127280082157784327249840664649498067745110272843684766139456144433480670757325372e-13 +/- 8.47e-115] | ||
1 [3.0823619411641481440734912512476638867867128692479000735860669677800619209516562863728479688621615348e-11 +/- 3.67e-112] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters