boost::shared_ptr<BlackVolTermStructure> volTS = flatVol(today,vol,dc);
boost::shared_ptr<BlackVolTermStructure> volTS = flatVol(today,vol);
    void testEngineConsistency(EngineType *engines,                               Size N,                               Size binomialSteps,                               Size samples,                               Real tolerance) {        QL_TEST_START_TIMING        // test options        Option::Type types[] = { Option::Call, Option::Put };        Real strikes[] = { 75.0, 100.0, 125.0 };        Integer lengths[] = { 1 };        // test data        Real underlyings[] = { 100.0 };        Rate qRates[] = { 0.00, 0.05 };        Rate rRates[] = { 0.01, 0.05, 0.15 };        Volatility vols[] = { 0.11, 0.50, 1.20 };        DayCounter dc = Actual360();        Date today = Date::todaysDate();        boost::shared_ptr<SimpleQuote> spot(new SimpleQuote(0.0));        boost::shared_ptr<SimpleQuote> vol(new SimpleQuote(0.0));        boost::shared_ptr<BlackVolTermStructure> volTS = flatVol(today,vol,dc);        boost::shared_ptr<SimpleQuote> qRate(new SimpleQuote(0.0));        boost::shared_ptr<YieldTermStructure> qTS = flatRate(today,qRate,dc);        boost::shared_ptr<SimpleQuote> rRate(new SimpleQuote(0.0));        boost::shared_ptr<YieldTermStructure> rTS = flatRate(today,rRate,dc);        for (Size i=0; i<LENGTH(types); i++) {          for (Size j=0; j<LENGTH(strikes); j++) {            for (Size k=0; k<LENGTH(lengths); k++) {              Date exDate = today + lengths[k]*360;              boost::shared_ptr<Exercise> exercise(                                                new EuropeanExercise(exDate));              boost::shared_ptr<StrikedTypePayoff> payoff(new                  PlainVanillaPayoff(types[i], strikes[j]));              // reference option              boost::shared_ptr<VanillaOption> refOption =                  makeOption(payoff, exercise, spot, qTS, rTS, volTS,                             Analytic, Null<Size>(), Null<Size>());              // options to check              std::map<EngineType,boost::shared_ptr<VanillaOption> > options;              for (Size ii=0; ii<N; ii++) {                  options[engines[ii]] =                      makeOption(payoff, exercise, spot,                                 qTS, rTS, volTS, engines[ii],                                 binomialSteps, samples);              }              for (Size l=0; l<LENGTH(underlyings); l++) {                for (Size m=0; m<LENGTH(qRates); m++) {                  for (Size n=0; n<LENGTH(rRates); n++) {                    for (Size p=0; p<LENGTH(vols); p++) {                      Real u = underlyings[l];                      Rate q = qRates[m],                           r = rRates[n];                      Volatility v = vols[p];                      spot->setValue(u);                      qRate->setValue(q);                      rRate->setValue(r);                      vol->setValue(v);                      Real refValue = refOption->NPV();                      for (Size ii=0; ii<N; ii++) {                          Real value = options[engines[ii]]->NPV();                          Real relErr = relativeError(value,refValue,u);                          if (relErr > tolerance) {                              BOOST_FAIL("European "                                  + OptionTypeFormatter::toString(types[i]) +                                  " option :\n"                                  "    spot value: "                                  + DecimalFormatter::toString(u) + "\n"                                  "    strike:           "                                  + DecimalFormatter::toString(strikes[j])+"\n"                                  "    dividend yield:   "                                  + RateFormatter::toString(q) + "\n"                                  "    risk-free rate:   "                                  + RateFormatter::toString(r) + "\n"                                  "    reference date:   "                                  + DateFormatter::toString(today) + "\n"                                  "    maturity:         "                                  + DateFormatter::toString(exDate) + "\n"                                  "    volatility:       "                                  + VolatilityFormatter::toString(v) + "\n\n"                                  "    analytic value: "                                  + DecimalFormatter::toString(refValue) + "\n"                                  "    "                                  + engineTypeToString(engines[ii]) + ":  "                                  + DecimalFormatter::toString(value) + "\n"                                  "    relative error: " \                                  + DecimalFormatter::toString(relErr) + "\n"                                  "         tolerance: " \                                  + DecimalFormatter::toString(tolerance));                          }                      }                    }                  }                }              }            }          }        }    }