Files
ResInsight/ApplicationLibCode/UnitTests/RigFemPart-Test.cpp
T
Magne Sjaastad 3437cf9b94 #14778 Fix crashes from unguarded pointer and index accesses
* Skip deleted plot widgets in RiuMultiPlotBook::visiblePlotWidgets
* Guard missing calculation in detectCyclicCalculation
* Guard invalid node index in RigFemPart node lookups
* Guard null well path in RimWellLogExtractionCurve::extractGeomData
* Guard unopened case in RimGridCalculation::removeDependentObjects
* Guard empty subset in createLateralAtMeasuredDepth
2026-09-22 08:23:00 +02:00

25 lines
1.0 KiB
C++

#include "gtest/gtest.h"
#include "RigFemPart.h"
//--------------------------------------------------------------------------------------------------
/// A part with elements but no nodes, as read from a malformed model, gives connectivities that are
/// outside the node list. Calculating neighbors must not read outside the node to element references.
//--------------------------------------------------------------------------------------------------
TEST( RigFemPart, ElmNeighbors_ElementsWithoutNodes )
{
RigFemPart part;
const int connectivities[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
part.preAllocateElementStorage( 1 );
part.appendElement( RigElementType::HEX8, 1, connectivities );
part.assertNodeToElmIndicesIsCalculated();
part.assertElmNeighborsIsCalculated();
EXPECT_TRUE( part.elementsUsingNode( 0 ).empty() );
EXPECT_TRUE( part.elementsUsingNode( -1 ).empty() );
EXPECT_TRUE( part.elementLocalIndicesForNode( 0 ).empty() );
EXPECT_TRUE( part.elementLocalIndicesForNode( -1 ).empty() );
}