changed: move the comparison classes out of libopmcommon

these classes are really not made for reusability.
thus they should only be built into the applications.
This commit is contained in:
Arne Morten Kvarving
2018-09-07 12:46:42 +02:00
parent 085bbc263b
commit bee4590aaa
14 changed files with 41 additions and 34 deletions

View File

@@ -132,5 +132,34 @@ endmacro (install_hook)
# all setup common to the OPM library modules is done here # all setup common to the OPM library modules is done here
include (OpmLibMain) include (OpmLibMain)
# Build the compare utilities
if(ENABLE_ECL_INPUT)
add_library(testutil STATIC
examples/test_util/EclFilesComparator.cpp
examples/test_util/summaryComparator.cpp
examples/test_util/summaryIntegrationTest.cpp
examples/test_util/summaryRegressionTest.cpp)
target_link_libraries(testutil ecl)
foreach(app compareECL compareSummary)
add_executable(${app} examples/test_util/${app}.cpp)
target_link_libraries(${app} testutil opmcommon)
endforeach()
# Add the tests
set(_libs testutil opmcommon
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
opm_add_test(test_compareSummary CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs})
opm_add_test(test_EclFilesComparator CONDITION ENABLE_ECL_INPUT
LIBRARIES ${_libs})
if(HAVE_DYNAMIC_BOOST_TEST AND NOT BUILD_SHARED_LIBS)
set_target_properties(test_compareSummary PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
set_target_properties(test_EclFilesComparator PROPERTIES
COMPILE_DEFINITIONS BOOST_TEST_DYN_LINK)
endif()
install(TARGETS compareECL compareSummary DESTINATION bin)
endif()
# Install build system files # Install build system files
install(DIRECTORY cmake DESTINATION share/opm) install(DIRECTORY cmake DESTINATION share/opm)

View File

@@ -135,10 +135,6 @@ if(ENABLE_ECL_INPUT)
endif() endif()
if(ENABLE_ECL_OUTPUT) if(ENABLE_ECL_OUTPUT)
list( APPEND MAIN_SOURCE_FILES list( APPEND MAIN_SOURCE_FILES
src/opm/test_util/summaryIntegrationTest.cpp
src/opm/test_util/summaryRegressionTest.cpp
src/opm/test_util/summaryComparator.cpp
src/opm/test_util/EclFilesComparator.cpp
src/opm/output/eclipse/AggregateWellData.cpp src/opm/output/eclipse/AggregateWellData.cpp
src/opm/output/eclipse/CreateDoubHead.cpp src/opm/output/eclipse/CreateDoubHead.cpp
src/opm/output/eclipse/CreateInteHead.cpp src/opm/output/eclipse/CreateInteHead.cpp
@@ -237,8 +233,6 @@ if(ENABLE_ECL_OUTPUT)
list (APPEND TEST_SOURCE_FILES list (APPEND TEST_SOURCE_FILES
tests/test_AggregateWellData.cpp tests/test_AggregateWellData.cpp
tests/test_CharArrayNullTerm.cpp tests/test_CharArrayNullTerm.cpp
tests/test_compareSummary.cpp
tests/test_EclFilesComparator.cpp
tests/test_EclipseIO.cpp tests/test_EclipseIO.cpp
tests/test_DoubHEAD.cpp tests/test_DoubHEAD.cpp
tests/test_InteHEAD.cpp tests/test_InteHEAD.cpp
@@ -283,12 +277,6 @@ if(ENABLE_ECL_INPUT)
examples/opmpack.cpp examples/opmpack.cpp
) )
endif() endif()
if(ENABLE_ECL_OUTPUT)
list(APPEND EXAMPLE_SOURCE_FILES
examples/test_util/compareECL.cpp
examples/test_util/compareSummary.cpp
)
endif()
# programs listed here will not only be compiled, but also marked for # programs listed here will not only be compiled, but also marked for
# installation # installation
@@ -300,12 +288,6 @@ if(ENABLE_ECL_INPUT)
examples/opmpack.cpp examples/opmpack.cpp
) )
endif() endif()
if(ENABLE_ECL_OUTPUT)
list(APPEND PROGRAM_SOURCE_FILES
examples/test_util/compareECL.cpp
examples/test_util/compareSummary.cpp
)
endif()
list( APPEND PUBLIC_HEADER_FILES list( APPEND PUBLIC_HEADER_FILES
opm/common/ErrorMacros.hpp opm/common/ErrorMacros.hpp
@@ -517,9 +499,5 @@ if(ENABLE_ECL_OUTPUT)
opm/output/eclipse/WindowedArray.hpp opm/output/eclipse/WindowedArray.hpp
opm/output/eclipse/WriteRestartHelpers.hpp opm/output/eclipse/WriteRestartHelpers.hpp
opm/output/OutputWriter.hpp opm/output/OutputWriter.hpp
opm/test_util/EclFilesComparator.hpp
opm/test_util/summaryComparator.hpp
opm/test_util/summaryIntegrationTest.hpp
opm/test_util/summaryRegressionTest.hpp
) )
endif() endif()

View File

@@ -16,7 +16,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/test_util/EclFilesComparator.hpp> #include "EclFilesComparator.hpp"
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <opm/common/utility/numeric/calculateCellVol.hpp> #include <opm/common/utility/numeric/calculateCellVol.hpp>

View File

@@ -16,7 +16,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/test_util/EclFilesComparator.hpp> #include "EclFilesComparator.hpp"
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <ert/util/util.h> #include <ert/util/util.h>

View File

@@ -18,8 +18,8 @@
*/ */
#include <opm/test_util/summaryRegressionTest.hpp> #include "summaryRegressionTest.hpp"
#include <opm/test_util/summaryIntegrationTest.hpp> #include "summaryIntegrationTest.hpp"
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>

View File

@@ -16,7 +16,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/test_util/summaryComparator.hpp> #include "summaryComparator.hpp"
#include <ert/ecl/ecl_sum.h> #include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h> #include <ert/util/stringlist.h>
#include <ert/util/int_vector.h> #include <ert/util/int_vector.h>

View File

@@ -17,7 +17,7 @@
*/ */
#include <opm/test_util/summaryIntegrationTest.hpp> #include "summaryIntegrationTest.hpp"
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h> #include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h> #include <ert/util/stringlist.h>

View File

@@ -17,7 +17,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/test_util/summaryComparator.hpp> #include "summaryComparator.hpp"
//! \brief Struct for storing the total area under a graph. //! \brief Struct for storing the total area under a graph.
//! \details Used when plotting summary vector against time. In most cases this represents a volume. //! \details Used when plotting summary vector against time. In most cases this represents a volume.

View File

@@ -16,7 +16,7 @@
along with OPM. If not, see <http://www.gnu.org/licenses/>. along with OPM. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <opm/test_util/summaryRegressionTest.hpp> #include "summaryRegressionTest.hpp"
#include <opm/common/ErrorMacros.hpp> #include <opm/common/ErrorMacros.hpp>
#include <ert/ecl/ecl_sum.h> #include <ert/ecl/ecl_sum.h>
#include <ert/util/stringlist.h> #include <ert/util/stringlist.h>

View File

@@ -20,7 +20,7 @@
#ifndef SUMMARYREGRESSIONTEST_HPP #ifndef SUMMARYREGRESSIONTEST_HPP
#define SUMMARYREGRESSIONTEST_HPP #define SUMMARYREGRESSIONTEST_HPP
#include <opm/test_util/summaryComparator.hpp> #include "summaryComparator.hpp"
//! \details The class inherits from the SummaryComparator class, which takes care of all file reading. \n The RegressionTest class compares the values from the two different files and throws exceptions when the deviation is unsatisfying. //! \details The class inherits from the SummaryComparator class, which takes care of all file reading. \n The RegressionTest class compares the values from the two different files and throws exceptions when the deviation is unsatisfying.
class RegressionTest: public SummaryComparator { class RegressionTest: public SummaryComparator {

View File

@@ -21,7 +21,7 @@
#define BOOST_TEST_MODULE EclFilesComparatorTest #define BOOST_TEST_MODULE EclFilesComparatorTest
#include <boost/test/unit_test.hpp> #include <boost/test/unit_test.hpp>
#include <opm/test_util/EclFilesComparator.hpp> #include <examples/test_util/EclFilesComparator.hpp>
BOOST_AUTO_TEST_CASE(deviation) { BOOST_AUTO_TEST_CASE(deviation) {
double a = 1; double a = 1;

View File

@@ -18,8 +18,8 @@
#include "config.h" #include "config.h"
#include <opm/test_util/summaryComparator.hpp> #include <examples/test_util/summaryComparator.hpp>
#include <opm/test_util/summaryIntegrationTest.hpp> #include <examples/test_util/summaryIntegrationTest.hpp>
#define BOOST_TEST_MODULE CalculationTest #define BOOST_TEST_MODULE CalculationTest