Made sure an exception is also thrown for too few columns. Added a test for this use case.

This commit is contained in:
rubenthoms
2020-08-14 18:08:35 +02:00
committed by rubenthoms
parent 3a5ef7fb86
commit 0da301a785
4 changed files with 4360 additions and 6 deletions

View File

@@ -36,12 +36,33 @@ TEST( RicElementPropertyTableReaderTest, BasicUsage )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, ParseFailed )
TEST( RicElementPropertyTableReaderTest, ParseFailedForTooManyColumns )
{
try
{
RifElementPropertyMetadata metadata =
RifElementPropertyTableReader::readMetadata( ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error.inp" );
RifElementPropertyTableReader::readMetadata( ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error_too_many_columns.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );
EXPECT_TRUE( false );
}
catch ( FileParseException e )
{
EXPECT_TRUE( e.message.startsWith( "Number of columns mismatch" ) );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
TEST( RicElementPropertyTableReaderTest, ParseFailedForTooFewColumns )
{
try
{
RifElementPropertyMetadata metadata = RifElementPropertyTableReader::readMetadata(
ELEM_PROP_TEST_DATA_DIRECTORY + "ELASTIC_TABLE_error_too_few_columns.inp" );
RifElementPropertyTable table;
RifElementPropertyTableReader::readData( &metadata, &table );