mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#6203 Fracture Model: Allow trailing seperator in import of elastic table csv.
This commit is contained in:
parent
bb7f7ff54e
commit
eaea8b6134
@ -79,7 +79,9 @@ RifElasticProperties
|
||||
{
|
||||
QStringList tokens = tokenize( line, "," );
|
||||
|
||||
if ( tokens.size() != 13 )
|
||||
// Plus one to allow trailing separator
|
||||
const int expectedTokens = 13;
|
||||
if ( !( tokens.size() == expectedTokens || tokens.size() == expectedTokens + 1 ) )
|
||||
{
|
||||
throw FileParseException( QString( "Incomplete data on line %1: %2" ).arg( lineNumber ).arg( filePath ) );
|
||||
}
|
||||
|
@ -77,6 +77,29 @@ TEST( RifElasticPropertiesReaderTest, ReadCorrectInputFile )
|
||||
ASSERT_DOUBLE_EQ( 0.55, elasticProperties[1].immobileFluidSaturation );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
TEST( RifElasticPropertiesReaderTest, ReadCorrectInputFileWithTrailingSeparator )
|
||||
{
|
||||
QTemporaryFile file;
|
||||
EXPECT_TRUE( file.open() );
|
||||
|
||||
{
|
||||
QTextStream out( &file );
|
||||
out << "Norne,Not,Sand,0.00,25,0.25,2000,0.2,0.3,0.4,0.5,0.6,0.4,\n"
|
||||
<< "Norne,Not,Sand,0.10,19,0.27,2099,0.3,0.4,0.5,0.2,0.5,0.55,\n";
|
||||
}
|
||||
|
||||
QStringList filePaths;
|
||||
filePaths.append( file.fileName() );
|
||||
|
||||
std::vector<RifElasticProperties> elasticProperties;
|
||||
RifElasticPropertiesReader::readElasticProperties( elasticProperties, filePaths );
|
||||
|
||||
ASSERT_EQ( 2u, elasticProperties.size() );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Helper to check exception messages when reading invalid files
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user