Add value type RAW_STRING

When parsing RAW_STRING items the following applies:

 - Quotes are retained - as in 'P20'
 - Asteriks are not replaced with defaults
This commit is contained in:
Joakim Hove
2018-03-26 17:35:52 +02:00
parent aa06db984c
commit a65d6d7152
6 changed files with 73 additions and 9 deletions

View File

@@ -1838,3 +1838,21 @@ AQUTAB
BOOST_CHECK_EQUAL( 1, aqutab.size());
}
BOOST_AUTO_TEST_CASE(ParseRAW_STRING) {
const std::string deck_string = R"(
UDQ
DEFINE WUBHP 'P*X*' /
DEFINE WUBHP 'P*X*' 5*(1 + LOG(WBHP)) /
/
)";
Parser parser;
const auto deck = parser.parseString( deck_string, ParseContext());
const auto& udq = deck.getKeyword("UDQ");
const auto& data0 = udq.getRecord(0).getItem("DATA").getData<std::string>();
const auto& data1 = udq.getRecord(1).getItem("DATA").getData<std::string>();
const std::vector<std::string> expected0 = {"'P*X*'"};
const std::vector<std::string> expected1 = {"'P*X*'", "5*(1", "+", "LOG(WBHP))"};
BOOST_CHECK_EQUAL_COLLECTIONS( data0.begin(), data0.end(), expected0.begin(), expected0.end());
BOOST_CHECK_EQUAL_COLLECTIONS( data1.begin(), data1.end(), expected1.begin(), expected1.end());
}