diff --git a/OREAnalytics/orea/app/inputparameters.hpp b/OREAnalytics/orea/app/inputparameters.hpp index 66c3a8b090..24e3451121 100644 --- a/OREAnalytics/orea/app/inputparameters.hpp +++ b/OREAnalytics/orea/app/inputparameters.hpp @@ -731,7 +731,7 @@ class InputParameters : public QuantLib::ext::enable_shared_from_this& grid) { parameters_.set("xva", "creditMigrationDistributionGrid", grid); } void setCreditSimulationParameters(const QuantLib::ext::shared_ptr& c) { parameters_.set("xva", "creditMigrationConfig", c); } void setCreditSimulationParametersFromBuffer(const std::string& xml ) { parameters_.set("xva", "creditMigrationConfig", xml); } diff --git a/OREAnalytics/test/CMakeLists.txt b/OREAnalytics/test/CMakeLists.txt index 354d3cf848..c886b6a889 100644 --- a/OREAnalytics/test/CMakeLists.txt +++ b/OREAnalytics/test/CMakeLists.txt @@ -4,6 +4,7 @@ set(OREAnalytics-Test_SRC aggregationscenariodata.cpp amcbermudanswaption.cpp cube.cpp historicalscenariogenerator.cpp +inputparameters.cpp nettedexpsoure.cpp observationmode.cpp parsensitivityanalysis.cpp diff --git a/OREAnalytics/test/inputparameters.cpp b/OREAnalytics/test/inputparameters.cpp new file mode 100644 index 0000000000..a1c27c63ac --- /dev/null +++ b/OREAnalytics/test/inputparameters.cpp @@ -0,0 +1,51 @@ +/* + Copyright (C) 2026 Quaternion Risk Management Ltd + All rights reserved. + + This file is part of ORE, a free-software/open-source library + for transparent pricing and risk analysis - http://opensourcerisk.org + + ORE is free software: you can redistribute it and/or modify it + under the terms of the Modified BSD License. You should have received a + copy of the license along with this program. + The license is also available online at + + This program is distributed on the basis that it will form a useful + contribution to risk analytics and model standardisation, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the license for more details. +*/ + +#include +#include + +#include +#include + +using namespace ore::analytics; +using namespace ore::data; +using namespace boost::unit_test_framework; + +BOOST_FIXTURE_TEST_SUITE(OREAnalyticsTestSuite, ore::test::OreaTopLevelFixture) + +BOOST_AUTO_TEST_SUITE(InputParametersTest) + +BOOST_AUTO_TEST_CASE(testCreditMigrationAnalyticSetter) { + BOOST_TEST_MESSAGE("Testing that setCreditMigrationAnalytic sets the creditMigration flag and nothing else"); + + auto inputs = QuantLib::ext::make_shared(); + inputs->setCreditMigrationAnalytic(true); + + bool creditMigration = false; + BOOST_CHECK(inputs->loadParameter(creditMigration, "xva", "creditMigration", false, parseBool)); + BOOST_CHECK(creditMigration); + + QuantLib::Real riskWeight = 0.05; + BOOST_CHECK_NO_THROW( + inputs->loadParameter(riskWeight, "xva", "kvaTheirCvaRiskWeight", false, parseReal)); + BOOST_CHECK_EQUAL(riskWeight, 0.05); +} + +BOOST_AUTO_TEST_SUITE_END() + +BOOST_AUTO_TEST_SUITE_END()