Skip to content

Commit 0bed2fe

Browse files
committed
Clear all fixings between tests
Centralize cleaning of fixings in quantlib_test_case instead of having each test do this manually. Fixes lballabio#1687
1 parent d5ffd78 commit 0bed2fe

15 files changed

+4
-51
lines changed

test-suite/assetswap.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ namespace asset_swap_test {
7373

7474
// clean-up
7575
SavedSettings backup;
76-
IndexHistoryCleaner indexCleaner;
7776

7877
// initial setup
7978
CommonVars() {

test-suite/cashflows.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -509,8 +509,6 @@ void CashFlowsTest::testPartialScheduleLegConstruction() {
509509
void CashFlowsTest::testFixedIborCouponWithoutForecastCurve() {
510510
BOOST_TEST_MESSAGE("Testing past ibor coupon without forecast curve...");
511511

512-
IndexHistoryCleaner cleaner;
513-
514512
Date today = Settings::instance().evaluationDate();
515513

516514
auto index = ext::make_shared<USDLibor>(6*Months);

test-suite/cmsspread.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ void CmsSpreadTest::testFixings() {
130130
cms2y->addFixing(d.refDate, 0.04);
131131
BOOST_CHECK_EQUAL(cms10y2y->fixing(d.refDate),
132132
cms10y->fixing(d.refDate) - cms2y->fixing(d.refDate));
133-
IndexManager::instance().clearHistories();
134133
}
135134

136135
namespace {

test-suite/equitycashflow.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ namespace equitycashflow_test {
8181

8282
equityIndex = ext::make_shared<EquityIndex>("eqIndex", calendar, localCcyInterestHandle,
8383
dividendHandle, spotHandle);
84-
IndexManager::instance().clearHistory(equityIndex->name());
8584
equityIndex->addFixing(Date(5, January, 2023), 9010.0);
8685
equityIndex->addFixing(today, 8690.0);
8786

test-suite/equityindex.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ namespace equityindex_test {
6969

7070
equityIndex = ext::make_shared<EquityIndex>("eqIndex", calendar, interestHandle,
7171
dividendHandle, spotHandle);
72-
IndexManager::instance().clearHistory(equityIndex->name());
7372

7473
today = calendar.adjust(Date(27, January, 2023));
7574

test-suite/equitytotalreturnswap.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,10 @@ namespace equitytotalreturnswap_test {
8080

8181
equityIndex = ext::make_shared<EquityIndex>("eqIndex", calendar, interestHandle,
8282
dividendHandle, spotHandle);
83-
IndexManager::instance().clearHistory(equityIndex->name());
8483
equityIndex->addFixing(Date(5, January, 2023), 9010.0);
8584
equityIndex->addFixing(today, 8690.0);
8685

8786
sofr = ext::make_shared<Sofr>(interestHandle);
88-
IndexManager::instance().clearHistory(sofr->name());
8987
sofr->addFixing(Date(3, January, 2023), 0.03);
9088
sofr->addFixing(Date(4, January, 2023), 0.031);
9189
sofr->addFixing(Date(5, January, 2023), 0.031);
@@ -105,7 +103,6 @@ namespace equitytotalreturnswap_test {
105103
sofr->addFixing(Date(26, January, 2023), 0.034);
106104

107105
usdLibor = ext::make_shared<USDLibor>(3 * Months, interestHandle);
108-
IndexManager::instance().clearHistory(usdLibor->name());
109106
usdLibor->addFixing(Date(3, January, 2023), 0.035);
110107

111108
interestHandle.linkTo(flatRate(0.0375, dayCount));
@@ -342,4 +339,4 @@ test_suite* EquityTotalReturnSwapTest::suite() {
342339
suite->add(QUANTLIB_TEST_CASE(&EquityTotalReturnSwapTest::testTRSNPV));
343340

344341
return suite;
345-
}
342+
}

test-suite/indexes.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ void IndexTest::testFixingHasHistoricalFixing() {
8686
while (!euribor6M->isValidFixingDate(today))
8787
today--;
8888

89-
IndexManager::instance().clearHistories();
90-
9189
euribor6M->addFixing(today, 0.01);
9290

9391
name = euribor3M->name();

test-suite/inflation.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ void InflationTest::testZeroIndex() {
9898
BOOST_TEST_MESSAGE("Testing zero inflation indices...");
9999

100100
SavedSettings backup;
101-
IndexHistoryCleaner cleaner;
102101

103102
QL_DEPRECATED_DISABLE_WARNING
104103

@@ -201,7 +200,6 @@ void InflationTest::testZeroTermStructure() {
201200
using namespace inflation_test;
202201

203202
SavedSettings backup;
204-
IndexHistoryCleaner cleaner;
205203

206204
// try the Zero UK
207205
Calendar calendar = UnitedKingdom();
@@ -588,7 +586,6 @@ void InflationTest::testSeasonalityCorrection() {
588586
using namespace inflation_test;
589587

590588
SavedSettings backup;
591-
IndexHistoryCleaner cleaner;
592589

593590
// try the Zero UK
594591
Calendar calendar = UnitedKingdom();
@@ -687,7 +684,6 @@ void InflationTest::testZeroIndexFutureFixing() {
687684
BOOST_TEST_MESSAGE("Testing that zero inflation indices forecast future fixings...");
688685

689686
SavedSettings backup;
690-
IndexHistoryCleaner cleaner;
691687

692688
EUHICP euhicp;
693689

@@ -766,7 +762,6 @@ void InflationTest::testQuotedYYIndex() {
766762
BOOST_TEST_MESSAGE("Testing quoted year-on-year inflation indices...");
767763

768764
SavedSettings backup;
769-
IndexHistoryCleaner cleaner;
770765

771766
YYEUHICP yyeuhicp(true);
772767
if (yyeuhicp.name() != "EU YY_HICP"
@@ -806,7 +801,6 @@ void InflationTest::testRatioYYIndex() {
806801
BOOST_TEST_MESSAGE("Testing ratio year-on-year inflation indices...");
807802

808803
SavedSettings backup;
809-
IndexHistoryCleaner cleaner;
810804

811805
auto euhicp = ext::make_shared<EUHICP>();
812806
auto ukrpi = ext::make_shared<UKRPI>();
@@ -928,7 +922,6 @@ void InflationTest::testOldRatioYYIndex() {
928922
BOOST_TEST_MESSAGE("Testing old-style ratio year-on-year inflation indices...");
929923

930924
SavedSettings backup;
931-
IndexHistoryCleaner cleaner;
932925

933926
QL_DEPRECATED_DISABLE_WARNING
934927

@@ -1066,7 +1059,6 @@ void InflationTest::testYYTermStructure() {
10661059
using namespace inflation_test;
10671060

10681061
SavedSettings backup;
1069-
IndexHistoryCleaner cleaner;
10701062

10711063
// try the YY UK
10721064
Calendar calendar = UnitedKingdom();
@@ -1301,7 +1293,6 @@ void InflationTest::testCpiFlatInterpolation() {
13011293
BOOST_TEST_MESSAGE("Testing CPI flat interpolation...");
13021294

13031295
SavedSettings backup;
1304-
IndexHistoryCleaner cleaner;
13051296

13061297
Settings::instance().evaluationDate() = Date(10, February, 2022);
13071298

@@ -1350,7 +1341,6 @@ void InflationTest::testCpiLinearInterpolation() {
13501341
BOOST_TEST_MESSAGE("Testing CPI linear interpolation...");
13511342

13521343
SavedSettings backup;
1353-
IndexHistoryCleaner cleaner;
13541344

13551345
Settings::instance().evaluationDate() = Date(10, February, 2022);
13561346

@@ -1407,7 +1397,6 @@ void InflationTest::testCpiAsIndexInterpolation() {
14071397
BOOST_TEST_MESSAGE("Testing CPI as-index interpolation...");
14081398

14091399
SavedSettings backup;
1410-
IndexHistoryCleaner cleaner;
14111400

14121401
Date today = Date(10, February, 2022);
14131402
Settings::instance().evaluationDate() = today;

test-suite/inflationcpibond.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ namespace inflation_cpi_bond_test {
9090
// cleanup
9191

9292
SavedSettings backup;
93-
IndexHistoryCleaner cleaner;
9493

9594
// setup
9695
CommonVars() {
@@ -173,8 +172,6 @@ namespace inflation_cpi_bond_test {
173172
void InflationCPIBondTest::testCleanPrice() {
174173
BOOST_TEST_MESSAGE("Checking cached pricers for CPI bond...");
175174

176-
IndexManager::instance().clearHistories();
177-
178175
using namespace inflation_cpi_bond_test;
179176

180177
CommonVars common;
@@ -233,8 +230,6 @@ void InflationCPIBondTest::testCleanPrice() {
233230
void InflationCPIBondTest::testCPILegWithoutBaseCPI() {
234231
BOOST_TEST_MESSAGE("Checking CPI leg with or without explicit base CPI fixing...");
235232

236-
IndexManager::instance().clearHistories();
237-
238233
using namespace inflation_cpi_bond_test;
239234

240235
CommonVars common;

test-suite/inflationcpiswap.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ namespace inflation_cpi_swap_test {
106106
// cleanup
107107

108108
SavedSettings backup;
109-
IndexHistoryCleaner cleaner;
110109

111110
// setup
112111
CommonVars()

0 commit comments

Comments
 (0)