Fix invalid parsing of line with keyword end tag and comment

* Add error text when size differs
* #9845: Remove invalid parsing of data in comment line
The line '/ -- 123 123' was parsed incorrectly, and values 123 123 was added to the list of valid values for the keyword.
This commit is contained in:
Magne Sjaastad
2023-02-16 13:04:16 +01:00
committed by GitHub
parent 20439e1da9
commit edbeb4dfb1
5 changed files with 46 additions and 12 deletions

View File

@@ -216,11 +216,14 @@ TEST( RifEclipseTextFileReader, KeywordsWithoutValue )
"/\n"
"SOIL\n"
"6.0 7.0 8.0 9.0\n"
"/\n";
"/\n"
"G4\n"
"1.0 2.0 3.0\n"
"0.123/ -- 1213 values in comment 123.123 \n";
auto keywordDataItems = RifEclipseTextFileReader::parseStringData( fileContent );
EXPECT_EQ( 3u, keywordDataItems.size() );
EXPECT_EQ( 4u, keywordDataItems.size() );
auto noEchoKeyword = keywordDataItems[0];
EXPECT_EQ( 0u, noEchoKeyword.values.size() );
@@ -233,4 +236,8 @@ TEST( RifEclipseTextFileReader, KeywordsWithoutValue )
EXPECT_FLOAT_EQ( 1.0f, swatKeyword.values[0] );
EXPECT_FLOAT_EQ( 6.0f, soilKeyword.values[0] );
auto g4Keyword = keywordDataItems[3];
EXPECT_EQ( 4u, g4Keyword.values.size() );
EXPECT_FLOAT_EQ( 0.123f, g4Keyword.values[3] );
}