Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
curvespecparser.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2021 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19#include <boost/make_shared.hpp>
20#include <boost/test/unit_test.hpp>
22
23#include <oret/toplevelfixture.hpp>
24
25using std::string;
26
27using namespace boost::unit_test_framework;
28using namespace std;
29using namespace ore::data;
30
31namespace {
32
33void checkCurveSpec(const string& spec, CurveSpec::CurveType curveType, const string& curveId) {
34 auto curveSpec = parseCurveSpec(spec);
35
36 BOOST_CHECK_EQUAL(curveSpec->baseType(), curveType);
37 BOOST_CHECK_EQUAL(curveSpec->curveConfigID(), curveId);
38}
39
40}
41
42// CurveSpecParser test
43
44BOOST_FIXTURE_TEST_SUITE(OREDataTestSuite, ore::test::TopLevelFixture)
45
46BOOST_AUTO_TEST_SUITE(CurveSpecParserTests)
47
48BOOST_AUTO_TEST_CASE(testCurveSpecParsing) {
49 checkCurveSpec("Equity/USD/.SPX", CurveSpec::CurveType::Equity, ".SPX");
50 checkCurveSpec("Equity/USD/BBG:BRK\\/B UN Equity", CurveSpec::CurveType::Equity, "BBG:BRK/B UN Equity");
51 checkCurveSpec("Yield/USD/USD-FedFunds", CurveSpec::CurveType::Yield, "USD-FedFunds");
52}
53
54BOOST_AUTO_TEST_SUITE_END()
55
56BOOST_AUTO_TEST_SUITE_END()
CurveType
Supported curve types.
Definition: curvespec.hpp:43
CurveSpec parser.
QuantLib::ext::shared_ptr< CurveSpec > parseCurveSpec(const string &s)
function to convert a string into a curve spec
BOOST_AUTO_TEST_CASE(testCurveSpecParsing)