|
23 | 23 | // clang-format on |
24 | 24 | #include <qle/cashflows/averageonindexedcoupon.hpp> |
25 | 25 | #include <qle/cashflows/averageonindexedcouponpricer.hpp> |
26 | | -#include <format> |
27 | 26 | #include <oret/util/datapaths.hpp> |
28 | 27 | #include <string> |
| 28 | +#include <sstream> |
| 29 | +#include <iomanip> |
29 | 30 |
|
30 | 31 | using namespace QuantLib; |
31 | 32 | using namespace QuantExt; |
@@ -71,10 +72,15 @@ BOOST_DATA_TEST_CASE(testCpnAccruals, idxCpnVariants, lb, os, ts, useApprox, rco |
71 | 72 | #endif |
72 | 73 | { |
73 | 74 | // Create the coupon ID for output file. |
74 | | - string strOs = os ? "os" : "nos"; |
75 | | - string strTs = ts ? "ts" : "nts"; |
76 | | - string strApprox = useApprox ? "approx" : "napprox"; |
77 | | - string cpnName = format("acc_{:02d}_lb-{}_{}_rco-{}_{}_{}", idx, lb, strOs, rco, strTs, strApprox); |
| 75 | + ostringstream oss; |
| 76 | + oss << "acc_" |
| 77 | + << std::setw(2) << std::setfill('0') << idx |
| 78 | + << "_lb-" << lb |
| 79 | + << "_" << (os ? "os" : "nos") |
| 80 | + << "_rco-" << rco |
| 81 | + << "_" << (ts ? "ts" : "nts") |
| 82 | + << "_" << (useApprox ? "approx" : "napprox"); |
| 83 | + string cpnName = oss.str(); |
78 | 84 |
|
79 | 85 | // Create the coupon. |
80 | 86 | TestCouponData tcd; |
@@ -110,12 +116,17 @@ BOOST_DATA_TEST_CASE(testCpnAccrualsGearingSpread, idxGsCpnVariants, gearing, sp |
110 | 116 | #endif |
111 | 117 | { |
112 | 118 | // Create the coupon ID for output file, maintaining format of previous tests with additional fields. |
113 | | - string strTs = ts ? "ts" : "nts"; |
114 | | - string strSibd = sibd ? "sibd" : "sih"; |
115 | | - string strEibd = eibd ? "eibd" : "eih"; |
116 | | - string strApprox = useApprox ? "approx" : "napprox"; |
117 | | - string cpnName = format("gs_{:02d}_lb-0_nos_rco-0_{}_g-{:g}_s-{:g}_{}_{}_{}", |
118 | | - idx, strTs, gearing, spread, strSibd, strEibd, strApprox); |
| 119 | + ostringstream oss; |
| 120 | + oss << "gs_" |
| 121 | + << std::setw(2) << std::setfill('0') << idx |
| 122 | + << "_lb-0_nos_rco-0_" |
| 123 | + << (ts ? "ts" : "nts") |
| 124 | + << "_g-" << gearing |
| 125 | + << "_s-" << spread |
| 126 | + << "_" << (sibd ? "sibd" : "sih") |
| 127 | + << "_" << (eibd ? "eibd" : "eih") |
| 128 | + << "_" << (useApprox ? "approx" : "napprox"); |
| 129 | + string cpnName = oss.str(); |
119 | 130 |
|
120 | 131 | // Create the coupon. |
121 | 132 | TestCouponData tcd; |
@@ -143,8 +154,13 @@ BOOST_DATA_TEST_CASE(testCpnAccrualsAll, bdata::make({true, false}) ^ bdata::xra |
143 | 154 | { |
144 | 155 | // Create the coupon ID for output file, maintaining format of previous tests with additional fields. |
145 | 156 | // fl-1 indicates fixing lag of 1 BD. |
146 | | - string strApprox = useApprox ? "approx" : "napprox"; |
147 | | - string cpnName = format("all_{:02d}_lb-2_os_rco-3_nts_g-1p5_s-10_{}_sibd_eibd_fl-1", idx, strApprox); |
| 157 | + ostringstream oss; |
| 158 | + oss << "all_" |
| 159 | + << std::setw(2) << std::setfill('0') << idx |
| 160 | + << "_lb-2_os_rco-3_nts_g-1p5_s-10_" |
| 161 | + << (useApprox ? "approx" : "napprox") |
| 162 | + << "_sibd_eibd_fl-1"; |
| 163 | + string cpnName = oss.str(); |
148 | 164 |
|
149 | 165 | // Create the coupon. |
150 | 166 | TestCouponData tcd; |
|
0 commit comments