mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-01 03:37:15 -06:00
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
#include "gtest/gtest.h"
|
|
|
|
#include "RiaTestDataDirectory.h"
|
|
|
|
#include "RifRevealCsvSectionSummaryReader.h"
|
|
|
|
#include <QFile>
|
|
#include <QTextStream>
|
|
|
|
static const QString CASE_REAL_TEST_DATA_DIRECTORY_07 = QString( "%1/RifRevealCsvSectionSummaryReader/" ).arg( TEST_DATA_DIR );
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( RifRevealCsvSectionSummaryReaderTest, ExpectedText )
|
|
{
|
|
QString fileName = CASE_REAL_TEST_DATA_DIRECTORY_07 + "i1.csv";
|
|
|
|
QFile file( fileName );
|
|
|
|
EXPECT_TRUE( file.open( QFile::ReadOnly | QFile::Text ) );
|
|
|
|
QTextStream in( &file );
|
|
|
|
QString fileContents = in.readAll();
|
|
|
|
QString errorMessage;
|
|
RifRevealCsvSectionSummaryReader reader;
|
|
|
|
bool isOk = reader.parse( fileContents, RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_WELL, &errorMessage );
|
|
ASSERT_TRUE( isOk );
|
|
|
|
EXPECT_TRUE( errorMessage.isEmpty() );
|
|
|
|
ASSERT_EQ( 40u, reader.allResultAddresses().size() );
|
|
EXPECT_EQ( 0u, reader.allErrorAddresses().size() );
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( RifRevealCsvSectionSummaryReaderTest, EmptyText )
|
|
{
|
|
RifRevealCsvSectionSummaryReader reader;
|
|
|
|
QString fileContents = "";
|
|
QString errorMessage;
|
|
|
|
bool isOk = reader.parse( fileContents, RifEclipseSummaryAddressDefines::SummaryCategory::SUMMARY_MISC, &errorMessage );
|
|
ASSERT_FALSE( isOk );
|
|
}
|