Added parsing support for sizeType OTHER
This commit is contained in:
parent
c046fb0bde
commit
946485e2b4
@ -142,18 +142,31 @@ namespace Opm {
|
||||
inputstream.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool Parser::isFixedLenghtKeywordFinished(RawKeywordConstPtr rawKeyword) const {
|
||||
bool fixedSizeReached = false;
|
||||
if (hasKeyword(rawKeyword->getKeywordName())) {
|
||||
ParserKeywordConstPtr parserKeyword = m_parserKeywords.find(rawKeyword->getKeywordName())->second;
|
||||
if (parserKeyword->hasFixedSize())
|
||||
fixedSizeReached = rawKeyword->size() == parserKeyword->getFixedSize();
|
||||
if (parserKeyword->getSizeType() != UNDEFINED) {
|
||||
size_t targetSize;
|
||||
|
||||
if (parserKeyword->hasFixedSize())
|
||||
targetSize = parserKeyword->getFixedSize();
|
||||
else {
|
||||
const std::pair<std::string,std::string> sizeKeyword = parserKeyword->getSizeKeyword();
|
||||
// Need to check the deck ....
|
||||
throw std::invalid_argument("Not implemented - need access to Deck here ...");
|
||||
}
|
||||
fixedSizeReached = (rawKeyword->size() == targetSize);
|
||||
}
|
||||
}
|
||||
|
||||
return fixedSizeReached;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void Parser::processIncludeKeyword(RawDeckPtr rawDeck, RawKeywordConstPtr keyword, const boost::filesystem::path& dataFolderPath) const {
|
||||
RawRecordConstPtr firstRecord = keyword->getRecord(0);
|
||||
std::string includeFileString = firstRecord->getItem(0);
|
||||
|
@ -68,6 +68,16 @@ BOOST_AUTO_TEST_CASE(addKeywordJSON_hasKeyword_returnstrue) {
|
||||
BOOST_CHECK(parser->hasKeyword("BPR"));
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(addKeywordJSON_size_isObject_allGood) {
|
||||
ParserPtr parser(new Parser());
|
||||
Json::JsonObject jsonConfig("{\"name\": \"EQUIL\", \"size\" : {\"keyword\":\"EQLDIMS\" , \"item\" : \"NTEQUL\"}}");
|
||||
parser->addKeyword(ParserKeywordConstPtr(new ParserKeyword( jsonConfig )));
|
||||
BOOST_CHECK(parser->hasKeyword("EQUIL"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(loadKeywordsJSON_notArray_throw) {
|
||||
ParserPtr parser(new Parser());
|
||||
Json::JsonObject jsonConfig( "{\"name\" : \"BPR\" , \"size\" : 100}");
|
||||
|
Loading…
Reference in New Issue
Block a user