Class SparseFloatDataSiTest

java.lang.Object
org.djunits.vecmat.storage.SparseFloatDataSiTest

public class SparseFloatDataSiTest extends Object
Unit tests for SparseFloatDataSi.

Achieves full branch and method coverage, including:

  • All constructors
  • Validation of nulls, bounds, ragged matrices, and index invariants
  • Sparse generation via all storeSparse(...) overloads
  • Binary-search paths in get()
  • All DataGrid default methods (getRowArray, getColArray)
  • copy(), instantiateNew(), cardinality()
  • SI conversion using Length
  • equals and hashCode
Copyright (c) 2025-2026 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djunits.org. The DJUNITS project is distributed under a three-clause BSD-style license.
Author:
Alexander Verbraeck (specifications); Test implementation by Copilot.
  • Constructor Details

    • SparseFloatDataSiTest

      public SparseFloatDataSiTest()
  • Method Details

    • testProtectedConstructor

      @Test @DisplayName("protected ctor(float[],indexes,r,c): validates length, order, bounds") public void testProtectedConstructor()
      Test protected constructor(float[], int[], r, c) via reflection-like access through copy().
    • testLengthErrors

      @Test public void testLengthErrors()
      Test length errors.
    • testCtorDenseData

      @Test @DisplayName("ctor(double[],r,c): basic sparse conversion + validations") public void testCtorDenseData()
      Constructor: double[] denseData.
    • testCtorDenseFloatData

      @Test @DisplayName("ctor(float[],r,c): basic sparse conversion + validations") public void testCtorDenseFloatData()
      Constructor: float[] denseData.
    • testCtorMatrix

      @Test @DisplayName("ctor(double[][]): ragged detection + safe sparse copy") public void testCtorMatrix()
      Constructor: double[][] densely.
    • testCtorFloatMatrix

      @Test @DisplayName("ctor(float[][]): ragged detection + safe sparse copy") public void testCtorFloatMatrix()
      Constructor: float[][] densely.
    • testCtorSparseQArray

      @Test @DisplayName("ctor(Q[],indexes): SI conversion + safe copies") public void testCtorSparseQArray()
      Constructor: Q[] sparseData + indexes + safe copy.
    • testCtorDenseQArray

      @Test @DisplayName("ctor(Q[],r,c): full dense \u2192 sparse with SI conversion") public void testCtorDenseQArray()
      Constructor: Q[] denseData to sparse safe copy.
    • testCtorMatrixQ

      @Test @DisplayName("ctor(Q[][]): SI conversion + ragged detection + sparse copy") public void testCtorMatrixQ()
      Constructor(Q[][]): SI conversion + ragged detection + sparse copy.
    • testCtorCollection

      @Test @DisplayName("ctor(Collection): row/col bounds + SI") public void testCtorCollection()
      Constructor(Collection): row/col bounds + SI.
    • testGetAndGetDataArray

      @Test @DisplayName("get() and getDataArray(): binary search hit/miss + safe copy") public void testGetAndGetDataArray()
      get() and getDataArray(): binary search hit/miss + safe copy.
    • testRowColDefaults

      @Test @DisplayName("DataGrid.getRowArray / getColArray: correctness + bounds") public void testRowColDefaults()
      DataGrid.getRowArray / getColArray: correctness + bounds.
    • testCopy

      @Test @DisplayName("copy(): deep copy") public void testCopy()
      Test deep copy.
    • testInstantiateNew

      @Test @DisplayName("instantiateNew: reshape and size validation") public void testInstantiateNew()
      Test instantiateNew.
    • testCardinality

      @Test @DisplayName("cardinality: count non-zero sparse entries") public void testCardinality()
      Test cardinality.
    • testEqualsHashCode

      @Test @DisplayName("equals/hashCode: reflexive, symmetric, correct mismatch detection") public void testEqualsHashCode()
      Test equals and hashCode.