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