start for unit tests

This commit is contained in:
goncalvesmachadoc
2023-07-06 13:04:58 +02:00
parent 94e9900d39
commit 0aa2941150
3 changed files with 37 additions and 0 deletions

View File

@@ -504,6 +504,7 @@ if(ENABLE_ECL_INPUT)
tests/parser/ImportTests.cpp
tests/parser/InitConfigTest.cpp
tests/parser/IOConfigTests.cpp
tests/parser/LgrTests.cpp
tests/parser/MICPTests.cpp
tests/parser/MessageLimitTests.cpp
tests/parser/MultiRegTests.cpp

View File

@@ -20,6 +20,7 @@
#include <opm/input/eclipse/EclipseState/Grid/GridDims.hpp>
#include <opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp>
#include <opm/input/eclipse/EclipseState/Grid/CarfinManager.hpp>
#include <opm/input/eclipse/EclipseState/Grid/Carfin.hpp>
#include <opm/input/eclipse/Parser/ParserKeywords/C.hpp>
@@ -59,4 +60,12 @@ namespace Opm {
return m_lgrs.count( lgrName ) > 0;
}
const Carfin& LgrCollection::getLgr(const std::string& lgrName) const {
return m_lgrs.get( lgrName );
}
Carfin& LgrCollection::getLgr(const std::string& lgrName) {
return m_lgrs.get( lgrName );
}
}

27
tests/parser/LgrTests.cpp Normal file
View File

@@ -0,0 +1,27 @@
/*
Copyright (C) 2023 Equinor
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/
#define BOOST_TEST_MODULE CarfinManagerTests
#include <boost/test/unit_test.hpp>
#include <opm/input/eclipse/EclipseState/Grid/LgrCollection.hpp>
BOOST_AUTO_TEST_CASE(CreateLgrCollection) {
Opm::LgrCollection lgrs;
BOOST_CHECK_EQUAL( lgrs.size() , 0U );
BOOST_CHECK(! lgrs.hasLgr("NO-NotThisOne"));
BOOST_CHECK_THROW( lgrs.getLgr("NO") , std::invalid_argument );
}