(#596) Refactored name matching for Ascii well path files (dev-files)

Supported well names are
Well name in quotes
name myWellName
WELLNAME: myWellName
This commit is contained in:
Magne Sjaastad
2015-10-28 11:32:47 +01:00
parent 56e6fd1f6b
commit ad6e17a5d9
3 changed files with 87 additions and 5 deletions

View File

@@ -0,0 +1,70 @@
#include "gtest/gtest.h"
#include "RimWellPathCollection.h"
#include "RigWellPath.h"
#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";
}
RimWellPathAsciiFileReader reader;
RimWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
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";
}
RimWellPathAsciiFileReader reader;
RimWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
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";
}
RimWellPathAsciiFileReader reader;
RimWellPathAsciiFileReader::WellData wpData = reader.readWellData(file.fileName(), 0);
EXPECT_TRUE(wpData.m_name == wellName);
}
}