mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#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:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user