BlueQuartzSoftware / BlueQuartzSoftware/simplnx

Code Coverage Issues

Open
#1,532 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
17
Forks
13
Avg merge
3d 4h
Merged PRs (30d)
10

Description

# Code Coverage Improvement TODO

Generated from GCOV coverage report (Jan 30 2025).
Overall: **38.9% line**, **43.9% function**, **24.5% branch** coverage.

> **Excludes:** `parameterVersion()` and `clone()` (covered by separate PR),
> `IdentifySampleFilter` (already fixed), `not_used/` algorithm stubs.

---

## 1. Algorithm Classes with 0% Coverage (Not Tested At All)

These are **real algorithm implementations** with zero test coverage. Each needs a
corresponding unit test that exercises the algorithm's `operator()()` through its
parent filter.

### OrientationAnalysis Plugin

| File | Lines | Comment |
|------|------|--------------|
| `Filters/Algorithms/ComputeGBPDMetricBased.cpp` | 739 | Times out |
| `Filters/Algorithms/ComputeGBCDMetricBased.cpp` | 612 | Times out |
| `Filters/Algorithms/ComputeGBCD.cpp` | 479 | Times out |
| `Filters/Algorithms/ComputeTwinBoundaries.cpp` | 398 |Times out |
| `Filters/Algorithms/ComputeGBCDPoleFigure.cpp` | 335 | Times out |
| `Filters/Algorithms/ComputeFZQuaternions.cpp` | 180 | Unit test is being run MAJ. Not sure what it is or is not covering |

### SimplnxCore Plugin

| File | Lines | Action |
|------|------:|--------|
| `Filters/Algorithms/ReadDeformKeyFileV12.cpp` | 840 | Add unit test for ReadDeformKeyFileV12Filter |
| `Filters/Algorithms/RegularGridSampleSurfaceMesh.cpp` | 283 | Add unit test for RegularGridSampleSurfaceMeshFilter |
| `Filters/Algorithms/WriteVtkStructuredPoints.cpp` | 74 | Add unit test for WriteVtkStructuredPointsFilter |
| `Filters/Algorithms/ComputeDifferencesMap.cpp` | 61 | Add unit test for ComputeDifferencesMapFilter |

### Near-Zero Coverage

| File | Lines | Coverage | Action |
|------|------:|----------|--------|
| `Filters/Algorithms/ComputeArrayStatistics.cpp` | 1,288 | 9.5% | Expand unit test to exercise more code paths |

### Core Utility

| File | Lines | Action |
|------|------:|--------|
| `simplnx/Utilities/ParallelData2DAlgorithm.cpp` | 39 | Add or expand test that uses 2D parallel algorithm |

---

## 2. Uncovered `MakeErrorResult()` Preflight Branches — Update Unit Tests

These are error-return branches in `preflightImpl()` that are never triggered by
any unit test. For each, add a test case that passes invalid inputs to trigger the
error path. Grouped by filter with line numbers and error codes.

### AddBadDataFilter (4 uncovered)

- [ ] L116 (`-76234`): No noise type selected — pass `boundaryNoise=false, poissonNoise=false`
- [ ] L121 (`-76235`): Poisson volume fraction out of range — pass value > 1.0 or < 0.0
- [ ] L126 (`-76236`): Boundary volume fraction out of range — pass value > 1.0 or < 0.0
- [ ] L133 (`-76237`): Image geometry with null cell Attribute Matrix

### AlignGeometriesFilter (1 uncovered)

- [ ] L83 (`-1`): Invalid alignment type — pass value other than 0 or 1

### ApplyTransformationToGeometryFilter (4 uncovered preflight + 4 other)

- [ ] L173 (`-82000`): Null input geometry
- [ ] L206 (`-82010`): Invalid precomputed transformation matrix path
- [ ] L224 (`-82002`): Manual transformation matrix without exactly 4 rows
- [ ] L228 (`-82006`): Manual transformation matrix without exactly 4 columns

### ApproximatePointCloudHullFilter (1 uncovered)

- [ ] L89 (`-11001`): Grid resolution with zero or negative values

### BadDataNeighborOrientationCheckFilter (9 uncovered)

- [ ] L120: Missing image geometry
- [ ] L127: Missing mask array
- [ ] L133: Mask array with != 1 component
- [ ] L141: Missing cell phases array
- [ ] L151: Cell phases array with != 1 component (not Int32)
- [ ] L159: Missing crystal structures array
- [ ] L169: Crystal structures array with != 1 component (not UInt32)
- [ ] L176: Missing quaternions array
- [ ] L186: Quaternion array with != 4 components (not Float32)

