Package org.djunits.vecmat.storage
Class DenseFloatDataSiTest
java.lang.Object
org.djunits.vecmat.storage.DenseFloatDataSiTest
Unit tests for
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.
DenseFloatDataSi.
This test class verifies the complete functional behavior of DenseFloatDataSi and all default methods inherited from
DataGridSi. All tests focus on correct functional semantics. If the implementation contains bugs or produces
incorrect results, these tests are designed to fail.
- All constructors (float[], float[][], Q[][])
- Bounds checking on
get(int,int) - All default
DataGridmethods:getRowArray,getColArray - Copy semantics
- Instantiations via
instantiateNew - Cardinality behavior
- Equality and hashCode
- SI-conversion correctness for Q[][] (using Length)
- Float → double copying correctness in
getSiArray()
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTest cardinality semantics: counts non-zero entries; counts NaN and infinity as non-zero.voidtestCopy()Test deep copy semantics ofcopy().voidTest constructor(float[][]) for safe-copy semantics, validation, row-major correctness, and ragged-row exact exception class.voidTest validation paths for constructor(float[],r,c).voidTest constructor(Q[][]) for safe-copy, SI conversion, and ragged detection.voidTest equals and hashCode semantics.voidTestgetColArrayincluding bounds checking.voidVerify thatgetSiArray()returns a *new* double array each call and does not expose the internal float[].voidTest all out-of-bounds read conditions.voidTestgetRowArrayincluding bounds checking.voidTestinstantiateNew(double[], r, c)for correct reshape and error handling.voidTestinstantiateNew(double[])conversion double→float and geometry preservation.voidTest of(double[], r, c, Unit): nulls and SI conversion.voidTest of(double[][], Unit): nulls, ragged, SI conversion.voidTest of(float[], r, c, Unit): nulls and SI conversion.voidTest of(float[][], Unit): nulls, ragged, SI conversion.voidTest of(Q[], r, c): nulls and SI conversion.voidTest of(Q[][]): nulls, ragged, element nulls, SI conversion.voidTest ofSi(double[], r, c): nulls, size, safe copy.voidTest ofSi(double[][]): nulls, ragged rows, SI preservation.voidTest ofSi(float[], r, c): nulls, size, safe copy.voidTest ofSi(float[][]): nulls, ragged rows, safe copy.voidVerifyDenseDoubleDataSi.ofSi(double[], int, int)rejects mismatched sizes.voidTestrows(),cols(), andget(int,int)for normal behavior.
-
Constructor Details
-
DenseFloatDataSiTest
public DenseFloatDataSiTest()
-
-
Method Details
-
testRowsColsGet
@Test @DisplayName("rows/cols/get: happy-path read access") public void testRowsColsGet()Testrows(),cols(), andget(int,int)for normal behavior. -
testGetOutOfBounds
@Test @DisplayName("get: bounds checking exceptions") public void testGetOutOfBounds()Test all out-of-bounds read conditions. -
testGetRowArray
@Test @DisplayName("DataGrid.getRowArray: normal and error paths") public void testGetRowArray()TestgetRowArrayincluding bounds checking. -
testGetColArray
@Test @DisplayName("DataGrid.getColArray: normal and error paths") public void testGetColArray()TestgetColArrayincluding bounds checking. -
testGetDataArrayCopy
@Test @DisplayName("getDataArray: returns new array every time; not exposing internals") public void testGetDataArrayCopy()Verify thatgetSiArray()returns a *new* double array each call and does not expose the internal float[]. -
testCopy
@Test @DisplayName("copy: deep-copy of internal float array") public void testCopy()Test deep copy semantics ofcopy(). -
testInstantiateNewSameDims
@Test @DisplayName("instantiateNew(double[]): shape preserved, float cast correct") public void testInstantiateNewSameDims()TestinstantiateNew(double[])conversion double→float and geometry preservation. -
testInstantiateNewNewDims
@Test @DisplayName("instantiateNew(double[],r,c): reshape + float casting") public void testInstantiateNewNewDims()TestinstantiateNew(double[], r, c)for correct reshape and error handling. -
testCardinality
@Test @DisplayName("cardinality: float rules incl. -0f, NaN, infinities") public void testCardinality()Test cardinality semantics: counts non-zero entries; counts NaN and infinity as non-zero. -
testEqualsHashCode
@Test @DisplayName("equals/hashCode: reflexivity, symmetry, difference detection") public void testEqualsHashCode()Test equals and hashCode semantics. -
testCtorFloatArrayValidation
@Test @DisplayName("ctor(float[],r,c): validation of null, size, geometry") public void testCtorFloatArrayValidation()Test validation paths for constructor(float[],r,c). -
testCtor2DFloatArray
@Test @DisplayName("ctor(float[][]): validation, safe copy, row-major, ragged detection") public void testCtor2DFloatArray()Test constructor(float[][]) for safe-copy semantics, validation, row-major correctness, and ragged-row exact exception class. -
testCtorQuantityArray
@Test @DisplayName("ctor(Q[][]): SI conversion, safe copy, ragged detection") public void testCtorQuantityArray()Test constructor(Q[][]) for safe-copy, SI conversion, and ragged detection. -
testOfSiLengthMismatch
@Test @DisplayName("ofSi(double[], rows, cols): length mismatch") public void testOfSiLengthMismatch()VerifyDenseDoubleDataSi.ofSi(double[], int, int)rejects mismatched sizes. -
testOfSiFloatArray
@Test @DisplayName("ofSi(float[], r, c): nulls, size, safe copy") public void testOfSiFloatArray()Test ofSi(float[], r, c): nulls, size, safe copy. -
testOfSiDoubleArray
@Test @DisplayName("ofSi(double[], r, c): nulls, size, cast correctness") public void testOfSiDoubleArray()Test ofSi(double[], r, c): nulls, size, safe copy. -
testOfFloatArrayUnit
@Test @DisplayName("of(float[], r, c, Unit): nulls and SI conversion") public void testOfFloatArrayUnit()Test of(float[], r, c, Unit): nulls and SI conversion. -
testOfDoubleArrayUnit
@Test @DisplayName("of(double[], r, c, Unit): nulls and SI conversion") public void testOfDoubleArrayUnit()Test of(double[], r, c, Unit): nulls and SI conversion. -
testOfQuantityArray
@Test @DisplayName("of(Q[], r, c): nulls and SI conversion") public void testOfQuantityArray()Test of(Q[], r, c): nulls and SI conversion. -
testOfSiFloatGrid
@Test @DisplayName("ofSi(float[][]): nulls, ragged rows, safe copy") public void testOfSiFloatGrid()Test ofSi(float[][]): nulls, ragged rows, safe copy. -
testOfSiDoubleGrid
@Test @DisplayName("ofSi(double[][]): nulls, ragged rows, SI preservation") public void testOfSiDoubleGrid()Test ofSi(double[][]): nulls, ragged rows, SI preservation. -
testOfFloatGridUnit
@Test @DisplayName("of(float[][], Unit): nulls, ragged, SI conversion") public void testOfFloatGridUnit()Test of(float[][], Unit): nulls, ragged, SI conversion. -
testOfDoubleGridUnit
@Test @DisplayName("of(double[][], Unit): nulls, ragged, SI conversion") public void testOfDoubleGridUnit()Test of(double[][], Unit): nulls, ragged, SI conversion. -
testOfQuantityGrid
@Test @DisplayName("of(Q[][]): nulls, ragged, element nulls, SI conversion") public void testOfQuantityGrid()Test of(Q[][]): nulls, ragged, element nulls, SI conversion.
-