mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-11 13:25:34 -06:00
Some checks for file open and file has keyword.
Using type 'const char*' instead of auto to guarantee C interoperability.
This commit is contained in:
parent
1f4b9e56f8
commit
3729f91b6d
@ -28,6 +28,8 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <cstdlib>
|
||||
|
||||
|
||||
#include <ert/ecl/ecl_rst_file.h>
|
||||
#include <ert/ecl/ecl_kw.h>
|
||||
@ -52,7 +54,18 @@ BOOST_AUTO_TEST_CASE(CompareRestartFileResults)
|
||||
ecl_file_type* file1 = ecl_file_open_rstblock_report_step( filename1.c_str() , last_report_step, 1);
|
||||
ecl_file_type* file2 = ecl_file_open_rstblock_report_step( filename2.c_str() , last_report_step, 1);
|
||||
|
||||
for (auto key : {"PRESSURE", "SWAT", "SGAS", "RS", "RV"}) {
|
||||
if (!file1) {
|
||||
std::cerr << "Failed to open restart file: " << filename1 << std::endl;
|
||||
BOOST_REQUIRE( false );
|
||||
}
|
||||
|
||||
if (!file2) {
|
||||
std::cerr << "Failed to open restart file: " << filename2 << std::endl;
|
||||
BOOST_REQUIRE( false );
|
||||
}
|
||||
|
||||
for (const char * key : {"PRESSURE", "SWAT", "SGAS", "RS", "RV"}) {
|
||||
if ((ecl_file_has_kw( file1 , key)) && (ecl_file_has_kw( file2 , key))) {
|
||||
ecl_kw_type * kw_1 = ecl_file_iget_named_kw( file1 , key , 0);
|
||||
ecl_kw_type * kw_2 = ecl_file_iget_named_kw( file2 , key , 0);
|
||||
|
||||
@ -68,7 +81,11 @@ BOOST_AUTO_TEST_CASE(CompareRestartFileResults)
|
||||
<< " Actual absolute difference minimum value, maximum value is: " << min_value << ", " << max_value << std::endl;
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(numeric_equal, true);
|
||||
BOOST_CHECK(numeric_equal);
|
||||
} else {
|
||||
std::cerr << "Could not find keyword: " << key << " in restart files" << std::endl;
|
||||
BOOST_REQUIRE( false );
|
||||
}
|
||||
}
|
||||
|
||||
ecl_file_close(file1);
|
||||
|
Loading…
Reference in New Issue
Block a user