#14517 Share the mock case factory between the summary tests

RimDeltaSummaryEnsemble-Test.cpp and RimSummaryCaseMainCollection-Test.cpp each defined an identical createMockCase() in an anonymous namespace. A unity build concatenates the two translation units, which merges the two anonymous namespaces into one and makes the second definition a redefinition, breaking the build with C2084.

Move the factory to RimMockSummaryCase.h, the header both tests already include for the mock case itself, and drop both local copies.
This commit is contained in:
Magne Sjaastad committed 2026-08-14 10:23:34 +02:00
1 parent 8ac2255832
commit db594490fc
3 files changed
+16 -31

No files matched your search

@@ -2,8 +2,6 @@
#include "Summary/RiaSummaryTools.h"
#include "RigCaseRealizationParameters.h"
#include "RimDeltaSummaryEnsemble.h"
#include "RimMockSummaryCase.h"
#include "RimSummaryCaseMainCollection.h"
@@ -13,23 +11,8 @@
#include "cafPdmPointer.h"
#include <algorithm>
#include <memory>
#include <vector>
namespace
{
RimSummaryCase* createMockCase( int realizationNumber )
{
auto* summaryCase = new RimMockSummaryCase();
auto parameters = std::make_shared<RigCaseRealizationParameters>();
parameters->setRealizationNumber( realizationNumber );
summaryCase->setCaseRealizationParameters( parameters );
return summaryCase;
}
} // namespace
//--------------------------------------------------------------------------------------------------
/// Removing a source case makes a delta ensemble rebuild its derived cases. Those derived cases are
/// part of the list of cases to remove, and must stay alive for as long as the caller holds that