mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-08 23:23:01 -06:00
8bab748fa6
Based on branch https://github.com/OPM/ResInsight/tree/system-msw-refactor - Move completion settings to property of well path - Rename to RimFishbones - Export implicit COMPSEGS for fishbones main bore - Add valve for each branch - Increase version number to be able to handle import of legacy project files
51 lines
1.7 KiB
C++
51 lines
1.7 KiB
C++
#include "gtest/gtest.h"
|
|
|
|
#include "RimWellPathCompletions.h"
|
|
|
|
#include <QRegExpValidator>
|
|
//--------------------------------------------------------------------------------------------------
|
|
///
|
|
//--------------------------------------------------------------------------------------------------
|
|
TEST( RimWellPathCompletions, WellNameRegExp )
|
|
{
|
|
std::vector<QString> validNames = { "RASASD", "gf0sdf", "sd-ASD12", "1-AA_b" };
|
|
std::vector<QString> invalidNames = { ".AdSD", "+gf0sdf", "sd ASD12", "ABCDEFGHIJKL" };
|
|
|
|
QRegExp rx = RimWellPathCompletionSettings::wellNameForExportRegExp();
|
|
EXPECT_TRUE( rx.isValid() );
|
|
|
|
for ( QString validName : validNames )
|
|
{
|
|
EXPECT_TRUE( rx.exactMatch( validName ) );
|
|
}
|
|
for ( QString invalidName : invalidNames )
|
|
{
|
|
EXPECT_FALSE( rx.exactMatch( invalidName ) );
|
|
}
|
|
}
|
|
|
|
TEST( RimWellPathCompletions, WellNameRegExpValidator )
|
|
{
|
|
std::vector<QString> validNames = { "RASASD", "gf0sdf", "sd-ASD12", "1-AA_b" };
|
|
std::vector<QString> invalidNames = { ".AdSD", "+gf0sdf", "sd ASD12", "ABCDEFGHIJKL" };
|
|
QString emptyString = "";
|
|
|
|
QRegExp rx = RimWellPathCompletionSettings::wellNameForExportRegExp();
|
|
QRegExpValidator validator( nullptr );
|
|
validator.setRegExp( rx );
|
|
|
|
for ( QString validName : validNames )
|
|
{
|
|
int dummyPos;
|
|
EXPECT_EQ( QValidator::Acceptable, validator.validate( validName, dummyPos ) );
|
|
}
|
|
for ( QString invalidName : invalidNames )
|
|
{
|
|
int dummyPos;
|
|
EXPECT_EQ( QValidator::Invalid, validator.validate( invalidName, dummyPos ) );
|
|
}
|
|
|
|
int dummyPos;
|
|
EXPECT_EQ( QValidator::Intermediate, validator.validate( emptyString, dummyPos ) );
|
|
}
|