Adding integration test for PLYSHLOG.

This commit is contained in:
Kai Bao
2015-04-27 11:31:05 +02:00
parent ae5c6c4fe9
commit 786908f723
3 changed files with 79 additions and 0 deletions

View File

@@ -38,6 +38,10 @@ add_executable(runParsePLYVISC ParsePLYVISC.cpp)
target_link_libraries(runParsePLYVISC Parser ${Boost_LIBRARIES})
add_test(NAME runParsePLYVISC WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runParsePLYVISC)
add_executable(runParsePLYSHLOG ParsePLYSHLOG.cpp)
target_link_libraries(runParsePLYSHLOG Parser ${Boost_LIBRARIES})
add_test(NAME runParsePLYSHLOG WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runParsePLYSHLOG)
add_executable(runParsePLYADS ParsePLYADS.cpp)
target_link_libraries(runParsePLYADS Parser ${Boost_LIBRARIES})
add_test(NAME runParsePLYADS WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND ${TEST_MEMCHECK_TOOL} ${EXECUTABLE_OUTPUT_PATH}/runParsePLYADS)

View File

@@ -0,0 +1,61 @@
/*
Copyright 2015 SINTEF ICT, Applied Mathematics.
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 ParsePLYSHLOG
#include <math.h>
#include <boost/test/unit_test.hpp>
#include <boost/test/test_tools.hpp>
#include <opm/parser/eclipse/Deck/Deck.hpp>
#include <opm/parser/eclipse/Parser/Parser.hpp>
#include <opm/parser/eclipse/EclipseState/EclipseState.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( PARSE_PLYSHLOG_OK) {
ParserPtr parser(new Parser());
boost::filesystem::path deckFile("testdata/integration_tests/POLYMER/plyshlog.data");
DeckPtr deck = parser->parseFile(deckFile.string());
DeckKeywordConstPtr kw = deck->getKeyword("PLYSHLOG");
DeckRecordConstPtr rec1 = kw->getRecord(0); // reference conditions
const auto itemRefPolyConc = rec1->getItem("REF_POLYMER_CONCENTRATION");
const auto itemRefSali = rec1->getItem("REF_SALINITY");
const auto itemRefTemp = rec1->getItem("REF_TEMPERATURE");
BOOST_CHECK_EQUAL( true, itemRefPolyConc->hasValue(0) );
BOOST_CHECK_EQUAL( true, itemRefSali->hasValue(0) );
BOOST_CHECK_EQUAL( false, itemRefTemp->hasValue(0) );
BOOST_CHECK_EQUAL( 1.0, itemRefPolyConc->getRawDouble(0) );
BOOST_CHECK_EQUAL( 3.0, itemRefSali->getRawDouble(0) );
DeckRecordConstPtr rec2 = kw->getRecord(1);
DeckItemPtr itemData = rec2->getItem(0);
BOOST_CHECK_EQUAL( 1.e-7 , itemData->getRawDouble(0) );
BOOST_CHECK_EQUAL( 1.0 , itemData->getRawDouble(1) );
BOOST_CHECK_EQUAL( 1.0 , itemData->getRawDouble(2) );
BOOST_CHECK_EQUAL( 1.2 , itemData->getRawDouble(3) );
BOOST_CHECK_EQUAL( 1.e3 , itemData->getRawDouble(4) );
BOOST_CHECK_EQUAL( 2.4 , itemData->getRawDouble(5) );
}

View File

@@ -0,0 +1,14 @@
-- THE TABDIMS IS NOT SUPPORTED FOR PLYSHLOG YET.
-- TABDIMS
-- NTSFUN NTPVT NSSFUN NPPVT NTFIP NRPVT
-- 1 1 100 50 1 /
PLYSHLOG
1.0 3.0
/
0.0000001 1.0
1.0 1.2
1000.0 2.4
/