### CAxisSegmentFeaturesFilter (4 uncovered)

- [ ] L131 (`-655`): Misorientation tolerance == 0
- [ ] L157: Missing mask array
- [ ] L162: Mask array wrong type (not Bool or UInt8)
- [ ] L170 (`-651`): DataArrays with unequal tuple counts

### ChangeAngleRepresentationFilter (1 uncovered)

- [ ] L122 (`-67001`): Conversion type > 1

### ComputeArrayHistogramFilter (2 uncovered)

- [ ] L154 (`-57206`): Mask array not Boolean or UInt8
- [ ] L163 (`-57207`): Mask/input array tuple count mismatch

### ComputeArrayHistogramByFeatureFilter (2 uncovered)

- [ ] L154 (`-57206`): Mask array not Boolean or UInt8
- [ ] L163 (`-57207`): Mask/input array tuple count mismatch

### ComputeAvgCAxesFilter (1 uncovered)

- [ ] L102 (`-6400`): DataArrays with unequal tuple counts

### ComputeAvgOrientationsFilter (5 uncovered)

- [ ] L117: Crystal structures array with != 1 component
- [ ] L126: Quaternion array with != 4 components
- [ ] L134: Phases array with != 1 component
- [ ] L142: FeatureIds array with != 1 component
- [ ] L150 (`-651`): DataArrays with unequal tuple counts

### ComputeBiasedFeaturesFilter (1 uncovered)

- [ ] L111 (`-7460`): DataArrays with unequal tuple counts

### ComputeCAxisLocationsFilter (1 uncovered)

- [ ] L95 (`-3520`): DataArrays with unequal tuple counts

### ComputeDifferencesMapFilter (6 uncovered)

- [ ] L38 (`-90001`): Selected arrays of different types
- [ ] L44 (`-90002`): Selected DataPath not pointing to a DataArray
- [ ] L149: Missing first input array
- [ ] L158: Missing second input array
- [ ] L181: First input array wrong number of components
- [ ] L189: Second input array wrong number of components

### ComputeFeatureClusteringFilter (4 uncovered)

- [ ] L127 (`-14310`): Number of bins <= 0
- [ ] L135 (`-14311`): FeaturePhases wrong type
- [ ] L141 (`-14312`): Centroids wrong type
- [ ] L151 (`-14314`): DataArrays with unequal tuple counts

### ComputeFeatureNeighborsFilter (1 uncovered)

- [ ] L216 (`-24500`): DataArrays with unequal tuple counts

### ComputeFeaturePhasesBinaryFilter (1 uncovered)

- [ ] L122 (`-53800`): DataArrays with unequal tuple counts

### ComputeFeaturePhasesFilter (2 uncovered)

- [ ] L93 (`-4630`): Missing feature ids array
- [ ] L98 (`-4631`): Missing cell features Attribute Matrix

### ComputeFeatureReferenceCAxisMisorientationsFilter (1 uncovered)

- [ ] L114 (`-9800`): DataArrays with unequal tuple counts

### ComputeFeatureReferenceMisorientationsFilter (1 uncovered)

- [ ] L177 (`-94520`): Missing cell feature Attribute Matrix

### ComputeFeatureSizesFilter (2 uncovered)

- [ ] L108: Could not find target geometry
- [ ] L113: Could not find Feature IDs array

### ComputeGBCDFilter (7 uncovered)

- [ ] L125 (`-74350`): Missing euler angles array
- [ ] L129 (`-74351`): Missing phases array
- [ ] L134 (`-74352`): Missing crystal structures array
- [ ] L140 (`-74353`): Missing triangle geometry
- [ ] L149 (`-74354`): Missing face labels array
- [ ] L153 (`-74355`): Missing face normals array
- [ ] L157 (`-74356`): Missing face areas array

### ComputeGBCDPoleFigureFilter (3 uncovered)

- [ ] L110 (`-34640`): Missing crystal structures array
- [ ] L116 (`-34641`): Missing GBCD array
- [ ] L122 (`-34642`): Phase index larger than number of Ensembles

### ComputeIPFColorsFilter (5 uncovered)

- [ ] L123: Crystal structures array with != 1 component
- [ ] L132: Euler angles array with != 3 components
- [ ] L140: Phases array with != 1 component
- [ ] L153: Missing mask array
- [ ] L167 (`-651`): DataArrays with unequal tuple counts

### ComputeMisorientationsFilter (1 uncovered)

- [ ] L141 (`-651`): DataArrays with unequal tuple counts

### ComputeNeighborhoodsFilter (1 uncovered)

