From bff992081471a00e438f51e5743b02e5bb09b24e Mon Sep 17 00:00:00 2001 From: Liu Ming Date: Wed, 2 Dec 2015 10:59:13 +0800 Subject: [PATCH] Add simple tests. --- tests/relpermDiagnostics.DATA | 94 +++++++++++++++++++++++++++++++ tests/test_relpermdiagnostics.cpp | 65 +++++++++++++++++++++ 2 files changed, 159 insertions(+) create mode 100644 tests/relpermDiagnostics.DATA create mode 100644 tests/test_relpermdiagnostics.cpp diff --git a/tests/relpermDiagnostics.DATA b/tests/relpermDiagnostics.DATA new file mode 100644 index 000000000..7c34a82e4 --- /dev/null +++ b/tests/relpermDiagnostics.DATA @@ -0,0 +1,94 @@ + +RUNSPEC + +TITLE + + +DIMENS + 10 10 3 / + +EQLDIMS +/ + +TABDIMS +/ + +OIL +GAS +WATER +DISGAS + +FIELD + +START + 1 'JAN' 2015 / + +WELLDIMS + 2 1 1 2 / + +UNIFOUT + +GRID +-- ------------------------------------------------------------------------- +NOECHO + +DX + 300*1000 / +DY + 300*1000 / +DZ + 100*20 100*30 100*50 / + +TOPS + 100*8325 / + +PORO + 300*0.3 / + +PERMX + 100*500 100*50 100*200 / + +PERMY + 100*500 100*50 100*200 / + +PERMZ + 100*500 100*50 100*200 / +ECHO + +PROPS +-- ------------------------------------------------------------------------- +SWOF +0.12 1e-9 1 0 +0.18 4.64876033057851E-008 1 0 +0.24 0.000000186 0.997 0 +0.3 4.18388429752066E-007 0.98 0 +0.36 7.43801652892562E-007 0.7 0 +0.42 1.16219008264463E-006 0.35 0 +0.48 1.67355371900826E-006 0.2 0 +0.54 2.27789256198347E-006 0.09 0 +0.6 2.97520661157025E-006 0.021 0 +0.66 3.7654958677686E-006 0.01 0 +0.72 4.64876033057851E-006 0.001 0 +0.78 0.000005625 0.0001 0 +0.84 6.69421487603306E-006 0 0 +0.91 8.05914256198347E-006 0 0 +1 0.00001 0 0 / + + +SGOF +0 0 1 0 +0.001 0 1 0 +0.02 0 0.997 0 +0.05 0.005 0.980 0 +0.12 0.025 0.700 0 +0.2 0.075 0.350 0 +0.25 0.125 0.200 0 +0.3 0.190 0.090 0 +0.4 0.410 0.021 0 +0.45 0.60 0.010 0 +0.5 0.72 0.001 0 +0.6 0.87 0.0001 0 +0.7 0.94 0.000 0 +0.85 0.98 0.000 0 +0.88 0.984 0.000 0 / +1.00 1.0 0.000 0 / diff --git a/tests/test_relpermdiagnostics.cpp b/tests/test_relpermdiagnostics.cpp new file mode 100644 index 000000000..63e2ed4aa --- /dev/null +++ b/tests/test_relpermdiagnostics.cpp @@ -0,0 +1,65 @@ +/* + Copyright 2015 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 . +*/ + +#include "config.h" + +/* --- Boost.Test boilerplate --- */ +#if HAVE_DYNAMIC_BOOST_TEST +#define BOOST_TEST_DYN_LINK +#endif + +#define NVERBOSE // Suppress own messages when throw()ing + +#define BOOST_TEST_MODULE RelpermDiagnostics +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +BOOST_AUTO_TEST_SUITE () + +BOOST_AUTO_TEST_CASE(diagnosis) +{ + using namespace Opm; + EclipseStateConstPtr eclState; + ParserPtr parser(new Opm::Parser); + Opm::ParseMode parseMode({{ ParseMode::PARSE_RANDOM_SLASH , InputError::IGNORE }, + { ParseMode::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE}, + { ParseMode::PARSE_RANDOM_TEXT, InputError::IGNORE} + }); + Opm::DeckConstPtr deck(parser->parseFile("../tests/relpermDiagnostics.DATA", parseMode)); + eclState.reset(new EclipseState(deck, parseMode)); + + GridManager gm(deck); + const UnstructuredGrid& grid = *gm.c_grid(); + std::string logFile = "LOGFILE.txt"; + RelpermDiagnostics diagnostics(logFile); + diagnostics.diagnosis(eclState, deck, grid); + auto msg = diagnostics.getMessages(); + BOOST_CHECK(!msg.empty()); + BOOST_CHECK_EQUAL(msg.size(), 1); +} +BOOST_AUTO_TEST_SUITE_END()