Fixup of alternating records special case

This commit is contained in:
Joakim Hove
2020-01-06 13:38:10 +01:00
parent c2b4d30be5
commit 6f330a7482
9 changed files with 61 additions and 25 deletions

View File

@@ -1748,16 +1748,6 @@ BOOST_AUTO_TEST_CASE(ConstructFromJson_withAlternatingRecordswithItems) {
BOOST_CHECK_THROW( ParserKeyword kw( jsonObject ), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(ConstructFromJson_withAlternatingRecordsSizeWithoutBrackets) {
const std::string json_string = R"(
{"name" : "STOG", "sections" : ["PROPS"] , "size" : 6, "alternating_records" : [[
{"name" : "ref_oil_pressure", "value_type" : "DOUBLE"}], [
{"name" : "oil_phase_pressure" , "value_type" : "DOUBLE"},
{"name" : "surface_rension", "value_type" : "DOUBLE"}]]}
)";
Json::JsonObject jsonObject( json_string );
BOOST_CHECK_THROW( ParserKeyword kw( jsonObject ), std::invalid_argument);
}
BOOST_AUTO_TEST_CASE(GetAlternatingKeywordFromParser) {
Parser parser;

View File

@@ -1455,3 +1455,45 @@ WORKLIM
)";
Parser().parseString( input );
}
BOOST_AUTO_TEST_CASE(PVTWSALT) {
const std::string input = R"(
RUNSPEC
TABDIMS
1 2 /
PROPS
PVTWSALT
1000 0 /
1 2 3 4 5
6 7 8 9 10 /
2000 0.50 /
1.5 2.5 3.5 4.5 5.5
6.5 7.5 8.5 9.5 10.5/
-- S_g k_rg k_rog p_cog
SGOF
0.1 0.0 1.0 0.0
0.2 0.1 1.0 1.0
0.3 0.2 0.9 2.0
0.4 0.3 0.8 3.0
0.5 0.5 0.5 4.0
0.6 0.6 0.4 5.0
0.7 0.8 0.3 6.0
0.8 0.9 0.2 7.0
0.9 0.5 0.1 8.0
1.0 1.0 0.1 9.0 /;
)";
auto deck = Parser{}.parseString(input);
const auto& pvtwsalt = deck.getKeyword("PVTWSALT");
BOOST_CHECK_EQUAL(pvtwsalt.size(), 4);
const auto& sgof = deck.getKeyword("SGOF");
BOOST_CHECK_EQUAL(sgof.size(), 1);
}