- [ ] L115 (`-5730`): DataArrays with unequal tuple counts

### ComputeNumFeaturesFilter (1 uncovered)

- [ ] L95 (`-47630`): Missing ensemble Attribute Matrix

### ComputeQuaternionConjugateFilter (1 uncovered)

- [ ] L99: Quaternion array with != 4 components

### ComputeSchmidsFilter (1 uncovered)

- [ ] L172 (`-13500`): Slip plane and slip direction must be normal

### ComputeShapesFilter (2 uncovered)

- [ ] L118 (`-12801`): Missing cell feature Attribute Matrix
- [ ] L125 (`-12802`): Centroids array wrong type

### ComputeSurfaceFeaturesFilter (1 uncovered)

- [ ] L100 (`-1000`): Image geometry not 3D or 2D

### ComputeVertexToTriangleDistancesFilter (2 uncovered)

- [ ] L108 (`-4530`): DataPath not a valid VertexGeometry
- [ ] L114 (`-4531`): DataPath not a valid TriangleGeometry

### ComputeVolumeFractionsFilter (1 uncovered)

- [ ] L96 (`-47630`): Missing feature Attribute Matrix

### ConvertColorToGrayScaleFilter (2 uncovered)

- [ ] L113 (`-10701`): Invalid color channel selection (not 0, 1, or 2)
- [ ] L141 (`-10700`): Input data array does not exist

### ConvertDataFilter (2 uncovered)

- [ ] L110 (`-15201`): Missing input data array
- [ ] L166 (`-1`): FromSIMPL JSON conversion error

### ConvertOrientationsFilter (1 uncovered)

- [ ] L140: Invalid conversion parameters

### ConvertOrientationsToVertexGeometryFilter (4 uncovered)

- [ ] L124 (`-1001`): Input representation type not 0-6
- [ ] L132 (`-1002`): Input component shape with multiple dimensions
- [ ] L143 (`-1003`): Array validation failure
- [ ] L172 (`-1004`): Array tuple count mismatch

### ConvertQuaternionFilter (1 uncovered)

- [ ] L105: Quaternion array with != 4 components

### CopyFeatureArrayToElementArrayFilter (1 uncovered)

- [ ] L145 (`-3020`): DataArrays with unequal tuple counts

### CreateColorMapFilter (2 uncovered)

- [ ] L133: Missing mask array
- [ ] L147 (`-651`): DataArrays with unequal tuple counts

### CreateGeometryFilter (3 uncovered preflight + 6 other)

- [ ] L239 (`-9840`): Missing vertex list
- [ ] L286 (`-9841`): Missing quadrilateral list
- [ ] L291 (`-9842`): Missing quadrilateral list (second check)

### CropImageGeometryFilter (3 uncovered preflight + 6 other)

- [ ] L279 (`-4010`): No dimension selected to crop
- [ ] L620 (`-950`): Crop bounds validation X
- [ ] L627 (`-951`): Crop bounds validation Y
- [ ] L634 (`-952`): Crop bounds validation Z

### CropVertexGeometryFilter (1 uncovered)

- [ ] L180 (`-58556`): Missing vertex data AttributeMatrix

### EBSDSegmentFeaturesFilter (4 uncovered)

- [ ] L131 (`-655`): Misorientation tolerance == 0
- [ ] L157: Missing mask array
- [ ] L162: Mask array wrong type
- [ ] L170 (`-651`): DataArrays with unequal tuple counts

### ErodeDilateBadDataFilter (1 uncovered)

- [ ] L114 (`-16700`): Operation selection not 0 (Dilate) or 1 (Erode)

### ErodeDilateCoordinationNumberFilter (1 uncovered)

- [ ] L94 (`-16800`): Coordination number not between 0 and 6

### ExtractComponentAsArrayFilter (1 uncovered)

- [ ] L106 (`-45630`): Array component count must be > 1

### ExtractInternalSurfacesFromTriangleGeometryFilter (4 uncovered)

- [ ] L120: Missing geometry validation
- [ ] L128: Missing geometry validation
- [ ] L142: Missing geometry validation
- [ ] L169: Missing geometry validation

### ExtractPipelineToFileFilter (1 uncovered)

- [ ] L153 (`-2582`): Error opening output path

### ExtractVertexGeometryFilter (1 uncovered)

- [ ] L139: Missing mask array

### FillBadDataFilter (1 uncovered)

- [ ] L99 (`-16500`): Minimum allowed defect size < 1

### ITKImageWriterFilter (2 uncovered preflight + 4 other)

- [ ] L352 (`-25600`): Image array dimensions must match ImageGeometry
- [ ] L357 (`-25601`): Fill character should be a single value

