Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
shiftscenariogenerator.cpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2018 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/test/unit_test.hpp>
22#include <oret/toplevelfixture.hpp>
24
25using namespace boost::unit_test_framework;
26using namespace ore::data;
27using namespace ore::analytics;
28
29// Improve readability in this test code
34
35namespace {
36
37// Generate ScenarioDescription objects for testing
38vector<SSDes> generateDescriptions() {
39 vector<SSDes> result;
40
41 result.push_back(SSDes(SSType::Base));
42 result.push_back(SSDes(SSType::Up, RFKey(RFType::DiscountCurve, "EUR", 0), "2W"));
43 result.push_back(SSDes(SSType::Up, RFKey(RFType::IndexCurve, "EUR-EURIBOR-6M", 11), "30Y"));
44 result.push_back(SSDes(SSType::Down, RFKey(RFType::FXSpot, "JPYUSD", 0), "spot"));
45 result.push_back(SSDes(SSType::Up, RFKey(RFType::SwaptionVolatility, "USD", 22), "3M/3Y/ATM"));
46 result.push_back(SSDes(SSDes(SSType::Up, RFKey(RFType::DiscountCurve, "EUR", 0), "2W"),
47 SSDes(SSType::Up, RFKey(RFType::DiscountCurve, "EUR", 1), "1M")));
48 result.push_back(SSDes(SSDes(SSType::Up, RFKey(RFType::FXSpot, "JPYUSD", 0), "spot"),
49 SSDes(SSType::Up, RFKey(RFType::DiscountCurve, "USD", 1), "1M")));
50
51 return result;
52}
53
54} // namespace
55
56BOOST_FIXTURE_TEST_SUITE(OREAnalyticsTestSuite, ore::test::OreaTopLevelFixture)
57
58BOOST_AUTO_TEST_SUITE(ShiftScenarioGeneratorTest)
59
60BOOST_AUTO_TEST_CASE(testShiftScenarioStringConstruction) {
61 string strDes;
62 for (const auto& des : generateDescriptions()) {
63 strDes = to_string(des);
64 SSDes desFromString(strDes);
65 BOOST_CHECK_EQUAL(des, desFromString);
66 }
67}
68
69BOOST_AUTO_TEST_SUITE_END()
70
71BOOST_AUTO_TEST_SUITE_END()
Data types stored in the scenario class.
Definition: scenario.hpp:48
KeyType
Risk Factor types.
Definition: scenario.hpp:51
OREAnalytics Top level fixture.
std::string to_string(const LocationInfo &l)
Fixture that can be used at top level of OREAnalytics test suites.
Shift scenario generation.
RFKey::KeyType RFType
RiskFactorKey RFKey
ShiftScenarioGenerator::ScenarioDescription SSDes
BOOST_AUTO_TEST_CASE(testShiftScenarioStringConstruction)
SSDes::Type SSType