From 786908f723eb85b55b799e1216d7ac386fda8899 Mon Sep 17 00:00:00 2001 From: Kai Bao Date: Mon, 27 Apr 2015 11:31:05 +0200 Subject: [PATCH] Adding integration test for PLYSHLOG. --- .../eclipse/IntegrationTests/CMakeLists.txt | 4 ++ .../IntegrationTests/ParsePLYSHLOG.cpp | 61 +++++++++++++++++++ .../integration_tests/POLYMER/plyshlog.data | 14 +++++ 3 files changed, 79 insertions(+) create mode 100644 opm/parser/eclipse/IntegrationTests/ParsePLYSHLOG.cpp create mode 100644 testdata/integration_tests/POLYMER/plyshlog.data diff --git a/opm/parser/eclipse/IntegrationTests/CMakeLists.txt b/opm/parser/eclipse/IntegrationTests/CMakeLists.txt index fb46f5a36..88e47f31f 100644 --- a/opm/parser/eclipse/IntegrationTests/CMakeLists.txt +++ b/opm/parser/eclipse/IntegrationTests/CMakeLists.txt @@ -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) diff --git a/opm/parser/eclipse/IntegrationTests/ParsePLYSHLOG.cpp b/opm/parser/eclipse/IntegrationTests/ParsePLYSHLOG.cpp new file mode 100644 index 000000000..4e3698cd8 --- /dev/null +++ b/opm/parser/eclipse/IntegrationTests/ParsePLYSHLOG.cpp @@ -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 . + */ + +#define BOOST_TEST_MODULE ParsePLYSHLOG +#include + +#include +#include + +#include +#include +#include + +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) ); +} diff --git a/testdata/integration_tests/POLYMER/plyshlog.data b/testdata/integration_tests/POLYMER/plyshlog.data new file mode 100644 index 000000000..87d27979a --- /dev/null +++ b/testdata/integration_tests/POLYMER/plyshlog.data @@ -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 +/ +