### ITKImportImageStackFilter (1 uncovered preflight + 3 other)

- [ ] L850 (`-4`): Unsupported pixel component

### ITKMhaFileReaderFilter (1 uncovered preflight + 1 other)

- [ ] L482 (`-5001`): Error applying transformation — unable to instantiate filter

### InitializeImageGeomCellDataFilter (1 uncovered)

- [ ] L258 (`-3550`): No data arrays selected

### IterativeClosestPointFilter (3 uncovered)

- [ ] L99: Missing geometry validation
- [ ] L104: Missing geometry validation
- [ ] L110: Missing geometry validation

### MergeTwinsFilter (5 uncovered)

- [ ] L145 (`-6874600`): Missing contiguous neighbor list (Int32)
- [ ] L158 (`-6874602`): Missing feature ids array (Int32)
- [ ] L167 (`-6874603`): Missing phases array (Int32)
- [ ] L178 (`-6874602`): Missing average quaternions array (Float32)
- [ ] L191 (`-6874602`): Missing crystal structures array (UInt32)

### NeighborOrientationCorrelationFilter (7 uncovered preflight + 3 other)

- [ ] L120: Missing input image geometry
- [ ] L129: Missing confidence index array
- [ ] L139: Confidence index array wrong type (not 1-component Float32)
- [ ] L147: Missing cell phases array
- [ ] L157: Cell phases wrong type (not 1-component Int32)
- [ ] L165: Missing crystal structures array
- [ ] L175: Crystal structures wrong type (not 1-component UInt32)

### PadImageGeometryFilter (2 uncovered preflight + 1 other)

- [ ] L137 (`-4010`): No dimension selected
- [ ] L147 (`-4115`): Null Image geometry pointer

### PartitionGeometryFilter (1 uncovered preflight + 12 other dataCheck)

- [ ] L378 (`-3010`): Attribute matrix tuple count mismatch with geometry

### QuickSurfaceMeshFilter (2 uncovered)

- [ ] L142 (`-76530`): Missing grid geometry
- [ ] L177 (`-76531`): DataArray wrong tuple count for element data copy

### RandomizeFeatureIdsFilter (1 uncovered)

- [ ] L102 (`-82640`): Attribute Matrix tuple count less than max FeatureId

### ReadAngDataFilter (1 uncovered preflight + 1 other)

- [ ] L108: File validation error

### ReadBinaryCTNorthstarFilter (2 uncovered)

- [ ] L420 (`-38701`): Input header file does not exist
- [ ] L427: Error reading input header file

### ReadChannel5DataFilter (3 uncovered)

- [ ] L120 (`-66500`): Matching .crc file does not exist
- [ ] L124 (`-66501`): std::exception checking file existence
- [ ] L133: File validation error

### ReadCtfDataFilter (1 uncovered)

- [ ] L115: File validation error

### ReadDREAM3DFilter (3 uncovered)

- [ ] L82: Import file path not provided
- [ ] L87: Failed to open HDF5 file
- [ ] L151: Unsupported PathImportPolicy

### ReadH5EbsdFilter (7 uncovered)

- [ ] L113 (`-67500`): Could not read input file
- [ ] L327-L347: Multiple JSON parameter conversion errors (6 checks)

### ReadHDF5DatasetFilter (1 uncovered)

- [ ] L318 (`-21000`): Error reading HDF5 file

### ReadRawBinaryFilter (2 uncovered)

- [ ] L110: Number of components must be positive
- [ ] L125: File is empty

### ReadVolumeGraphicsFileFilter (1 uncovered preflight + 5 other)

- [ ] L446: Volume Graphics data file does not exist

### RemoveFlaggedEdgesFilter (3 uncovered preflight + 2 other)

- [ ] L149 (`-5651`): Missing edge data attribute matrix
- [ ] L157 (`-5652`): Missing edge data attribute matrix (second geom)
- [ ] L179 (`-5653`): Missing vertex data attribute matrix

### RemoveFlaggedFeaturesFilter (2 uncovered)

- [ ] L127 (`-9890`): Missing Feature Ids array
- [ ] L132 (`-9891`): Missing Flagged Features array

### RemoveFlaggedTrianglesFilter (2 uncovered preflight + 2 other)

- [ ] L157 (`-5251`): Missing face data attribute matrix
- [ ] L165 (`-5252`): Missing face data attribute matrix (second check)

### RemoveFlaggedVerticesFilter (4 uncovered)

