2015-10-05 09:09:51 -05:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2018-06-08 08:10:45 -05:00
|
|
|
#include "RiaCurveDataTools.h"
|
2015-10-05 09:09:51 -05:00
|
|
|
|
2015-10-05 11:41:22 -05:00
|
|
|
#include <cmath> // Needed for HUGE_VAL on Linux
|
2017-11-17 06:18:39 -06:00
|
|
|
#include <numeric>
|
2015-10-05 09:09:51 -05:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-10-05 09:09:51 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
TEST( RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector )
|
2015-10-05 09:09:51 -05:00
|
|
|
{
|
|
|
|
std::vector<double> values;
|
2019-09-06 03:40:57 -05:00
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( 1.0 );
|
|
|
|
values.push_back( 2.0 );
|
|
|
|
values.push_back( 3.0 );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
|
|
|
|
auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false );
|
|
|
|
|
|
|
|
EXPECT_EQ( 1, static_cast<int>( valuesIntervals.size() ) );
|
|
|
|
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].first ) );
|
|
|
|
EXPECT_EQ( 4, static_cast<int>( valuesIntervals[0].second ) );
|
2015-10-05 11:37:58 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
///
|
2015-10-05 11:37:58 -05:00
|
|
|
//--------------------------------------------------------------------------------------------------
|
2019-09-06 03:40:57 -05:00
|
|
|
TEST( RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVector )
|
2015-10-05 11:37:58 -05:00
|
|
|
{
|
|
|
|
std::vector<double> values;
|
2019-09-06 03:40:57 -05:00
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( 1.0 );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
values.push_back( 2.0 );
|
|
|
|
values.push_back( 3.0 );
|
|
|
|
values.push_back( HUGE_VAL );
|
|
|
|
|
|
|
|
auto valuesIntervals = RiaCurveDataTools::calculateIntervalsOfValidValues( values, false );
|
|
|
|
|
|
|
|
EXPECT_EQ( 2, static_cast<int>( valuesIntervals.size() ) );
|
|
|
|
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].first ) );
|
|
|
|
EXPECT_EQ( 2, static_cast<int>( valuesIntervals[0].second ) );
|
|
|
|
EXPECT_EQ( 5, static_cast<int>( valuesIntervals[1].first ) );
|
|
|
|
EXPECT_EQ( 6, static_cast<int>( valuesIntervals[1].second ) );
|
2015-10-05 09:09:51 -05:00
|
|
|
}
|