2015-10-05 09:09:51 -05:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
|
2015-11-06 03:08:35 -06:00
|
|
|
#include "RigCurveDataTools.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
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2015-10-05 11:37:58 -05:00
|
|
|
TEST(RimWellLogExtractionCurveImplTest, StripOffInvalidValAtEndsOfVector)
|
2015-10-05 09:09:51 -05:00
|
|
|
{
|
|
|
|
std::vector<double> values;
|
2015-10-05 11:37:58 -05:00
|
|
|
values.push_back(HUGE_VAL);
|
|
|
|
values.push_back(HUGE_VAL);
|
2015-10-05 09:09:51 -05:00
|
|
|
values.push_back(1.0);
|
2015-10-05 11:37:58 -05:00
|
|
|
values.push_back(2.0);
|
|
|
|
values.push_back(3.0);
|
|
|
|
values.push_back(HUGE_VAL);
|
2015-10-05 09:09:51 -05:00
|
|
|
|
2017-11-16 06:37:47 -06:00
|
|
|
auto valuesIntervals = RigCurveDataTools::calculateIntervalsOfValidValues(values, false);
|
2015-10-05 09:09:51 -05:00
|
|
|
|
2015-10-14 09:13:45 -05:00
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
TEST(RimWellLogExtractionCurveImplTest, StripOffHugeValAtEndsAndInteriorOfVector)
|
|
|
|
{
|
|
|
|
std::vector<double> values;
|
|
|
|
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);
|
|
|
|
|
2017-11-16 06:37:47 -06:00
|
|
|
auto valuesIntervals = RigCurveDataTools::calculateIntervalsOfValidValues(values, false);
|
2015-10-05 11:37:58 -05:00
|
|
|
|
2015-10-20 04:48:07 -05:00
|
|
|
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
|
|
|
}
|
2017-11-17 06:18:39 -06:00
|
|
|
|