Skip to content

Commit

Permalink
Automated registration of Unit test using boost test (#1811)
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Nov 8, 2023
2 parents 2e39334 + a040dee commit 77418dc
Show file tree
Hide file tree
Showing 205 changed files with 5,076 additions and 10,730 deletions.
133 changes: 21 additions & 112 deletions test-suite/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ set(QL_TEST_SOURCES
period.cpp
piecewiseyieldcurve.cpp
piecewisezerospreadedtermstructure.cpp
quantlibglobalfixture.cpp
quantlibtestsuite.cpp
quantooption.cpp
quotes.cpp
Expand All @@ -140,6 +141,7 @@ set(QL_TEST_SOURCES
shortratemodels.cpp
sofrfutures.cpp
solvers.cpp
speedlevel.cpp
spreadoption.cpp
squarerootclvmodel.cpp
stats.cpp
Expand Down Expand Up @@ -172,103 +174,6 @@ set(QL_TEST_SOURCES
)

set(QL_TEST_HEADERS
americanoption.hpp
amortizingbond.hpp
andreasenhugevolatilityinterpl.hpp
array.hpp
asianoptions.hpp
assetswap.hpp
autocovariances.hpp
barrieroption.hpp
basismodels.hpp
basisswapratehelpers.hpp
basketoption.hpp
batesmodel.hpp
bermudanswaption.hpp
binaryoption.hpp
blackdeltacalculator.hpp
blackformula.hpp
bondforward.hpp
bonds.hpp
brownianbridge.hpp
businessdayconventions.hpp
calendars.hpp
callablebonds.hpp
capfloor.hpp
capflooredcoupon.hpp
cashflows.hpp
catbonds.hpp
cdo.hpp
cdsoption.hpp
chooseroption.hpp
cliquetoption.hpp
cms.hpp
cms_normal.hpp
cmsspread.hpp
commodityunitofmeasure.hpp
compiledboostversion.hpp
compoundoption.hpp
convertiblebonds.hpp
covariance.hpp
creditdefaultswap.hpp
creditriskplus.hpp
crosscurrencyratehelpers.hpp
currency.hpp
curvestates.hpp
dates.hpp
daycounters.hpp
defaultprobabilitycurves.hpp
digitalcoupon.hpp
digitaloption.hpp
distributions.hpp
dividendoption.hpp
doublebarrieroption.hpp
doublebinaryoption.hpp
equityindex.hpp
equitycashflow.hpp
equitytotalreturnswap.hpp
europeanoption.hpp
everestoption.hpp
exchangerate.hpp
extendedtrees.hpp
extensibleoptions.hpp
fastfouriertransform.hpp
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
instruments.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,6 +205,7 @@ set(QL_TEST_HEADERS
period.hpp
piecewiseyieldcurve.hpp
piecewisezerospreadedtermstructure.hpp
quantlibglobalfixture.hpp
quantooption.hpp
quotes.hpp
rangeaccrual.hpp
Expand Down Expand Up @@ -330,6 +236,7 @@ set(QL_TEST_HEADERS
timegrid.hpp
timeseries.hpp
tqreigendecomposition.hpp
toplevelfixture.hpp
tracing.hpp
transformedgrid.hpp
twoassetbarrieroption.hpp
Expand All @@ -349,26 +256,27 @@ set(QL_TEST_HEADERS
set(QL_BENCHMARK_SOURCES
quantlibbenchmark.cpp

americanoption.cpp americanoption.hpp
asianoptions.cpp asianoptions.hpp
barrieroption.cpp barrieroption.hpp
basketoption.cpp basketoption.hpp
batesmodel.cpp batesmodel.hpp
convertiblebonds.cpp convertiblebonds.hpp
digitaloption.cpp digitaloption.hpp
dividendoption.cpp dividendoption.hpp
europeanoption.cpp europeanoption.hpp
fdheston.cpp fdheston.hpp
hestonmodel.cpp hestonmodel.hpp
interpolations.cpp interpolations.hpp
jumpdiffusion.cpp jumpdiffusion.hpp
lowdiscrepancysequences.cpp lowdiscrepancysequences.hpp
americanoption.cpp
asianoptions.cpp
barrieroption.cpp
basketoption.cpp
batesmodel.cpp
convertiblebonds.cpp
digitaloption.cpp
dividendoption.cpp
europeanoption.cpp
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
quantlibglobalfixture.cpp quantlibglobalfixture.hpp
riskstats.cpp riskstats.hpp
shortratemodels.cpp shortratemodels.hpp

speedlevel.cpp speedlevel.hpp
utilities.cpp utilities.hpp
swaptionvolstructuresutilities.hpp
)
Expand Down Expand Up @@ -408,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
127 changes: 12 additions & 115 deletions test-suite/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ QL_TEST_SRCS = \
period.cpp \
piecewiseyieldcurve.cpp \
piecewisezerospreadedtermstructure.cpp \
quantlibglobalfixture.cpp \
quantooption.cpp \
quotes.cpp \
rangeaccrual.cpp \
Expand All @@ -141,6 +142,7 @@ QL_TEST_SRCS = \
shortratemodels.cpp \
sofrfutures.cpp \
solvers.cpp \
speedlevel.cpp \
spreadoption.cpp \
squarerootclvmodel.cpp \
stats.cpp \
Expand Down Expand Up @@ -172,104 +174,6 @@ QL_TEST_SRCS = \
zerocouponswap.cpp

QL_TEST_HDRS = \
speedlevel.hpp \
americanoption.hpp \
amortizingbond.hpp \
andreasenhugevolatilityinterpl.hpp \
array.hpp \
asianoptions.hpp \
assetswap.hpp \
autocovariances.hpp \
barrieroption.hpp \
binaryoption.hpp \
basismodels.hpp \
basisswapratehelpers.hpp \
basketoption.hpp \
batesmodel.hpp \
bermudanswaption.hpp \
blackdeltacalculator.hpp \
blackformula.hpp \
bondforward.hpp \
bonds.hpp \
brownianbridge.hpp \
businessdayconventions.hpp \
calendars.hpp \
callablebonds.hpp \
capfloor.hpp \
capflooredcoupon.hpp \
cashflows.hpp \
catbonds.hpp \
cdo.hpp \
cdsoption.hpp \
chooseroption.hpp \
cliquetoption.hpp \
cms.hpp \
cms_normal.hpp \
cmsspread.hpp \
commodityunitofmeasure.hpp \
compiledboostversion.hpp \
compoundoption.hpp \
convertiblebonds.hpp \
covariance.hpp \
creditdefaultswap.hpp \
creditriskplus.hpp \
crosscurrencyratehelpers.hpp \
currency.hpp \
curvestates.hpp \
dates.hpp \
daycounters.hpp \
defaultprobabilitycurves.hpp \
digitalcoupon.hpp \
digitaloption.hpp \
distributions.hpp \
dividendoption.hpp \
doublebarrieroption.hpp \
doublebinaryoption.hpp \
equityindex.hpp \
equitycashflow.hpp \
equitytotalreturnswap.hpp \
europeanoption.hpp \
everestoption.hpp \
exchangerate.hpp \
extendedtrees.hpp \
extensibleoptions.hpp \
fastfouriertransform.hpp \
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 \
instruments.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,6 +204,7 @@ QL_TEST_HDRS = \
period.hpp \
piecewiseyieldcurve.hpp \
piecewisezerospreadedtermstructure.hpp \
quantlibglobalfixture.hpp \
quantooption.hpp \
quotes.hpp \
rangeaccrual.hpp \
Expand All @@ -313,6 +218,7 @@ QL_TEST_HDRS = \
shortratemodels.hpp \
sofrfutures.hpp \
solvers.hpp \
speedlevel.hpp \
spreadoption.hpp \
squarerootclvmodel.hpp \
stats.hpp \
Expand All @@ -330,6 +236,7 @@ QL_TEST_HDRS = \
timeseries.hpp \
transformedgrid.hpp \
tqreigendecomposition.hpp \
toplevelfixture.hpp \
tracing.hpp \
twoassetbarrieroption.hpp \
twoassetcorrelationoption.hpp \
Expand Down Expand Up @@ -365,32 +272,21 @@ QL_BENCHMARK_SRCS = \
lowdiscrepancysequences.cpp \
marketmodel_cms.cpp \
marketmodel_smm.cpp \
quantlibglobalfixture.cpp \
quantooption.cpp \
riskstats.cpp \
shortratemodels.cpp \
speedlevel.cpp \
utilities.cpp

QL_BENCHMARK_HDRS = \
americanoption.hpp \
asianoptions.hpp \
barrieroption.hpp \
doublebarrieroption.hpp \
basketoption.hpp \
batesmodel.hpp \
convertiblebonds.hpp \
digitaloption.hpp \
dividendoption.hpp \
europeanoption.hpp \
fdheston.hpp \
hestonmodel.hpp \
interpolations.hpp \
jumpdiffusion.hpp \
lowdiscrepancysequences.hpp \
marketmodel_cms.hpp \
marketmodel_smm.hpp \
quantlibglobalfixture.hpp \
quantooption.hpp \
riskstats.hpp \
shortratemodels.hpp \
speedlevel.hpp \
utilities.hpp

QL_BENCHMARKS = ${QL_BENCHMARK_SRCS} ${QL_BENCHMARK_HDRS}
Expand Down Expand Up @@ -427,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
Loading

0 comments on commit 77418dc

Please sign in to comment.