Skip to content

Commit 792f464

Browse files
committed
Remove obsolete workaround for older versions of Boost.
1 parent f9d8a9b commit 792f464

29 files changed

+379
-396
lines changed

acinclude.m4

-18
Original file line numberDiff line numberDiff line change
@@ -295,23 +295,6 @@ AC_DEFUN([QL_CHECK_BOOST_TEST_INTERPROCESS],
295295
])
296296

297297

298-
# QL_CHECK_BOOST_TEST_STREAM
299-
# --------------------------
300-
# Check whether Boost unit-test stream accepts std::fixed
301-
AC_DEFUN([QL_CHECK_BOOST_TEST_STREAM],
302-
[AC_MSG_CHECKING([whether Boost unit-test streams work])
303-
AC_REQUIRE([AC_PROG_CC])
304-
AC_TRY_COMPILE(
305-
[@%:@include <boost/test/unit_test.hpp>
306-
@%:@include <iomanip>],
307-
[BOOST_ERROR("foo " << std::fixed << 42.0);],
308-
[AC_MSG_RESULT([yes])
309-
AC_SUBST(BOOST_UNIT_TEST_DEFINE,[-DQL_WORKING_BOOST_STREAMS])],
310-
[AC_MSG_RESULT([no])
311-
AC_SUBST(BOOST_UNIT_TEST_DEFINE,[""])
312-
])
313-
])
314-
315298
# QL_CHECK_BOOST
316299
# ------------------------
317300
# Boost-related tests
@@ -320,6 +303,5 @@ AC_DEFUN([QL_CHECK_BOOST],
320303
AC_REQUIRE([QL_CHECK_BOOST_VERSION])
321304
AC_REQUIRE([QL_CHECK_BOOST_UBLAS])
322305
AC_REQUIRE([QL_CHECK_BOOST_UNIT_TEST])
323-
AC_REQUIRE([QL_CHECK_BOOST_TEST_STREAM])
324306
])
325307

ql/config.msvc.hpp

-3
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,6 @@
5858
// prevent auto-link of Boost libs such as serialization
5959
#define BOOST_ALL_NO_LIB
6060

61-
// This holds for all supported versions
62-
#define QL_WORKING_BOOST_STREAMS
63-
6461
#if (_MSC_VER == 1500)
6562
// warning management for VC++ 9
6663
# ifndef _SCL_SECURE_NO_DEPRECATE

test-suite/Makefile.am

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ dist-hook:
175175

176176
if BOOST_UNIT_TEST_FOUND
177177

178-
AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir} ${BOOST_UNIT_TEST_DEFINE}
178+
AM_CPPFLAGS = -I${top_srcdir} -I${top_builddir}
179179

180180
noinst_LTLIBRARIES = libUnitMain.la
181181
libUnitMain_la_SOURCES = main.cpp

test-suite/americanoption.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ using namespace boost::unit_test_framework;
4848
<< " reference date: " << today << "\n" \
4949
<< " maturity: " << exercise->lastDate() << "\n" \
5050
<< " volatility: " << io::volatility(v) << "\n\n" \
51-
<< QL_FIXED << std::setprecision(4) \
51+
<< std::fixed << std::setprecision(4) \
5252
<< " expected " << greekName << ": " << expected << "\n" \
5353
<< " calculated " << greekName << ": " << calculated << "\n"\
54-
<< QL_SCIENTIFIC \
54+
<< std::scientific \
5555
<< " error: " << error << "\n" \
5656
<< " tolerance: " << tolerance);
5757

test-suite/assetswap.cpp

+189-189
Large diffs are not rendered by default.

