Added FAILING: IntegrationTest to parse EQUIL

This commit is contained in:
Joakim Hove 2013-08-06 16:28:48 +02:00
parent 946485e2b4
commit c864576424
3 changed files with 72 additions and 0 deletions

View File

@ -5,10 +5,17 @@ target_link_libraries(runIntegrationTests Parser ${Boost_LIBRARIES})
add_test(NAME runIntegrationTests WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runIntegrationTests)
set_property(SOURCE IntegrationTests.cpp PROPERTY COMPILE_FLAGS "-Wno-error")
add_executable(runParseWCONHIST ParseWCONHIST.cpp)
target_link_libraries(runParseWCONHIST Parser ${Boost_LIBRARIES})
add_test(NAME runParseWCONHIST WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runParseWCONHIST)
add_executable(runParseEQUIL ParseEQUIL.cpp)
target_link_libraries(runParseEQUIL Parser ${Boost_LIBRARIES})
add_test(NAME runParseEQUIL WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND runParseEQUIL)
add_executable(runIntegrationTestsInternalData IntegrationTestsInternalData.cpp)
target_link_libraries(runIntegrationTestsInternalData Parser ${Boost_LIBRARIES})
add_test(NAME runIntegrationTestsInternalData WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH} COMMAND ${EXECUTABLE_OUTPUT_PATH}/runIntegrationTestsInternalData )

View File

@ -0,0 +1,59 @@
/*
Copyright 2013 Statoil ASA.
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 ParserIntegrationTests
#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/Parser/ParserRecord.hpp>
#include <opm/parser/eclipse/Parser/ParserIntItem.hpp>
#include <opm/parser/eclipse/Parser/ParserStringItem.hpp>
#include <opm/parser/eclipse/Parser/ParserEnums.hpp>
using namespace Opm;
BOOST_AUTO_TEST_CASE( parse_EQUIL_OK ) {
ParserPtr parser(new Parser(JSON_CONFIG_FILE));
boost::filesystem::path wconhistFile("testdata/EQUIL/EQUIL1");
DeckPtr deck = parser->parse(wconhistFile.string());
DeckKeywordConstPtr kw1 = deck->getKeyword("EQUIL" , 0);
BOOST_CHECK_EQUAL( 2U , kw1->size() );
DeckRecordConstPtr rec1 = kw1->getRecord(0);
BOOST_CHECK_EQUAL( 9U , rec1->size() );
DeckRecordConstPtr rec2 = kw1->getRecord(1);
BOOST_CHECK_EQUAL( 9U , rec2->size() );
DeckItemConstPtr item1 = rec1->getItem("OWC");
DeckItemConstPtr item1_index = rec1->getItem(2);
BOOST_CHECK_EQUAL( item1 , item1_index );
BOOST_CHECK( fabs(item1->getDouble(0) - 2469) < 0.001);
}

6
testdata/EQUIL/EQUIL1 vendored Normal file
View File

@ -0,0 +1,6 @@
EQLDIMS
2 100 20 /
EQUIL
2469 382.4 1705.0 0.0 500 0.0 1 1 20 /
2469 382.4 1000.0 0.0 500 0.0 1 1 20 /