Skip to content

Commit

Permalink
Merge pull request #9 from Sidsky/automated-test-registration
Browse files Browse the repository at this point in the history
Automated test registration
  • Loading branch information
Sidsky authored Nov 7, 2023
2 parents 589b56c + 120170f commit 15e33c5
Show file tree
Hide file tree
Showing 79 changed files with 2,527 additions and 4,849 deletions.
46 changes: 6 additions & 40 deletions test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,41 +174,6 @@ set(QL_TEST_SOURCES
)

set(QL_TEST_HEADERS
fdcev.hpp
fdcir.hpp
fdheston.hpp
fdmlinearop.hpp
fdsabr.hpp
fittedbonddiscountcurve.hpp
forwardoption.hpp
forwardrateagreement.hpp
functions.hpp
garch.hpp
gaussianquadratures.hpp
gjrgarchmodel.hpp
gsr.hpp
hestonmodel.hpp
hestonslvmodel.hpp
himalayaoption.hpp
hybridhestonhullwhiteprocess.hpp
indexes.hpp
inflation.hpp
inflationcapfloor.hpp
inflationcapflooredcoupon.hpp
inflationcpibond.hpp
inflationcpicapfloor.hpp
inflationcpiswap.hpp
inflationvolatility.hpp
integrals.hpp
interestrates.hpp
interpolations.hpp
jumpdiffusion.hpp
lazyobject.hpp
libormarketmodel.hpp
libormarketmodelprocess.hpp
linearleastsquaresregression.hpp
lookbackoptions.hpp
lowdiscrepancysequences.hpp
margrabeoption.hpp
marketmodel.hpp
marketmodel_cms.hpp
Expand Down Expand Up @@ -300,11 +265,11 @@ set(QL_BENCHMARK_SOURCES
digitaloption.cpp
dividendoption.cpp
europeanoption.cpp
fdheston.cpp fdheston.hpp
hestonmodel.cpp hestonmodel.hpp
interpolations.cpp interpolations.hpp
jumpdiffusion.cpp jumpdiffusion.hpp
lowdiscrepancysequences.cpp lowdiscrepancysequences.hpp
fdheston.cpp
hestonmodel.cpp
interpolations.cpp
jumpdiffusion.cpp
lowdiscrepancysequences.cpp
marketmodel_cms.cpp marketmodel_cms.hpp
marketmodel_smm.cpp marketmodel_smm.hpp
quantooption.cpp quantooption.hpp
Expand Down Expand Up @@ -351,6 +316,7 @@ endif()
IF (QL_BUILD_BENCHMARK)
add_executable(ql_benchmark ${QL_BENCHMARK_SOURCES})
set_target_properties(ql_benchmark PROPERTIES OUTPUT_NAME "quantlib-benchmark")
set_source_files_properties(quantlibbenchmark.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION true)
if (NOT Boost_USE_STATIC_LIBS)
target_compile_definitions(ql_benchmark PRIVATE BOOST_ALL_DYN_LINK BOOST_TEST_DYN_LINK)
endif()
Expand Down
45 changes: 3 additions & 42 deletions test-suite/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -174,41 +174,6 @@ QL_TEST_SRCS = \
zerocouponswap.cpp

QL_TEST_HDRS = \
fdheston.hpp \
fdcir.hpp \
fdmlinearop.hpp \
fdcev.hpp \
fdsabr.hpp \
fittedbonddiscountcurve.hpp \
forwardoption.hpp \
forwardrateagreement.hpp \
functions.hpp \
garch.hpp \
gaussianquadratures.hpp \
gjrgarchmodel.hpp \
gsr.hpp \
hestonmodel.hpp \
hestonslvmodel.hpp \
himalayaoption.hpp \
hybridhestonhullwhiteprocess.hpp \
indexes.hpp \
inflation.hpp \
inflationcapfloor.hpp \
inflationcapflooredcoupon.hpp \
inflationcpibond.hpp \
inflationcpicapfloor.hpp \
inflationcpiswap.hpp \
inflationvolatility.hpp \
integrals.hpp \
interestrates.hpp \
interpolations.hpp \
jumpdiffusion.hpp \
lazyobject.hpp \
libormarketmodel.hpp \
libormarketmodelprocess.hpp \
linearleastsquaresregression.hpp \
lookbackoptions.hpp \
lowdiscrepancysequences.hpp \
margrabeoption.hpp \
marketmodel.hpp \
marketmodel_cms.hpp \
Expand Down Expand Up @@ -315,11 +280,6 @@ QL_BENCHMARK_SRCS = \
utilities.cpp

QL_BENCHMARK_HDRS = \
fdheston.hpp \
hestonmodel.hpp \
interpolations.hpp \
jumpdiffusion.hpp \
lowdiscrepancysequences.hpp \
marketmodel_cms.hpp \
marketmodel_smm.hpp \
quantlibglobalfixture.hpp \
Expand Down Expand Up @@ -363,13 +323,14 @@ unity_test.cpp: Makefile.am
echo "#include \"test-suite/$$i\"" >> $@; \
done

nodist_quantlib_benchmark_SOURCES = unity_benchmark.cpp
nodist_quantlib_benchmark_SOURCES = unity_benchmark.cpp quantlibbenchmark.cpp
UNITY_SRC = $(filter-out quantlibbenchmark.cpp,$(QL_BENCHMARK_SRCS))

unity_benchmark.cpp: Makefile.am
echo "/* This file is automatically generated; do not edit. */" > $@
echo "/* Add the files to be included into Makefile.am instead. */" >> $@
echo >> $@
for i in $(QL_BENCHMARK_SRCS); do \
for i in $(UNITY_SRC); do \
echo "#include \"test-suite/$$i\"" >> $@; \
done

Expand Down
21 changes: 9 additions & 12 deletions test-suite/fdcev.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

#include "fdcev.hpp"
#include "toplevelfixture.hpp"
#include "utilities.hpp"
#include <ql/math/randomnumbers/rngtraits.hpp>
#include <ql/math/integrals/gausslobattointegral.hpp>
Expand Down Expand Up @@ -45,7 +45,11 @@ namespace {
};
}

void FdCevTest::testLocalMartingale() {
BOOST_FIXTURE_TEST_SUITE(QuantLibTest, TopLevelFixture)

BOOST_AUTO_TEST_SUITE(FdCevTest)

BOOST_AUTO_TEST_CASE(testLocalMartingale) {
BOOST_TEST_MESSAGE(
"Testing local martingale property of CEV process with PDF...");

Expand Down Expand Up @@ -123,7 +127,7 @@ void FdCevTest::testLocalMartingale() {
}
}

void FdCevTest::testFdmCevOp() {
BOOST_AUTO_TEST_CASE(testFdmCevOp) {
BOOST_TEST_MESSAGE(
"Testing FDM constant elasticity of variance (CEV) operator...");

Expand Down Expand Up @@ -201,13 +205,6 @@ void FdCevTest::testFdmCevOp() {
}
}

BOOST_AUTO_TEST_SUITE_END()

test_suite* FdCevTest::suite(SpeedLevel speed) {
auto* suite = BOOST_TEST_SUITE("Finite Difference CEV tests");


suite->add(QUANTLIB_TEST_CASE(&FdCevTest::testLocalMartingale));
suite->add(QUANTLIB_TEST_CASE(&FdCevTest::testFdmCevOp));

return suite;
}
BOOST_AUTO_TEST_SUITE_END()
37 changes: 0 additions & 37 deletions test-suite/fdcev.hpp

This file was deleted.

17 changes: 8 additions & 9 deletions test-suite/fdcir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
FOR A PARTICULAR PURPOSE. See the license for more details.
*/

#include "fdcir.hpp"
#include "fdheston.hpp"
#include "toplevelfixture.hpp"
#include "utilities.hpp"
#include <ql/instruments/barrieroption.hpp>
#include <ql/models/equity/hestonmodel.hpp>
Expand All @@ -35,7 +34,11 @@
using namespace QuantLib;
using boost::unit_test_framework::test_suite;

void FdCIRTest::testFdmCIRConvergence() {
BOOST_FIXTURE_TEST_SUITE(QuantLibTest, TopLevelFixture)

BOOST_AUTO_TEST_SUITE(FdCIRTest)

BOOST_AUTO_TEST_CASE(testFdmCIRConvergence) {
BOOST_TEST_MESSAGE("Testing FDM CIR convergence...");

FdmSchemeDesc schemes[] = {
Expand Down Expand Up @@ -108,11 +111,7 @@ void FdCIRTest::testFdmCIRConvergence() {
}
}

test_suite* FdCIRTest::suite(SpeedLevel speed) {
auto* suite = BOOST_TEST_SUITE("Finite Difference CIR tests");
BOOST_AUTO_TEST_SUITE_END()

suite->add(QUANTLIB_TEST_CASE(&FdCIRTest::testFdmCIRConvergence));

return suite;
}
BOOST_AUTO_TEST_SUITE_END()

36 changes: 0 additions & 36 deletions test-suite/fdcir.hpp

This file was deleted.

Loading

0 comments on commit 15e33c5

Please sign in to comment.