Skip to content

Commit

Permalink
Added method to verify report steps.
Browse files Browse the repository at this point in the history
  • Loading branch information
joakim-hove committed Jul 31, 2017
1 parent c0c5874 commit dd4944c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
20 changes: 20 additions & 0 deletions opm/test_util/summaryComparator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ void SummaryComparator::setTimeVecs(std::vector<double> &timeVec1,
}


bool SummaryComparator::checkReportSteps() const {
int first = ecl_sum_get_first_report_step( ecl_sum1 );
int last = ecl_sum_get_last_report_step( ecl_sum1 );

if (ecl_sum_get_first_report_step(ecl_sum2) != first)
return false;

if (ecl_sum_get_last_report_step(ecl_sum2) != last)
return false;

for (int step=first; step <= last; ++step) {
if (ecl_sum_get_report_time( ecl_sum1 , step ) != ecl_sum_get_report_time( ecl_sum2 , step))
return false;
}

return true;
}



void SummaryComparator::getDataVecs(std::vector<double> &dataVec1,
std::vector<double> &dataVec2,
const char* keyword){
Expand Down
3 changes: 3 additions & 0 deletions opm/test_util/summaryComparator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,9 @@ class SummaryComparator {

//! \brief Set whether to throw on errors or not.
void throwOnErrors(bool dothrow) { throwOnError = dothrow; }

//! \brief Will check if the two summary cases have identical report times
bool checkReportSteps() const;
};

#endif
7 changes: 6 additions & 1 deletion opm/test_util/summaryRegressionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,14 @@ void RegressionTest::getRegressionTest(){
printKeywords();
}


//Iterates over all keywords from the restricted file, use iterator "ivar". Searches for a match in the file with more keywords, use the iterator "jvar".
bool throwAtEnd = false;

if (!checkReportSteps( )) {
HANDLE_ERROR(std::runtime_error, "Report steps are not identical");
throwAtEnd = true;
}

while(ivar < stringlist_get_size(keysShort)){
const char* keyword = stringlist_iget(keysShort, ivar);
std::string keywordString(keyword);
Expand Down

0 comments on commit dd4944c

Please sign in to comment.