20#include <boost/test/unit_test.hpp>
21#include <ql/quotes/simplequote.hpp>
25using namespace boost::unit_test_framework;
30BOOST_AUTO_TEST_SUITE(LogQuoteTest)
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)));
39 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
42 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
45 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
47 quote->setValue(123.0);
48 BOOST_CHECK_EQUAL(logQuote->value(), std::log(quote->value()));
51 BOOST_CHECK_THROW(quote->setValue(-1.0), std::exception);
54BOOST_AUTO_TEST_SUITE_END()
56BOOST_AUTO_TEST_SUITE_END()
Class for storing logs of quotes for log-linear interpolation.
stores log of quote for log-linear interpolation
BOOST_AUTO_TEST_CASE(testLogQuote)
Fixture that can be used at top level.