- [ ] L132: Missing geometry validation
- [ ] L139: Missing geometry validation
- [ ] L167 (`-5751`): Missing cell data attribute matrix
- [ ] L250 (`-54070`): Array validation error

### RequireMinNumNeighborsFilter (1 uncovered)

- [ ] L135: Validation error

### RequireMinimumSizeFeaturesFilter (5 uncovered)

- [ ] L328: Validation error
- [ ] L334: FeatureIds not Int32 Array
- [ ] L339: NumCells not Int32 Array
- [ ] L362: NumCells DataPath has no parent
- [ ] L420 (`-5555`): Validation error

### RobustAutomaticThresholdFilter (1 uncovered)

- [ ] L121: Input array cannot be bool type

### RodriguesConvertorFilter (1 uncovered)

- [ ] L99: Rodrigues array must be 3-component Float32

### RotateSampleRefFrameFilter (1 uncovered)

- [ ] L196 (`-5951`): Missing cell data attribute matrix

### ScalarSegmentFeaturesFilter (6 uncovered)

- [ ] L121: Grid Geometry required
- [ ] L136: Input array must be single component
- [ ] L142: Input array not specified
- [ ] L155: Missing mask array
- [ ] L160: Mask array wrong type
- [ ] L168 (`-651`): DataArrays with unequal tuple counts

### SplitDataArrayByComponentFilter (2 uncovered)

- [ ] L99 (`-65400`): Missing input data array
- [ ] L104 (`-65401`): Array must have > 1 component

### SplitDataArrayByTupleFilter (1 uncovered preflight + 4 other)

- [ ] L418: Missing input array

### SurfaceNetsFilter (1 uncovered)

- [ ] L143 (`-76530`): Missing grid geometry

### TriangleDihedralAngleFilter (2 uncovered)

- [ ] L174 (`-9860`): Missing Triangle Geometry
- [ ] L180 (`-9861`): Missing face data Attribute Matrix

### WriteASCIIDataFilter (1 uncovered)

- [ ] L200 (`-11021`): Unable to create output file

### WriteBinaryDataFilter (1 uncovered)

- [ ] L138 (`-23430`): OutputPath must be a directory

### WriteDREAM3DFilter (2 uncovered)

- [ ] L111: Failed to retrieve pipeline
- [ ] L133: Write validation error

### WriteFeatureDataCSVFilter (2 uncovered)

- [ ] L115 (`-64641`): Error creating output file (parent path)
- [ ] L150 (`-64640`): Error opening path

### WriteGBCDGMTFileFilter (3 uncovered)

- [ ] L111 (`-96710`): Missing crystal structures array
- [ ] L117 (`-96711`): Missing GBCD array
- [ ] L123 (`-96712`): Phase index larger than number of Ensembles

### WriteGBCDTriangleDataFilter (1 uncovered)

- [ ] L109 (`-48320`): DataArrays with unequal tuple counts

### WritePoleFigureFilter (1 uncovered)

- [ ] L199 (`-680000`): MaterialNames not a StringArray

### WriteStatsGenOdfAngleFileFilter (1 uncovered)

- [ ] L134 (`-9402`): DataArrays with unequal tuple counts

### WriteVtkStructuredPointsFilter (1 uncovered)

- [ ] L96 (`-2071`): DataArrays with unequal tuple counts

---

## Summary Statistics

| Category | Count |
|----------|------:|
| Algorithm classes at 0% coverage (real code) | 10 |
| Algorithm classes near-zero (< 10%) | 1 |
| Core utility at 0% | 1 |
| Filters with uncovered preflight error branches | 107 |
| Total uncovered preflight `MakeErrorResult()` calls | 213 |
| Total uncovered non-preflight `MakeErrorResult()` calls | 78 |

### Suggested Priority Order

1. **High-value algorithm tests** — ComputeArrayStatistics (1,288 lines at 9.5%),
ReadDeformKeyFileV12 (840 lines), ComputeGBPDMetricBased (739 lines),
ComputeGBCDMetricBased (612 lines)
2. **Filters with many uncovered branches** — BadDataNeighborOrientationCheckFilter (9),
ApplyTransformationToGeometryFilter (8), ComputeGBCDFilter (7),
NeighborOrientationCorrelationFilter (7), ScalarSegmentFeaturesFilter (6),
ComputeDifferencesMapFilter (6), ReadH5EbsdFilter (7), MergeTwinsFilter (5),
ComputeAvgOrientationsFilter (5), ComputeIPFColorsFilter (5),
RequireMinimumSizeFeaturesFilter (5)
3. **Quick wins** — Filters with only 1-2 uncovered branches where a single
additional test case with bad inputs would cover the error path

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.