test-suite/autocovariances.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void AutocovariancesTest::testConvolutions() {
3434
Array delta = conv - Array(expected, expected+6);
3535
if (DotProduct(delta, delta) > 1.0e-6)
3636
BOOST_ERROR("Convolution: \n"
37-
<< std::setprecision(4) << QL_SCIENTIFIC
37+
<< std::setprecision(4) << std::scientific
3838
<< " calculated: " << conv << "\n"
3939
<< " expected: " << Array(expected, expected+6));
4040
}
@@ -53,7 +53,7 @@ void AutocovariancesTest::testAutoCovariances() {
5353
Array delta = acovf - Array(expected, expected+6);
5454
if (DotProduct(delta, delta) > 1.0e-6)
5555
BOOST_ERROR("Autocovariances: \n"
56-
<< std::setprecision(4) << QL_SCIENTIFIC
56+
<< std::setprecision(4) << std::scientific
5757
<< " calculated: " << acovf << "\n"
5858
<< " expected: " << Array(expected, expected+6));
5959
}
@@ -73,13 +73,13 @@ void AutocovariancesTest::testAutoCorrelations() {
7373
Array delta = acorf - Array(expected, expected+6);
7474
if (DotProduct(delta, delta) > 1.0e-6)
7575
BOOST_ERROR("Autocovariances: \n"
76-
<< std::setprecision(4) << QL_SCIENTIFIC
76+
<< std::setprecision(4) << std::scientific
7777
<< " calculated: " << acorf << "\n"
7878
<< " expected: " << Array(expected, expected+6));
7979
delta = x - Array(10, -4.5, 1);
8080
if (DotProduct(delta, delta) > 1.0e-6)
8181
BOOST_ERROR("Centering: \n"
82-
<< std::setprecision(4) << QL_SCIENTIFIC
82+
<< std::setprecision(4) << std::scientific
8383
<< " calculated: " << x << "\n"
8484
<< " expected: " << Array(10, -4.5, 1));
8585
}

