InputErrorAction: convert to enum class
This commit is contained in:
@@ -187,7 +187,7 @@ TSTEP
|
||||
}
|
||||
|
||||
// The deck3 contains the 'GRID' keyword in the ACTIONX block - that is not a whitelisted keyword.
|
||||
ParseContext parseContext( {{ParseContext::ACTIONX_ILLEGAL_KEYWORD, InputError::THROW_EXCEPTION}} );
|
||||
ParseContext parseContext( {{ParseContext::ACTIONX_ILLEGAL_KEYWORD, InputErrorAction::THROW_EXCEPTION}} );
|
||||
BOOST_CHECK_THROW( make_schedule(WITH_GRID, parseContext), OpmInputError );
|
||||
}
|
||||
|
||||
|
||||
@@ -123,8 +123,8 @@ WSEGAICD
|
||||
|
||||
Opm::ErrorGuard errorGuard;
|
||||
Opm::ParseContext parseContext;
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
Opm::CompletedCells cells(grid);
|
||||
Opm::FieldPropsManager fp(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
|
||||
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard);
|
||||
@@ -284,8 +284,8 @@ WSEGSICD
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::CompletedCells cells(grid);
|
||||
Opm::FieldPropsManager fp(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
const auto& [new_connection_set, new_segment_set] = Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard);
|
||||
|
||||
// checking the ICD segment
|
||||
@@ -443,10 +443,10 @@ BOOST_AUTO_TEST_CASE(WrongDistanceCOMPSEGS) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::CompletedCells cells(grid);
|
||||
Opm::FieldPropsManager fp(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard), Opm::OpmInputError);
|
||||
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::IGNORE);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputErrorAction::IGNORE);
|
||||
BOOST_CHECK_NO_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard));
|
||||
}
|
||||
|
||||
@@ -512,10 +512,10 @@ BOOST_AUTO_TEST_CASE(NegativeDepthCOMPSEGS) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::CompletedCells cells(grid);
|
||||
Opm::FieldPropsManager fp(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard), Opm::OpmInputError);
|
||||
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::IGNORE);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputErrorAction::IGNORE);
|
||||
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard) );
|
||||
}
|
||||
|
||||
@@ -587,8 +587,8 @@ BOOST_AUTO_TEST_CASE(testwsegvalv) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::CompletedCells cells(grid);
|
||||
Opm::FieldPropsManager fp(deck, Opm::Phases{true, true, true}, grid, Opm::TableManager());
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_INVALID, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.update(Opm::ParseContext::SCHEDULE_COMPSEGS_NOT_SUPPORTED, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_NO_THROW( Opm::Compsegs::processCOMPSEGS(compsegs, connection_set, segment_set, Opm::ScheduleGrid(grid, fp, cells), parseContext, errorGuard));
|
||||
|
||||
// checking the WSEGVALV segment
|
||||
|
||||
@@ -72,26 +72,26 @@ BOOST_AUTO_TEST_CASE(TestUnkownKeyword) {
|
||||
|
||||
|
||||
parser.addKeyword<ParserKeywords::DIMENS>();
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck1 , parseContext , errors) , OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck1 , parseContext , errors) );
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck2 , parseContext , errors) , OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck2 , parseContext , errors) );
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck2 , parseContext , errors) , OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck2 , parseContext , errors) );
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ BOOST_AUTO_TEST_CASE(TestUnkownKeywordII) {
|
||||
|
||||
|
||||
parser.addKeyword<ParserKeywords::DIMENS>();
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck1 , parseContext, errors ) , OpmInputError);
|
||||
parseContext.ignoreKeyword("RUNSPEC");
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck1 , parseContext, errors ) );
|
||||
@@ -137,11 +137,11 @@ BOOST_AUTO_TEST_CASE(Handle_extra_records) {
|
||||
parser.addKeyword<ParserKeywords::GRID>();
|
||||
BOOST_CHECK_THROW( parser.parseString( deck_string , parseContext, errors ) , OpmInputError );
|
||||
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputErrorAction::IGNORE );
|
||||
parser.parseString( deck_string , parseContext, errors );
|
||||
BOOST_CHECK( parser.hasKeyword( "GRID" ) );
|
||||
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck_string , parseContext, errors ) , OpmInputError);
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ BOOST_AUTO_TEST_CASE(Handle_extra_records_2) {
|
||||
parser.addKeyword<ParserKeywords::GRID>();
|
||||
parser.addKeyword<ParserKeywords::DIMENS>();
|
||||
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_RECORDS , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck_string , parseContext, errors ), OpmInputError );
|
||||
}
|
||||
|
||||
@@ -218,8 +218,8 @@ BOOST_AUTO_TEST_CASE(TestUnkownKeyword_DATA) {
|
||||
|
||||
parser.addKeyword<ParserKeywords::RUNSPEC>();
|
||||
parser.addKeyword<ParserKeywords::DIMENS>();
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::THROW_EXCEPTION );
|
||||
{
|
||||
Deck deck = parser.parseString( deck_string1 , parseContext, errors );
|
||||
BOOST_CHECK( deck.hasKeyword( "RUNSPEC") );
|
||||
@@ -246,18 +246,18 @@ BOOST_AUTO_TEST_CASE(TEST_UNKNOWN_OPERATE) {
|
||||
ParseContext parseContext;
|
||||
Parser parser(false);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck , parseContext, errors ) , OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parser.parseString( deck , parseContext, errors );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck , parseContext, errors ) );
|
||||
|
||||
parser.addKeyword<ParserKeywords::OPERATE>();
|
||||
parser.parseString( deck , parseContext, errors );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck , parseContext, errors ) );
|
||||
}
|
||||
|
||||
@@ -279,10 +279,10 @@ BOOST_AUTO_TEST_CASE( CheckMissingSizeKeyword) {
|
||||
parser.addKeyword<ParserKeywords::EQLDIMS>();
|
||||
parser.addKeyword<ParserKeywords::SOLUTION>();
|
||||
|
||||
parseContext.update( ParseContext::PARSE_MISSING_DIMS_KEYWORD , InputError::THROW_EXCEPTION );
|
||||
parseContext.update( ParseContext::PARSE_MISSING_DIMS_KEYWORD , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deck , parseContext, errors ) , OpmInputError);
|
||||
|
||||
parseContext.update( ParseContext::PARSE_MISSING_DIMS_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_MISSING_DIMS_KEYWORD , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck , parseContext, errors ) );
|
||||
}
|
||||
|
||||
@@ -310,14 +310,14 @@ BOOST_AUTO_TEST_CASE(TestRandomSlash) {
|
||||
parser.addKeyword<ParserKeywords::TSTEP>();
|
||||
parser.addKeyword<ParserKeywords::SCHEDULE>();
|
||||
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE);
|
||||
BOOST_CHECK_THROW( parser.parseString( deck1 , parseContext, errors ) , OpmInputError);
|
||||
BOOST_CHECK_THROW( parser.parseString( deck2 , parseContext, errors ) , OpmInputError);
|
||||
|
||||
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck1 , parseContext, errors ) );
|
||||
BOOST_CHECK_NO_THROW( parser.parseString( deck2 , parseContext, errors ) );
|
||||
}
|
||||
@@ -328,8 +328,8 @@ BOOST_AUTO_TEST_CASE(TestRandomSlash) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(TestInvalidKey) {
|
||||
ParseContext parseContext;
|
||||
BOOST_CHECK_THROW( parseContext.addKey("KEY*", InputError::THROW_EXCEPTION) , std::invalid_argument );
|
||||
BOOST_CHECK_THROW( parseContext.addKey("KEY:", InputError::THROW_EXCEPTION) , std::invalid_argument );
|
||||
BOOST_CHECK_THROW( parseContext.addKey("KEY*", InputErrorAction::THROW_EXCEPTION) , std::invalid_argument );
|
||||
BOOST_CHECK_THROW( parseContext.addKey("KEY:", InputErrorAction::THROW_EXCEPTION) , std::invalid_argument );
|
||||
}
|
||||
|
||||
|
||||
@@ -337,47 +337,47 @@ BOOST_AUTO_TEST_CASE(TestNew) {
|
||||
ParseContext parseContext;
|
||||
|
||||
BOOST_CHECK_EQUAL( false , parseContext.hasKey("NO"));
|
||||
parseContext.addKey("NEW_KEY", InputError::THROW_EXCEPTION);
|
||||
parseContext.addKey("NEW_KEY", InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_EQUAL( true , parseContext.hasKey("NEW_KEY"));
|
||||
BOOST_CHECK_THROW( parseContext.get("NO") , std::invalid_argument);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputError::THROW_EXCEPTION );
|
||||
parseContext.addKey("KEY2", InputError::THROW_EXCEPTION);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputError::THROW_EXCEPTION );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputErrorAction::THROW_EXCEPTION );
|
||||
parseContext.addKey("KEY2", InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputErrorAction::THROW_EXCEPTION );
|
||||
|
||||
BOOST_CHECK_THROW( parseContext.updateKey("NO" , InputError::IGNORE) , std::invalid_argument);
|
||||
BOOST_CHECK_THROW( parseContext.updateKey("NO" , InputErrorAction::IGNORE) , std::invalid_argument);
|
||||
|
||||
parseContext.updateKey("NEW_KEY" , InputError::WARN);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputError::WARN );
|
||||
parseContext.updateKey("NEW_KEY" , InputErrorAction::WARN);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputErrorAction::WARN );
|
||||
|
||||
BOOST_CHECK_NO_THROW( parseContext.update("KEY2:NEW_KEY" , InputError::IGNORE));
|
||||
BOOST_CHECK_NO_THROW( parseContext.update("UnknownKey" , InputError::IGNORE));
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputError::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("KEY2") , InputError::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( parseContext.update("KEY2:NEW_KEY" , InputErrorAction::IGNORE));
|
||||
BOOST_CHECK_NO_THROW( parseContext.update("UnknownKey" , InputErrorAction::IGNORE));
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("KEY2") , InputErrorAction::IGNORE );
|
||||
|
||||
parseContext.addKey("SECRET_KEY", InputError::THROW_EXCEPTION);
|
||||
parseContext.addKey("NEW_KEY2", InputError::THROW_EXCEPTION);
|
||||
parseContext.addKey("NEW_KEY3", InputError::THROW_EXCEPTION);
|
||||
parseContext.update("NEW_KEY*" , InputError::WARN);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputError::WARN );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY2") , InputError::WARN );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY3") , InputError::WARN );
|
||||
parseContext.addKey("SECRET_KEY", InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.addKey("NEW_KEY2", InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.addKey("NEW_KEY3", InputErrorAction::THROW_EXCEPTION);
|
||||
parseContext.update("NEW_KEY*" , InputErrorAction::WARN);
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY") , InputErrorAction::WARN );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY2") , InputErrorAction::WARN );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY3") , InputErrorAction::WARN );
|
||||
|
||||
parseContext.update( InputError::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY3") , InputError::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("SECRET_KEY") , InputError::IGNORE );
|
||||
parseContext.update( InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("NEW_KEY3") , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get("SECRET_KEY") , InputErrorAction::IGNORE );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE( test_constructor_with_values) {
|
||||
ParseContext parseContext( {{ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE},
|
||||
{"UNSUPPORTED_*" , InputError::WARN},
|
||||
{"UNKNWON-IGNORED" , InputError::WARN}});
|
||||
ParseContext parseContext( {{ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::IGNORE},
|
||||
{"UNSUPPORTED_*" , InputErrorAction::WARN},
|
||||
{"UNKNWON-IGNORED" , InputErrorAction::WARN}});
|
||||
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::PARSE_RANDOM_SLASH) , InputError::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::PARSE_RANDOM_TEXT) , InputError::THROW_EXCEPTION );
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::UNSUPPORTED_INITIAL_THPRES) , InputError::WARN );
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::PARSE_RANDOM_SLASH) , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::PARSE_RANDOM_TEXT) , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_EQUAL( parseContext.get(ParseContext::UNSUPPORTED_INITIAL_THPRES) , InputErrorAction::WARN );
|
||||
}
|
||||
|
||||
|
||||
@@ -394,10 +394,10 @@ BOOST_AUTO_TEST_CASE( test_too_much_data ) {
|
||||
ErrorGuard errors;
|
||||
|
||||
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_DATA , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_DATA , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( parser.parseString( deckString , parseContext, errors ) , OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_DATA , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_EXTRA_DATA , InputErrorAction::IGNORE );
|
||||
auto deck = parser.parseString( deckString , parseContext, errors );
|
||||
}
|
||||
|
||||
@@ -405,8 +405,8 @@ BOOST_AUTO_TEST_CASE( test_too_much_data ) {
|
||||
BOOST_AUTO_TEST_CASE(test_1arg_constructor) {
|
||||
setenv("OPM_ERRORS_IGNORE", "PARSE_RANDOM_SLASH", 1);
|
||||
{
|
||||
ParseContext ctx(InputError::WARN);
|
||||
BOOST_CHECK_EQUAL(ctx.get(ParseContext::PARSE_RANDOM_SLASH), InputError::IGNORE);
|
||||
ParseContext ctx(InputErrorAction::WARN);
|
||||
BOOST_CHECK_EQUAL(ctx.get(ParseContext::PARSE_RANDOM_SLASH), InputErrorAction::IGNORE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,10 +423,10 @@ AQUCT
|
||||
|
||||
BOOST_CHECK_THROW(parser.parseString(deckString, parseContext, errors), OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW(parser.parseString(deckString, parseContext, errors));
|
||||
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW(parser.parseString(deckString, parseContext, errors), OpmInputError);
|
||||
}
|
||||
|
||||
@@ -448,10 +448,10 @@ RTEMPVD
|
||||
|
||||
BOOST_CHECK_THROW(parser.parseString(deckString, parseContext, errors), OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputError::IGNORE );
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW(parser.parseString(deckString, parseContext, errors));
|
||||
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::PARSE_INVALID_KEYWORD_COMBINATION , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW(parser.parseString(deckString, parseContext, errors), OpmInputError);
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ BOOST_AUTO_TEST_CASE( test_invalid_wtemplate_config ) {
|
||||
Parser parser;
|
||||
ErrorGuard errors;
|
||||
|
||||
parseContext.update(ParseContext::SCHEDULE_INVALID_NAME , InputError::THROW_EXCEPTION );
|
||||
parseContext.update(ParseContext::SCHEDULE_INVALID_NAME , InputErrorAction::THROW_EXCEPTION );
|
||||
|
||||
std::vector < std::string > testSamples;
|
||||
std::string testSample;
|
||||
@@ -755,11 +755,11 @@ RPTRUNSPEC
|
||||
ParseContext context;
|
||||
ErrorGuard error;
|
||||
|
||||
context.update(ParseContext::PARSE_LONG_KEYWORD, InputError::IGNORE);
|
||||
context.update(ParseContext::PARSE_LONG_KEYWORD, InputErrorAction::IGNORE);
|
||||
auto deck = parser.parseString(deck_string, context, error);
|
||||
BOOST_CHECK( deck.hasKeyword("RPTRUNSP") );
|
||||
|
||||
context.update(ParseContext::PARSE_LONG_KEYWORD, InputError::THROW_EXCEPTION);
|
||||
context.update(ParseContext::PARSE_LONG_KEYWORD, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( parser.parseString(deck_string, context, error), OpmInputError);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <opm/input/eclipse/Parser/ParseContext.hpp>
|
||||
|
||||
|
||||
void exit1(Opm::InputError::Action action) {
|
||||
void exit1(Opm::InputErrorAction action) {
|
||||
const char * deckString =
|
||||
"RUNSPEC\n"
|
||||
"DIMENS\n"
|
||||
@@ -34,7 +34,7 @@ void exit1(Opm::InputError::Action action) {
|
||||
this test is implemented without the BOOST testing framework.
|
||||
*/
|
||||
|
||||
void test_exit(Opm::InputError::Action action) {
|
||||
void test_exit(Opm::InputErrorAction action) {
|
||||
pid_t pid = fork();
|
||||
if (pid == 0)
|
||||
exit1(action);
|
||||
@@ -54,6 +54,6 @@ void test_exit(Opm::InputError::Action action) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
test_exit(Opm::InputError::Action::EXIT1);
|
||||
test_exit(Opm::InputError::Action::DELAYED_EXIT1);
|
||||
test_exit(Opm::InputErrorAction::EXIT1);
|
||||
test_exit(Opm::InputErrorAction::DELAYED_EXIT1);
|
||||
}
|
||||
|
||||
@@ -44,10 +44,10 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeInvalid) {
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputError::THROW_EXCEPTION );
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW(parser.parseFile(inputFilePath.string() , parseContext, errors) , Opm::OpmInputError);
|
||||
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputError::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW(parser.parseFile(inputFilePath.string() , parseContext, errors));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(ParserKeyword_includeWrongCase) {
|
||||
// have to change the current behavior one not-so-fine day...
|
||||
Opm::ParseContext parseContext;
|
||||
Opm::ErrorGuard errors;
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputError::THROW_EXCEPTION );
|
||||
parseContext.update(Opm::ParseContext::PARSE_MISSING_INCLUDE , Opm::InputErrorAction::THROW_EXCEPTION );
|
||||
|
||||
BOOST_CHECK_THROW(parser.parseFile(inputFile1Path.string(), parseContext, errors), Opm::OpmInputError);
|
||||
BOOST_CHECK_THROW(parser.parseFile(inputFile2Path.string(), parseContext, errors), Opm::OpmInputError);
|
||||
|
||||
@@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE( PATHS_has_global_scope ) {
|
||||
ParseContext parseContext;
|
||||
ErrorGuard errors;
|
||||
|
||||
parseContext.update( ParseContext::PARSE_MISSING_INCLUDE , Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update( ParseContext::PARSE_MISSING_INCLUDE , Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
const auto deck = parser.parseFile( prefix() + "parser/PATHSInInclude.data", parseContext, errors );
|
||||
BOOST_CHECK(deck.hasKeyword("OIL"));
|
||||
BOOST_CHECK_THROW( parser.parseFile( prefix() + "parser/PATHSInIncludeInvalid.data", parseContext, errors ), OpmInputError );
|
||||
@@ -331,7 +331,7 @@ BOOST_AUTO_TEST_CASE( PATHS_with_backslashes ) {
|
||||
ParseContext parseContext;
|
||||
ErrorGuard errors;
|
||||
|
||||
parseContext.update( ParseContext::PARSE_MISSING_INCLUDE , Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update( ParseContext::PARSE_MISSING_INCLUDE , Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
const auto deck = parser.parseFile( prefix() + "parser/PATHSWithBackslashes.data", parseContext, errors );
|
||||
BOOST_CHECK(deck.hasKeyword("OIL"));
|
||||
}
|
||||
@@ -2338,10 +2338,10 @@ GUIDERATE
|
||||
/
|
||||
)";
|
||||
|
||||
parseContext.update(ParseContext::PARSE_LONG_KEYWORD, Opm::InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::PARSE_LONG_KEYWORD, Opm::InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(parser.parseString(deck_string, parseContext, errors), OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_LONG_KEYWORD, Opm::InputError::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_LONG_KEYWORD, Opm::InputErrorAction::IGNORE);
|
||||
auto deck = parser.parseString(deck_string, parseContext, errors);
|
||||
BOOST_CHECK( deck.hasKeyword("GUIDERAT") );
|
||||
}
|
||||
@@ -2384,9 +2384,9 @@ BOOST_AUTO_TEST_CASE(parseSections) {
|
||||
|
||||
Opm::ParseContext parseContext;
|
||||
|
||||
parseContext.update(Opm::ParseContext::PARSE_EXTRA_DATA , Opm::InputError::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_EXTRA_RECORDS , Opm::InputError::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH , Opm::InputError::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_EXTRA_DATA , Opm::InputErrorAction::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_EXTRA_RECORDS , Opm::InputErrorAction::IGNORE );
|
||||
parseContext.update(Opm::ParseContext::PARSE_RANDOM_SLASH , Opm::InputErrorAction::IGNORE );
|
||||
|
||||
const auto deck_all = parser.parseFile("./tests/SPE1CASE1.DATA", parseContext);
|
||||
|
||||
|
||||
@@ -67,9 +67,9 @@ BOOST_AUTO_TEST_CASE( test_parse ) {
|
||||
ParseContext parseContext;
|
||||
ErrorGuard errors;
|
||||
|
||||
parseContext.update( ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::IGNORE );
|
||||
|
||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||
@@ -90,9 +90,9 @@ BOOST_AUTO_TEST_CASE( test_state ) {
|
||||
ErrorGuard errors;
|
||||
|
||||
|
||||
parseContext.update( ParseContext::PARSE_UNKNOWN_KEYWORD , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_TEXT , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_SLASH , InputError::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_UNKNOWN_KEYWORD , InputErrorAction::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_TEXT , InputErrorAction::IGNORE );
|
||||
parseContext.update( ParseContext::PARSE_RANDOM_SLASH , InputErrorAction::IGNORE );
|
||||
|
||||
parser.addKeyword<ParserKeywords::SPECGRID>();
|
||||
parser.addKeyword<ParserKeywords::FAULTS>();
|
||||
|
||||
@@ -539,7 +539,7 @@ BASIC=1
|
||||
ErrorGuard errors;
|
||||
auto deck = Parser().parseString( data);
|
||||
EclipseState es(deck);
|
||||
parseContext.update(ParseContext::RPT_MIXED_STYLE, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::RPT_MIXED_STYLE, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( Schedule( deck, es, parseContext, errors, {} ), std::exception );
|
||||
}
|
||||
|
||||
@@ -790,12 +790,12 @@ DATES -- 3
|
||||
EclipseState es1(deck1);
|
||||
EclipseState es2(deck2);
|
||||
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputError::IGNORE);
|
||||
ctx.update(ParseContext::RPT_MIXED_STYLE, InputError::THROW_EXCEPTION);
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputErrorAction::IGNORE);
|
||||
ctx.update(ParseContext::RPT_MIXED_STYLE, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( Schedule( deck1, es1, ctx, errors, {} ), std::exception );
|
||||
|
||||
|
||||
ctx.update(ParseContext::RPT_MIXED_STYLE, InputError::IGNORE);
|
||||
ctx.update(ParseContext::RPT_MIXED_STYLE, InputErrorAction::IGNORE);
|
||||
Schedule sched1(deck1, es1, ctx, errors, {});
|
||||
|
||||
|
||||
@@ -819,9 +819,9 @@ DATES -- 3
|
||||
BOOST_CHECK_EQUAL_COLLECTIONS( expected.begin() ,expected.end(),
|
||||
kw_list.begin() , kw_list.end() );
|
||||
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputError::THROW_EXCEPTION);
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( Schedule( deck2, es2, ctx, errors, {} ), std::exception );
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputError::IGNORE);
|
||||
ctx.update(ParseContext::RPT_UNKNOWN_MNEMONIC, InputErrorAction::IGNORE);
|
||||
|
||||
Schedule sched2(deck2, es2, ctx, errors, {});
|
||||
|
||||
|
||||
@@ -1467,10 +1467,10 @@ BOOST_AUTO_TEST_CASE(WELSPECS_WGNAME_SPACE) {
|
||||
ParseContext parseContext;
|
||||
ErrorGuard errors;
|
||||
|
||||
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors, python), Opm::OpmInputError);
|
||||
|
||||
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_WGNAME_SPACE, InputErrorAction::IGNORE);
|
||||
BOOST_CHECK_NO_THROW( Opm::Schedule(deck, grid, fp, runspec, parseContext, errors, python));
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ BOOST_AUTO_TEST_CASE(SCHEDULESection_NotTerminated) {
|
||||
|
||||
BOOST_AUTO_TEST_CASE(Section_ValidDecks) {
|
||||
|
||||
ParseContext mode { { { ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE } } };
|
||||
ParseContext mode { { { ParseContext::PARSE_UNKNOWN_KEYWORD, InputErrorAction::IGNORE } } };
|
||||
Parser parser;
|
||||
ErrorGuard errors;
|
||||
|
||||
@@ -257,7 +257,7 @@ BOOST_AUTO_TEST_CASE(Section_ValidDecks) {
|
||||
BOOST_AUTO_TEST_CASE(Section_InvalidDecks) {
|
||||
|
||||
Parser parser;
|
||||
ParseContext mode { { { ParseContext::PARSE_UNKNOWN_KEYWORD, InputError::IGNORE } } };
|
||||
ParseContext mode { { { ParseContext::PARSE_UNKNOWN_KEYWORD, InputErrorAction::IGNORE } } };
|
||||
ErrorGuard errors;
|
||||
|
||||
const std::string keyword_before_RUNSPEC =
|
||||
|
||||
@@ -236,7 +236,7 @@ BOOST_AUTO_TEST_CASE(wells_missingI) {
|
||||
ErrorGuard errors;
|
||||
const auto input = "WWCT\n/\n";
|
||||
auto deck = createDeck_no_wells( input );
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::THROW_EXCEPTION);
|
||||
EclipseState state( deck );
|
||||
Schedule schedule(deck, state, parseContext, errors, python );
|
||||
BOOST_CHECK_NO_THROW(SummaryConfig(deck, schedule, state.fieldProps(), state.aquifer(), parseContext, errors));
|
||||
@@ -557,7 +557,7 @@ RKFT
|
||||
|
||||
ParseContext parseContext;
|
||||
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( createSummary(input, parseContext), OpmInputError);
|
||||
}
|
||||
|
||||
@@ -711,10 +711,10 @@ BOOST_AUTO_TEST_CASE(INVALID_WELL1) {
|
||||
const auto input = "CWIR\n"
|
||||
"NEW-WELL /\n"
|
||||
"/\n";
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputError::THROW_EXCEPTION );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( createSummary( input , parseContext ) , OpmInputError);
|
||||
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputError::IGNORE );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( createSummary( input , parseContext ));
|
||||
}
|
||||
|
||||
@@ -723,10 +723,10 @@ BOOST_AUTO_TEST_CASE(INVALID_WELL2) {
|
||||
ParseContext parseContext;
|
||||
const auto input = "WWCT\n"
|
||||
" NEW-WELL /\n";
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputError::THROW_EXCEPTION );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( createSummary( input , parseContext ) , OpmInputError);
|
||||
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputError::IGNORE );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_WELL , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( createSummary( input , parseContext ));
|
||||
}
|
||||
|
||||
@@ -734,10 +734,10 @@ BOOST_AUTO_TEST_CASE(UNDEFINED_UDQ_WELL) {
|
||||
ParseContext parseContext;
|
||||
const auto input = "WUWCT\n"
|
||||
"/\n";
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNDEFINED_UDQ, InputError::THROW_EXCEPTION );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNDEFINED_UDQ, InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( createSummary( input , parseContext ) , OpmInputError);
|
||||
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNDEFINED_UDQ, InputError::IGNORE );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNDEFINED_UDQ, InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( createSummary( input , parseContext ));
|
||||
}
|
||||
|
||||
@@ -748,10 +748,10 @@ BOOST_AUTO_TEST_CASE(INVALID_GROUP) {
|
||||
ParseContext parseContext;
|
||||
const auto input = "GWCT\n"
|
||||
" NEW-GR /\n";
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_GROUP , InputError::THROW_EXCEPTION );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_GROUP , InputErrorAction::THROW_EXCEPTION );
|
||||
BOOST_CHECK_THROW( createSummary( input , parseContext ) , OpmInputError);
|
||||
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_GROUP , InputError::IGNORE );
|
||||
parseContext.updateKey( ParseContext::SUMMARY_UNKNOWN_GROUP , InputErrorAction::IGNORE );
|
||||
BOOST_CHECK_NO_THROW( createSummary( input , parseContext ));
|
||||
}
|
||||
|
||||
@@ -2066,16 +2066,16 @@ WOPRL
|
||||
|
||||
ParseContext parseContext;
|
||||
// Invalid well
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary( input1, parseContext ), OpmInputError);
|
||||
|
||||
// Invalid completion
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary( input2, parseContext ), OpmInputError);
|
||||
|
||||
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputErrorAction::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::IGNORE);
|
||||
const auto& summary_config1 = createSummary(input1, parseContext);
|
||||
BOOST_CHECK(summary_config1.hasKeyword("WOPRL__2"));
|
||||
BOOST_CHECK_EQUAL(summary_config1.size(), 1);
|
||||
@@ -2112,16 +2112,16 @@ COPRL
|
||||
|
||||
ParseContext parseContext;
|
||||
// Invalid well
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary( input1, parseContext ), OpmInputError);
|
||||
|
||||
// Invalid connection
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary( input2, parseContext ), OpmInputError);
|
||||
|
||||
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNHANDLED_KEYWORD, InputErrorAction::IGNORE);
|
||||
parseContext.update(ParseContext::SUMMARY_UNKNOWN_WELL, InputErrorAction::IGNORE);
|
||||
const auto& summary_config1 = createSummary(input1, parseContext);
|
||||
BOOST_CHECK(summary_config1.hasKeyword("COPRL"));
|
||||
BOOST_CHECK_EQUAL(summary_config1.size(), 1);
|
||||
@@ -2209,34 +2209,34 @@ RPR__REG
|
||||
)";
|
||||
ParseContext parse_context;
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputError::IGNORE);
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputErrorAction::IGNORE);
|
||||
const auto& summary_config = createSummary(input, parse_context);
|
||||
BOOST_CHECK(summary_config.hasKeyword("RWIP_REG"));
|
||||
BOOST_CHECK(!summary_config.hasKeyword("RPR__ABC"));
|
||||
}
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputError::THROW_EXCEPTION);
|
||||
parse_context.update(ParseContext::SUMMARY_INVALID_FIPNUM, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary(input, parse_context), std::exception);
|
||||
}
|
||||
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_REGION_TOO_LARGE, InputError::THROW_EXCEPTION);
|
||||
parse_context.update(ParseContext::SUMMARY_REGION_TOO_LARGE, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary(input_too_large, parse_context), std::exception);
|
||||
}
|
||||
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_REGION_TOO_LARGE, InputError::IGNORE);
|
||||
parse_context.update(ParseContext::SUMMARY_REGION_TOO_LARGE, InputErrorAction::IGNORE);
|
||||
const auto& summary_config = createSummary(input_too_large, parse_context);
|
||||
BOOST_CHECK_EQUAL( summary_config.size(), 3);
|
||||
}
|
||||
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_EMPTY_REGION, InputError::THROW_EXCEPTION);
|
||||
parse_context.update(ParseContext::SUMMARY_EMPTY_REGION, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(createSummary(input_empty, parse_context), std::exception);
|
||||
}
|
||||
|
||||
{
|
||||
parse_context.update(ParseContext::SUMMARY_EMPTY_REGION, InputError::IGNORE);
|
||||
parse_context.update(ParseContext::SUMMARY_EMPTY_REGION, InputErrorAction::IGNORE);
|
||||
const auto& summary_config = createSummary(input_empty, parse_context);
|
||||
BOOST_CHECK_EQUAL( summary_config.size(), 1);
|
||||
}
|
||||
|
||||
@@ -338,14 +338,14 @@ BOOST_AUTO_TEST_CASE(ThresholdPressureThrowTest) {
|
||||
|
||||
BOOST_CHECK_THROW(Setup sx(inputStr), std::runtime_error);
|
||||
ParseContext pc;
|
||||
pc.update(ParseContext::UNSUPPORTED_INITIAL_THPRES, InputError::IGNORE);
|
||||
pc.update(ParseContext::UNSUPPORTED_INITIAL_THPRES, InputErrorAction::IGNORE);
|
||||
BOOST_CHECK_NO_THROW(Setup sx(inputStrMissingPressure, pc));
|
||||
|
||||
Setup s(inputStrMissingPressure, pc);
|
||||
BOOST_CHECK( s.threshPres.hasRegionBarrier(2, 3));
|
||||
BOOST_CHECK(!s.threshPres.hasThresholdPressure(2, 3));
|
||||
|
||||
pc.update(ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES, InputError::THROW_EXCEPTION);
|
||||
pc.update(ParseContext::INTERNAL_ERROR_UNINITIALIZED_THPRES, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW(s.threshPres.getThresholdPressure(2, 3), std::invalid_argument);
|
||||
}
|
||||
|
||||
|
||||
@@ -1331,7 +1331,7 @@ BOOST_AUTO_TEST_CASE(UDQ_PARSE_ERROR) {
|
||||
ErrorGuard errors;
|
||||
std::vector<std::string> tokens = {"WBHP", "+"};
|
||||
KeywordLocation location;
|
||||
parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputErrorAction::IGNORE);
|
||||
{
|
||||
UDQDefine def1(udqp, "WUBHP",0, location, tokens, parseContext, errors);
|
||||
SummaryState st(TimeService::now());
|
||||
@@ -1345,7 +1345,7 @@ BOOST_AUTO_TEST_CASE(UDQ_PARSE_ERROR) {
|
||||
BOOST_CHECK_EQUAL(res["P1"].get(), udqp.undefinedValue());
|
||||
}
|
||||
|
||||
parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::UDQ_PARSE_ERROR, InputErrorAction::THROW_EXCEPTION);
|
||||
BOOST_CHECK_THROW( UDQDefine(udqp, "WUBHP",0, location, tokens, parseContext, errors), OpmInputError);
|
||||
}
|
||||
|
||||
@@ -1356,7 +1356,7 @@ BOOST_AUTO_TEST_CASE(UDQ_TYPE_ERROR) {
|
||||
std::vector<std::string> tokens1 = {"WBHP", "+", "1"};
|
||||
std::vector<std::string> tokens2 = {"SUM", "(", "WBHP", ")"};
|
||||
KeywordLocation location;
|
||||
parseContext.update(ParseContext::UDQ_TYPE_ERROR, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::UDQ_TYPE_ERROR, InputErrorAction::IGNORE);
|
||||
{
|
||||
UDQDefine def1(udqp, "FUBHP",0, location, tokens1, parseContext, errors);
|
||||
UDQDefine def2(udqp, "WUBHP",0, location, tokens2, parseContext, errors);
|
||||
@@ -1378,7 +1378,7 @@ BOOST_AUTO_TEST_CASE(UDQ_TYPE_ERROR) {
|
||||
BOOST_CHECK_EQUAL(res2[index].get(), 3);
|
||||
}
|
||||
|
||||
parseContext.update(ParseContext::UDQ_TYPE_ERROR, InputError::THROW_EXCEPTION);
|
||||
parseContext.update(ParseContext::UDQ_TYPE_ERROR, InputErrorAction::THROW_EXCEPTION);
|
||||
|
||||
// This fails because the well expression (WBHP + 1) is assigned to the field variable FUBHP
|
||||
BOOST_CHECK_THROW( UDQDefine(udqp, "FUBHP",0, location, tokens1, parseContext, errors), OpmInputError);
|
||||
|
||||
@@ -130,7 +130,7 @@ BOOST_AUTO_TEST_CASE( EQUIL_MISSING_DIMS ) {
|
||||
Parser parser;
|
||||
ErrorGuard errors;
|
||||
ParseContext parseContext;
|
||||
parseContext.update(ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputError::IGNORE);
|
||||
parseContext.update(ParseContext::PARSE_MISSING_DIMS_KEYWORD, InputErrorAction::IGNORE);
|
||||
const std::string equil = "EQUIL\n"
|
||||
"2469 382.4 1705.0 0.0 500 0.0 1 1 20 /";
|
||||
auto deck = parser.parseString(equil, parseContext, errors);
|
||||
|
||||
@@ -389,7 +389,7 @@ RedirectCERR::~RedirectCERR()
|
||||
BOOST_AUTO_TEST_SUITE(WellDimensions)
|
||||
|
||||
namespace {
|
||||
void setWellDimsContext(const Opm::InputError::Action action,
|
||||
void setWellDimsContext(const Opm::InputErrorAction action,
|
||||
Opm::ParseContext& ctxt)
|
||||
{
|
||||
ctxt.update(Opm::ParseContext::RUNSPEC_NUMWELLS_TOO_LARGE, action);
|
||||
@@ -422,7 +422,7 @@ BOOST_AUTO_TEST_CASE(ManyChildGroups)
|
||||
BOOST_AUTO_TEST_CASE(WellDims)
|
||||
{
|
||||
Opm::ParseContext parseContext;
|
||||
setWellDimsContext(Opm::InputError::THROW_EXCEPTION, parseContext);
|
||||
setWellDimsContext(Opm::InputErrorAction::THROW_EXCEPTION, parseContext);
|
||||
|
||||
auto cse = CaseObjects{ simCaseWellDims(), parseContext};
|
||||
|
||||
@@ -433,7 +433,7 @@ BOOST_AUTO_TEST_CASE(WellDims)
|
||||
parseContext, cse.guard),
|
||||
Opm::OpmInputError);
|
||||
|
||||
setWellDimsContext(Opm::InputError::DELAYED_EXIT1, parseContext);
|
||||
setWellDimsContext(Opm::InputErrorAction::DELAYED_EXIT1, parseContext);
|
||||
Opm::checkConsistentArrayDimensions(cse.es , cse.sched,
|
||||
parseContext, cse.guard);
|
||||
|
||||
@@ -458,7 +458,7 @@ BOOST_AUTO_TEST_CASE(WellDims)
|
||||
BOOST_AUTO_TEST_CASE(WellDims_ManyChildGroups)
|
||||
{
|
||||
Opm::ParseContext parseContext;
|
||||
setWellDimsContext(Opm::InputError::THROW_EXCEPTION, parseContext);
|
||||
setWellDimsContext(Opm::InputErrorAction::THROW_EXCEPTION, parseContext);
|
||||
|
||||
auto cse = CaseObjects{ simCaseNodeGroupSizeFailure(), parseContext};
|
||||
|
||||
@@ -470,7 +470,7 @@ BOOST_AUTO_TEST_CASE(WellDims_ManyChildGroups)
|
||||
parseContext, cse.guard),
|
||||
Opm::OpmInputError);
|
||||
|
||||
setWellDimsContext(Opm::InputError::DELAYED_EXIT1, parseContext);
|
||||
setWellDimsContext(Opm::InputErrorAction::DELAYED_EXIT1, parseContext);
|
||||
Opm::checkConsistentArrayDimensions(cse.es , cse.sched,
|
||||
parseContext, cse.guard);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user