@Test
//FIXME: http://bugs.jquantlib.org/view.php?id=472
public void testYield() {
QL.info("Testing consistency of bond price/yield calculation....");
final Calendar calendar = new org.jquantlib.time.calendars.Target();
final Date today = calendar.adjust(Date.todaysDate());
final double faceAmount = 1000000.0;
final double tolerance = 1.0e-7;
final int maxEvaluations = 100;
final int issueMonths[] = { -24, -18, -12, -6, 0, 6, 12, 18, 24 };
final int lengths[] = { 3, 5, 10, 15, 20 };
final int settlementDays = 3;
final double coupons[] = { 0.02, 0.05, 0.08 };
final Frequency frequencies[] = { Frequency.Semiannual, Frequency.Annual };
final DayCounter bondDayCount = new Thirty360();
final BusinessDayConvention accrualConvention = BusinessDayConvention.Unadjusted;
final BusinessDayConvention paymentConvention = BusinessDayConvention.ModifiedFollowing;
final double redemption = 100.0;
final double yields[] = { 0.03, 0.04, 0.05, 0.06, 0.07 };
final Compounding compounding[] = { Compounding.Compounded, Compounding.Continuous };
for (int i = 0; i < (issueMonths).length; i++) {
for (int j = 0; j < (lengths).length; j++) {
for (int k = 0; k < (coupons).length; k++) {
for (int l = 0; l < (frequencies).length; l++) {
for (int n = 0; n < (compounding).length; n++) {
final Date dated = calendar.advance(today, issueMonths[i], TimeUnit.Months);
final Date issue = dated;
final Date maturity = calendar.advance(issue, lengths[j], TimeUnit.Years);
final Schedule sch = new Schedule(
dated,
maturity,
new Period(frequencies[l]),