From d9eb3ebf862329dd7a169c5a61012e61b5164c1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Gr=C3=B8n=C3=A5s=20Drange?= Date: Tue, 3 May 2016 13:14:18 +0200 Subject: [PATCH] Added test for IOConfigBaseName and fixed a self-introduced bug in E.S. --- opm/parser/eclipse/EclipseState/EclipseState.cpp | 8 +++++--- .../eclipse/EclipseState/tests/EclipseStateTests.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/opm/parser/eclipse/EclipseState/EclipseState.cpp b/opm/parser/eclipse/EclipseState/EclipseState.cpp index a6f676e70..aa2ef8bef 100644 --- a/opm/parser/eclipse/EclipseState/EclipseState.cpp +++ b/opm/parser/eclipse/EclipseState/EclipseState.cpp @@ -166,13 +166,15 @@ namespace Opm { } void EclipseState::initIOConfig(const Deck& deck) { - m_ioConfig = std::make_shared(); + std::string dataFile = deck.getDataFile(); + m_ioConfig = std::make_shared(dataFile); + if (Section::hasGRID(deck)) { - std::shared_ptr gridSection = std::make_shared(deck); + auto gridSection = std::make_shared(deck); m_ioConfig->handleGridSection(gridSection); } if (Section::hasRUNSPEC(deck)) { - std::shared_ptr runspecSection = std::make_shared(deck); + auto runspecSection = std::make_shared(deck); m_ioConfig->handleRunspecSection(runspecSection); } } diff --git a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp index 68ecf9b6c..e1b1fc344 100644 --- a/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp +++ b/opm/parser/eclipse/EclipseState/tests/EclipseStateTests.cpp @@ -408,6 +408,13 @@ BOOST_AUTO_TEST_CASE(WithGridOptsDefaultRegion) { BOOST_CHECK_NE( &fluxnum , &multnum ); } +BOOST_AUTO_TEST_CASE(TestIOConfigBaseName) { + ParseContext parseContext; + ParserPtr parser(new Parser()); + DeckConstPtr deck = parser->parseFile("testdata/integration_tests/IOConfig/SPE1CASE2.DATA", parseContext); + EclipseState state(*deck, parseContext); + BOOST_CHECK_EQUAL(state.getIOConfig()->getBaseName(), "SPE1CASE2"); +} BOOST_AUTO_TEST_CASE(TestIOConfigCreation) { const char * deckData =