Class ArrayMathTest

java.lang.Object
org.djunits.util.ArrayMathTest

public class ArrayMathTest extends Object
Unit tests for ArrayMath. The suite aims for 100% line and branch coverage by exercising:
  • All functional (allocating) operations: add, add(a,c), subtract, scaleBy, abs, axpy, multiply, divide, reciprocal
  • All procedural (into-buffer) operations: addInto, scaleInto, axpyInto
  • All error paths: NullPointerException for null inputs and IllegalArgumentException for length mismatches
  • Edge behavior: empty arrays, in-place destinations (out == a and/or out == b), division by zero and NaN, reciprocal of 0 and Infinity
  • Coverage of the private constructor via reflection

Design: Each test documents the scenario and the expected outcome. An assertArrayClose helper is used with a tight tolerance for floating-point comparisons. 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

    • ArrayMathTest

      public ArrayMathTest()
  • Method Details