32 {
33
34 BOOST_TEST_MESSAGE("Testing QuantExt::LogQuote...");
35 QuantLib::ext::shared_ptr<SimpleQuote> quote(new QuantLib::SimpleQuote(1.0));
36 Handle<Quote> qh(quote);
37 Handle<Quote> logQuote(QuantLib::ext::shared_ptr<Quote>(
new LogQuote(qh)));
38
39 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
40
41 quote->setValue(2.0);
42 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
43
44 quote->setValue(3.0);
45 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
46
47 quote->setValue(123.0);
48 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
49
50
51 BOOST_CHECK_THROW(quote->setValue(-1.0), std::exception);
52}
Class for storing logs of quotes for log-linear interpolation.