test-suite/basketoption.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -1078,15 +1078,15 @@ void BasketOptionTest::test2DPDEGreeks() {
10781078
const Real tol = 0.0005;
10791079
if (std::fabs(expectedDelta - calculatedDelta) > tol) {
10801080
BOOST_FAIL("failed to reproduce delta with 2dim PDE"
1081-
<< QL_FIXED << std::setprecision(8)
1081+
<< std::fixed << std::setprecision(8)
10821082
<< "\n calculated: " << calculatedDelta
10831083
<< "\n expected: " << expectedDelta
10841084
<< "\n tolerance: " << tol);
10851085
}
10861086

10871087
if (std::fabs(expectedGamma - calculatedGamma) > tol) {
10881088
BOOST_FAIL("failed to reproduce delta with 2dim PDE"
1089-
<< QL_FIXED << std::setprecision(8)
1089+
<< std::fixed << std::setprecision(8)
10901090
<< "\n calculated: " << calculatedGamma
10911091
<< "\n expected: " << expectedGamma
10921092
<< "\n tolerance: " << tol);

test-suite/batesmodel.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ void BatesModelTest::testAnalyticVsBlack() {
107107
Real error = std::fabs(calculated - expected);
108108
if (error > tolerance) {
109109
BOOST_ERROR("failed to reproduce Black price with BatesEngine"
110-
<< QL_FIXED
110+
<< std::fixed
111111
<< "\n calculated: " << calculated
112112
<< "\n expected: " << expected
113-
<< QL_SCIENTIFIC
113+
<< std::scientific
114114
<< "\n error: " << error);
115115
}
116116

@@ -125,10 +125,10 @@ void BatesModelTest::testAnalyticVsBlack() {
125125
if (error > tolerance) {
126126
BOOST_ERROR("failed to reproduce Black price with " \
127127
"BatesDetJumpEngine"
128-
<< QL_FIXED
128+
<< std::fixed
129129
<< "\n calculated: " << calculated
130130
<< "\n expected: " << expected
131-
<< QL_SCIENTIFIC
131+
<< std::scientific
132132
<< "\n error: " << error);
133133
}
134134

@@ -142,10 +142,10 @@ void BatesModelTest::testAnalyticVsBlack() {
142142
error = std::fabs(calculated - expected);
143143
if (error > tolerance) {
144144
BOOST_ERROR("failed to reproduce Black price with BatesDoubleExpEngine"
145-
<< QL_FIXED
145+
<< std::fixed
146146
<< "\n calculated: " << calculated
147147
<< "\n expected: " << expected
148-
<< QL_SCIENTIFIC
148+
<< std::scientific
149149
<< "\n error: " << error);
150150
}
151151

@@ -161,10 +161,10 @@ void BatesModelTest::testAnalyticVsBlack() {
161161
if (error > tolerance) {
162162
BOOST_ERROR("failed to reproduce Black price with " \
163163
"BatesDoubleExpDetJumpEngine"
164-
<< QL_FIXED
164+
<< std::fixed
165165
<< "\n calculated: " << calculated
166166
<< "\n expected: " << expected
167-
<< QL_SCIENTIFIC
167+
<< std::scientific
168168
<< "\n error: " << error);
169169
}
170170
}
@@ -250,7 +250,7 @@ void BatesModelTest::testAnalyticAndMcVsJumpDiffusion() {
250250
if (relError > tolerance) {
251251
BOOST_FAIL("failed to reproduce Merton76 price with semi "
252252
"analytic BatesEngine"
253-
<< QL_FIXED << std::setprecision(8)
253+
<< std::fixed << std::setprecision(8)
254254
<< "\n calculated: " << calculated
255255
<< "\n expected: " << expected
256256
<< "\n rel. error: " << relError
@@ -261,7 +261,7 @@ void BatesModelTest::testAnalyticAndMcVsJumpDiffusion() {
261261
if (mcError > 3*mcTol) {
262262
BOOST_FAIL("failed to reproduce Merton76 price with Monte-Carlo "
263263
"BatesEngine"
264-
<< QL_FIXED << std::setprecision(8)
264+
<< std::fixed << std::setprecision(8)
265265
<< "\n calculated: " << mcCalculated
266266
<< "\n expected: " << expected
267267
<< "\n error: " << mcError
@@ -360,7 +360,7 @@ void BatesModelTest::testAnalyticVsMCPricing() {
360360
if (mcError > 3*mcTolerance) {
361361
BOOST_FAIL("failed to reproduce Monte-Carlo price for BatesEngine"
362362
<< "\n parameter: " << hestonModels[i].name
363-
<< QL_FIXED << std::setprecision(8)
363+
<< std::fixed << std::setprecision(8)
364364
<< "\n calculated: " << calculated
365365
<< "\n expected: " << expected
366366
<< "\n error: " << mcError
@@ -371,7 +371,7 @@ void BatesModelTest::testAnalyticVsMCPricing() {
371371
if (fdError > fdTolerance) {
372372
BOOST_FAIL("failed to reproduce PIDE price for BatesEngine"
373373
<< "\n parameter: " << hestonModels[i].name
374-
<< QL_FIXED << std::setprecision(8)
374+
<< std::fixed << std::setprecision(8)
375375
<< "\n calculated: " << fdCalculated
376376
<< "\n expected: " << expected
377377
<< "\n error: " << fdError

test-suite/bonds.cpp

+17-17
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ void BondTest::testCached() {
483483
bondDayCount, Compounded, freq);
484484
if (std::fabs(price-cachedPrice1a) > tolerance) {
485485
BOOST_FAIL("failed to reproduce cached price:"
486-
<< QL_FIXED
486+
<< std::fixed
487487
<< "\n calculated: " << price
488488
<< "\n expected: " << cachedPrice1a
489489
<< "\n tolerance: " << tolerance
@@ -493,7 +493,7 @@ void BondTest::testCached() {
493493
price = bond1.cleanPrice();
494494
if (std::fabs(price-cachedPrice1b) > tolerance) {
495495
BOOST_FAIL("failed to reproduce cached price:"
496-
<< QL_FIXED
496+
<< std::fixed
497497
<< "\n calculated: " << price
498498
<< "\n expected: " << cachedPrice1b
499499
<< "\n tolerance: " << tolerance
@@ -534,7 +534,7 @@ void BondTest::testCached() {
534534
price = BondFunctions::cleanPrice(bond2, marketYield2, bondDayCount, Compounded, freq);
535535
if (std::fabs(price-cachedPrice2a) > tolerance) {
536536
BOOST_FAIL("failed to reproduce cached price:"
537-
<< QL_FIXED
537+
<< std::fixed
538538
<< "\n calculated: " << price
539539
<< "\n expected: " << cachedPrice2a
540540
<< "\n tolerance: " << tolerance
@@ -544,7 +544,7 @@ void BondTest::testCached() {
544544
price = bond2.cleanPrice();
545545
if (std::fabs(price-cachedPrice2b) > tolerance) {
546546
BOOST_FAIL("failed to reproduce cached price:"
547-
<< QL_FIXED
547+
<< std::fixed
548548
<< "\n calculated: " << price
549549
<< "\n expected: " << cachedPrice2b
550550
<< "\n tolerance: " << tolerance
@@ -605,7 +605,7 @@ void BondTest::testCached() {
605605
bondDayCount, Compounded, freq, settlementDate);
606606
if (std::fabs(price-cachedPrice3) > tolerance) {
607607
BOOST_FAIL("failed to reproduce cached price:"
608-
<< QL_FIXED
608+
<< std::fixed
609609
<< "\n calculated: " << price << ""
610610
<< "\n expected: " << cachedPrice3 << ""
611611
<< "\n error: " << price-cachedPrice3);
@@ -619,7 +619,7 @@ void BondTest::testCached() {
619619
price = BondFunctions::cleanPrice(bond3, marketYield3, bondDayCount, Compounded, freq);
620620
if (std::fabs(price-cachedPrice3) > tolerance) {
621621
BOOST_FAIL("failed to reproduce cached price:"
622-
<< QL_FIXED
622+
<< std::fixed
623623
<< "\n calculated: " << price << ""
624624
<< "\n expected: " << cachedPrice3 << ""
625625
<< "\n error: " << price-cachedPrice3);
@@ -661,7 +661,7 @@ void BondTest::testCachedZero() {
661661
Real price = bond1.cleanPrice();
662662
if (std::fabs(price-cachedPrice1) > tolerance) {
663663
BOOST_FAIL("failed to reproduce cached price:\n"
664-
<< QL_FIXED
664+
<< std::fixed
665665
<< " calculated: " << price << "\n"
666666
<< " expected: " << cachedPrice1 << "\n"
667667
<< " error: " << price-cachedPrice1);
@@ -681,7 +681,7 @@ void BondTest::testCachedZero() {
681681
price = bond2.cleanPrice();
682682
if (std::fabs(price-cachedPrice2) > tolerance) {
683683
BOOST_FAIL("failed to reproduce cached price:\n"
684-
<< QL_FIXED
684+
<< std::fixed
685685
<< " calculated: " << price << "\n"
686686
<< " expected: " << cachedPrice2 << "\n"
687687
<< " error: " << price-cachedPrice2);
@@ -701,7 +701,7 @@ void BondTest::testCachedZero() {
701701
price = bond3.cleanPrice();
702702
if (std::fabs(price-cachedPrice3) > tolerance) {
703703
BOOST_FAIL("failed to reproduce cached price:\n"
704-
<< QL_FIXED
704+
<< std::fixed
705705
<< " calculated: " << price << "\n"
706706
<< " expected: " << cachedPrice3 << "\n"
707707
<< " error: " << price-cachedPrice3);
@@ -746,7 +746,7 @@ void BondTest::testCachedFixed() {
746746
Real price = bond1.cleanPrice();
747747
if (std::fabs(price-cachedPrice1) > tolerance) {
748748
BOOST_FAIL("failed to reproduce cached price:\n"
749-
<< QL_FIXED
749+
<< std::fixed
750750
<< " calculated: " << price << "\n"
751751
<< " expected: " << cachedPrice1 << "\n"
752752
<< " error: " << price-cachedPrice1);
@@ -773,7 +773,7 @@ void BondTest::testCachedFixed() {
773773
price = bond2.cleanPrice();
774774
if (std::fabs(price-cachedPrice2) > tolerance) {
775775
BOOST_FAIL("failed to reproduce cached price:\n"
776-
<< QL_FIXED
776+
<< std::fixed
777777
<< " calculated: " << price << "\n"
778778
<< " expected: " << cachedPrice2 << "\n"
779779
<< " error: " << price-cachedPrice2);
@@ -799,7 +799,7 @@ void BondTest::testCachedFixed() {
799799
price = bond3.cleanPrice();
800800
if (std::fabs(price-cachedPrice3) > tolerance) {
801801
BOOST_FAIL("failed to reproduce cached price:\n"
802-
<< QL_FIXED
802+
<< std::fixed
803803
<< " calculated: " << price << "\n"
804804
<< " expected: " << cachedPrice3 << "\n"
805805
<< " error: " << price-cachedPrice3);
@@ -862,7 +862,7 @@ void BondTest::testCachedFloating() {
862862
Real price = bond1.cleanPrice();
863863
if (std::fabs(price-cachedPrice1) > tolerance) {
864864
BOOST_FAIL("failed to reproduce cached price:\n"
865-
<< QL_FIXED
865+
<< std::fixed
866866
<< " calculated: " << price << "\n"
867867
<< " expected: " << cachedPrice1 << "\n"
868868
<< " error: " << price-cachedPrice1);
@@ -893,7 +893,7 @@ void BondTest::testCachedFloating() {
893893
price = bond2.cleanPrice();
894894
if (std::fabs(price-cachedPrice2) > tolerance) {
895895
BOOST_FAIL("failed to reproduce cached price:\n"
896-
<< QL_FIXED
896+
<< std::fixed
897897
<< " calculated: " << price << "\n"
898898
<< " expected: " << cachedPrice2 << "\n"
899899
<< " error: " << price-cachedPrice2);
@@ -928,7 +928,7 @@ void BondTest::testCachedFloating() {
928928
price = bond3.cleanPrice();
929929
if (std::fabs(price-cachedPrice3) > tolerance) {
930930
BOOST_FAIL("failed to reproduce cached price:\n"
931-
<< QL_FIXED
931+
<< std::fixed
932932
<< " calculated: " << price << "\n"
933933
<< " expected: " << cachedPrice3 << "\n"
934934
<< " error: " << price-cachedPrice3);
@@ -1012,7 +1012,7 @@ void BondTest::testBrazilianCached() {
10121012

10131013
if (std::fabs(price-cachedPrice) > tolerance) {
10141014
BOOST_ERROR("failed to reproduce Andima cached price:\n"
1015-
<< QL_FIXED
1015+
<< std::fixed
10161016
<< " calculated: " << price << "\n"
10171017
<< " expected: " << cachedPrice << "\n"
10181018
<< " error: " << price-cachedPrice << "\n"
@@ -1372,7 +1372,7 @@ void BondTest::testBondFromScheduleWithDateVector()
13721372
Real tolerance = 1e-5;
13731373
if (std::fabs(calculatedPrice - expectedPrice) > tolerance) {
13741374
BOOST_FAIL("failed to reproduce R2048 dirty price"
1375-
<< QL_FIXED << std::setprecision(5)
1375+
<< std::fixed << std::setprecision(5)
13761376
<< "\n expected: " << expectedPrice
13771377
<< "\n calculated: " << calculatedPrice);
13781378
}

test-suite/capfloor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ void CapFloorTest::testVega() {
180180
"\n lengths: " << lengths[j]*Years <<
181181
"\n strike: " << io::rate(strikes[k]) <<
182182
//"\n types: " << types[h] <<
183-
QL_FIXED << std::setprecision(12) <<
183+
std::fixed << std::setprecision(12) <<
184184
"\n calculated: " << analyticalVega <<
185185
"\n expected: " << numericalVega <<
186186
"\n discrepancy: " << io::rate(discrepancy) <<

0 commit comments

Comments
 (0)