From 0b6d36658d8e1ce62dce6760495804554b8c045e Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Fri, 7 Sep 2018 13:22:40 +0200 Subject: [PATCH] changed: pass basenames as std::string to unify code with the other comparison classes --- examples/test_util/summaryComparator.cpp | 8 +++++--- examples/test_util/summaryComparator.hpp | 4 +++- examples/test_util/summaryIntegrationTest.hpp | 3 ++- examples/test_util/summaryRegressionTest.hpp | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/test_util/summaryComparator.cpp b/examples/test_util/summaryComparator.cpp index 63b6de0b2..216cb7b9c 100644 --- a/examples/test_util/summaryComparator.cpp +++ b/examples/test_util/summaryComparator.cpp @@ -25,9 +25,11 @@ #include #include -SummaryComparator::SummaryComparator(const char* basename1, const char* basename2, double absoluteTol, double relativeTol){ - ecl_sum1 = ecl_sum_fread_alloc_case(basename1, ":"); - ecl_sum2 = ecl_sum_fread_alloc_case(basename2, ":"); +SummaryComparator::SummaryComparator(const std::string& basename1, + const std::string& basename2, + double absoluteTol, double relativeTol){ + ecl_sum1 = ecl_sum_fread_alloc_case(basename1.c_str(), ":"); + ecl_sum2 = ecl_sum_fread_alloc_case(basename2.c_str(), ":"); if (ecl_sum1 == nullptr || ecl_sum2 == nullptr) { OPM_THROW(std::runtime_error, "Not able to open files"); } diff --git a/examples/test_util/summaryComparator.hpp b/examples/test_util/summaryComparator.hpp index fc6d70c63..32f15c112 100644 --- a/examples/test_util/summaryComparator.hpp +++ b/examples/test_util/summaryComparator.hpp @@ -145,7 +145,9 @@ class SummaryComparator { //! \param[in] absoluteTolerance The absolute tolerance which is to be used in the test. //! \param[in] relativeTolerance The relative tolerance which is to be used in the test. //! \details The constructor creates an object of the class, and openes the files, an exception is thrown if the opening of the files fails. \n It creates stringlists, in which keywords are to be stored, and figures out which keylist that contains the more/less keywords. \n Also the private member variables aboluteTolerance and relativeTolerance are set. - SummaryComparator(const char* basename1, const char* basename2, double absoluteTolerance, double relativeTolerance); + SummaryComparator(const std::string& basename1, + const std::string& basename2, + double absoluteTolerance, double relativeTolerance); //! \brief Destructor //! \details The destructor takes care of the allocated memory in which data has been stored. diff --git a/examples/test_util/summaryIntegrationTest.hpp b/examples/test_util/summaryIntegrationTest.hpp index be25d9382..96d339aa3 100644 --- a/examples/test_util/summaryIntegrationTest.hpp +++ b/examples/test_util/summaryIntegrationTest.hpp @@ -124,7 +124,8 @@ class SummaryIntegrationTest: public SummaryComparator { //! \param[in] atol The absolute tolerance which is to be used in the test. //! \param[in] rtol The relative tolerance which is to be used in the test. //! \details The constructor calls the constructor of the super class. - SummaryIntegrationTest(const char* basename1, const char* basename2, + SummaryIntegrationTest(const std::string& basename1, + const std::string& basename2, double atol, double rtol) : SummaryComparator(basename1, basename2, atol, rtol) {} diff --git a/examples/test_util/summaryRegressionTest.hpp b/examples/test_util/summaryRegressionTest.hpp index 5e0dd6027..4dbdf6af0 100644 --- a/examples/test_util/summaryRegressionTest.hpp +++ b/examples/test_util/summaryRegressionTest.hpp @@ -55,8 +55,8 @@ class SummaryRegressionTest: public SummaryComparator { //! \param[in] relativeTol The relative tolerance which is to be used in the test. //! \param[in] absoluteTol The absolute tolerance which is to be used in the test. //! \details The constructor calls the constructor of the super class. - SummaryRegressionTest(const char* basename1, - const char* basename2, + SummaryRegressionTest(const std::string& basename1, + const std::string& basename2, double relativeTol, double absoluteTol) : SummaryComparator(basename1, basename2, relativeTol, absoluteTol) {}