mirror of
https://github.com/OPM/ResInsight.git
synced 2026-10-25 06:38:13 -05:00
#14741 Add command-feature test infrastructure
Add the ResInsight-featuretests executable: a headless GUI test harness (RiaFeatureTestModelBuilder, RiaFeatureTestTreeView), a runner that triggers Ric*Feature commands through their QAction (RicFeatureExecutionRunner), a generic execution sweep over every registered feature (RicFeatureSweep-Test, RicFeatureExecutionSweep-Test, RicFeatureSubprocessSweep-Test, RicFeatureSweepDenylist), and supporting CMake wiring. Adds RiaRegressionTestRunner::setRunningRegressionTests() so tests can suppress modal dialogs, and shares RimMockSummaryCase as a common test model under TestModels.
This commit is contained in:
1 parent
aad5fca262
commit
7fa9d0c5bf
19 files changed
+1499
-1
No files matched your search
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "RifSummaryReaderInterface.h"
|
||||
#include "RigCaseRealizationParameters.h"
|
||||
#include "RimSummaryCase.h"
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class RimMockSummaryCase : public RimSummaryCase, public RifSummaryReaderInterface
|
||||
{
|
||||
public:
|
||||
void setName( const QString& name ) { m_name = name; }
|
||||
|
||||
void addVector( const RifEclipseSummaryAddress& address,
|
||||
const std::vector<time_t>& timeSteps,
|
||||
const std::vector<double>& values,
|
||||
const std::string& unit = "" )
|
||||
{
|
||||
m_data[address] = { timeSteps, values, unit };
|
||||
m_allResultAddresses.insert( address );
|
||||
}
|
||||
|
||||
// RimSummaryCase overrides
|
||||
void createSummaryReaderInterface() override {}
|
||||
RifSummaryReaderInterface* summaryReader() override { return this; }
|
||||
QString caseName() const override { return m_name; }
|
||||
|
||||
// RifSummaryReaderInterface overrides
|
||||
std::vector<time_t> timeSteps( const RifEclipseSummaryAddress& resultAddress ) const override
|
||||
{
|
||||
auto it = m_data.find( resultAddress );
|
||||
if ( it != m_data.end() ) return it->second.timeSteps;
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<bool, std::vector<double>> values( const RifEclipseSummaryAddress& resultAddress ) const override
|
||||
{
|
||||
auto it = m_data.find( resultAddress );
|
||||
if ( it != m_data.end() ) return { true, it->second.values };
|
||||
return { false, {} };
|
||||
}
|
||||
|
||||
std::string unitName( const RifEclipseSummaryAddress& resultAddress ) const override
|
||||
{
|
||||
auto it = m_data.find( resultAddress );
|
||||
if ( it != m_data.end() ) return it->second.unit;
|
||||
return {};
|
||||
}
|
||||
|
||||
RiaDefines::EclipseUnitSystem unitSystem() const override { return RiaDefines::EclipseUnitSystem::UNITS_METRIC; }
|
||||
|
||||
size_t keywordCount() const override { return m_allResultAddresses.size(); }
|
||||
|
||||
void refreshCalculatedAddresses() override { m_refreshCalculatedAddressesCount++; }
|
||||
int refreshCalculatedAddressesCount() const { return m_refreshCalculatedAddressesCount; }
|
||||
|
||||
private:
|
||||
struct VectorData
|
||||
{
|
||||
std::vector<time_t> timeSteps;
|
||||
std::vector<double> values;
|
||||
std::string unit;
|
||||
};
|
||||
|
||||
QString m_name = "MockCase";
|
||||
std::map<RifEclipseSummaryAddress, VectorData> m_data;
|
||||
int m_refreshCalculatedAddressesCount = 0;
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// A mock case carrying the realization number a delta ensemble matches its source cases on.
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
inline RimSummaryCase* createMockCase( int realizationNumber )
|
||||
{
|
||||
auto* summaryCase = new RimMockSummaryCase();
|
||||
|
||||
auto parameters = std::make_shared<RigCaseRealizationParameters>();
|
||||
parameters->setRealizationNumber( realizationNumber );
|
||||
summaryCase->setCaseRealizationParameters( parameters );
|
||||
|
||||
return summaryCase;
|
||||
}
|
||||
Reference in new issue
Block a user