2015-10-28 05:32:47 -05:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2017-05-12 01:26:36 -05:00
|
|
|
#include "RifWellPathImporter.h"
|
2015-10-28 05:32:47 -05:00
|
|
|
|
|
|
|
#include <QTemporaryFile>
|
|
|
|
#include <QTextStream>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-10-28 05:32:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
TEST( RimWellPathAsciiFileReaderTest, TestWellNameNoColon )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QTemporaryFile file;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( file.open() )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QString wellName = "My test Wellname";
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QTextStream out( &file );
|
2015-10-28 05:32:47 -05:00
|
|
|
out << "name " << wellName << "\n";
|
|
|
|
out << "1 2 3";
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RifWellPathImporter reader;
|
|
|
|
RifWellPathImporter::WellData wpData = reader.readWellData( file.fileName(), 0 );
|
|
|
|
EXPECT_TRUE( wpData.m_name == wellName );
|
|
|
|
}
|
2015-10-28 05:32:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-10-28 05:32:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
TEST( RimWellPathAsciiFileReaderTest, TestWellNameWithColon )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QTemporaryFile file;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( file.open() )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QString wellName = "My test Wellname";
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QTextStream out( &file );
|
2015-10-28 05:32:47 -05:00
|
|
|
out << "WELLNAME:" << wellName << "\n";
|
|
|
|
out << "1 2 3";
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RifWellPathImporter reader;
|
|
|
|
RifWellPathImporter::WellData wpData = reader.readWellData( file.fileName(), 0 );
|
|
|
|
EXPECT_TRUE( wpData.m_name == wellName );
|
|
|
|
}
|
2015-10-28 05:32:47 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-10-28 05:32:47 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
TEST( RimWellPathAsciiFileReaderTest, TestWellNameWithColonAndSpace )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QTemporaryFile file;
|
2019-09-06 03:40:57 -05:00
|
|
|
if ( file.open() )
|
2015-10-28 05:32:47 -05:00
|
|
|
{
|
|
|
|
QString wellName = "My test Wellname";
|
|
|
|
{
|
2019-09-06 03:40:57 -05:00
|
|
|
QTextStream out( &file );
|
2015-10-28 05:32:47 -05:00
|
|
|
out << "WELLNAME : " << wellName << "\n";
|
|
|
|
out << "1 2 3";
|
|
|
|
}
|
|
|
|
|
2019-09-06 03:40:57 -05:00
|
|
|
RifWellPathImporter reader;
|
|
|
|
RifWellPathImporter::WellData wpData = reader.readWellData( file.fileName(), 0 );
|
|
|
|
EXPECT_TRUE( wpData.m_name == wellName );
|
|
|
|
}
|
2015-10-28 05:32:47 -05:00
|
|
|
}
|