mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Improve detection of special *FIP* property names
Make sure RFIP* and SFIP* are not treated as category results
This commit is contained in:
@@ -102,10 +102,12 @@ bool RiaResultNames::isFlowResultWithBothPosAndNegValues( const QString& resultN
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaResultNames::isCategoryResult( const QString& resultName )
|
||||
{
|
||||
// Check for special FIP* results. This will also match statistics results FIPOIL_MEAN, FIPOIL_P90, ...
|
||||
if ( resultName.startsWith( "FIPOIL", Qt::CaseInsensitive ) ) return false;
|
||||
if ( resultName.startsWith( "FIPGAS", Qt::CaseInsensitive ) ) return false;
|
||||
if ( resultName.startsWith( "FIPWAT", Qt::CaseInsensitive ) ) return false;
|
||||
// Identify and mark some FIP-results as non-category result.
|
||||
// This includes statistics results FIPOIL_MEAN, FIPOIL_P90, SFIP* and RFIP*.
|
||||
|
||||
if ( resultName.contains( "FIPOIL", Qt::CaseInsensitive ) ) return false;
|
||||
if ( resultName.contains( "FIPGAS", Qt::CaseInsensitive ) ) return false;
|
||||
if ( resultName.contains( "FIPWAT", Qt::CaseInsensitive ) ) return false;
|
||||
|
||||
if ( resultName.endsWith( "NUM", Qt::CaseInsensitive ) ) return true;
|
||||
if ( resultName.startsWith( "FIP", Qt::CaseInsensitive ) ) return true;
|
||||
|
@@ -105,6 +105,7 @@ set(SOURCE_UNITTEST_FILES
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifParquetReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RifOsduWellPathReader-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RigVfpTables-Test.cpp
|
||||
${CMAKE_CURRENT_LIST_DIR}/RiaResultName-Test.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_ENABLE_GRPC)
|
||||
|
56
ApplicationLibCode/UnitTests/RiaResultName-Test.cpp
Normal file
56
ApplicationLibCode/UnitTests/RiaResultName-Test.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include "RiaResultNames.h"
|
||||
|
||||
TEST( RiaResultNames, TestIsCategoryResult )
|
||||
{
|
||||
// Test for non-category result names
|
||||
{
|
||||
QString resultVariable = "FIPOIL";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "FIPWAT";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "FIPGAS";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "SFIPGAS";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "RFIPGAS";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "RFIPGAS_P90";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_FALSE( result );
|
||||
}
|
||||
|
||||
// Test for category result names
|
||||
{
|
||||
QString resultVariable = "MYNUM";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_TRUE( result );
|
||||
}
|
||||
|
||||
{
|
||||
QString resultVariable = "FIPMYPROP";
|
||||
bool result = RiaResultNames::isCategoryResult( resultVariable );
|
||||
EXPECT_TRUE( result );
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user