Package org.djunits.util
Class ConstantsTest
java.lang.Object
org.djunits.util.ConstantsTest
Unit tests for
Constants. Although it is a constants holder, we can still verify:
- Numerical values are as declared (within appropriate tolerances)
- Dimensionality (SI units) of each constant
- Key identities/relations, e.g., μ0·ε0·c² ≈ 1 and ħ = h / (2π)
- Sign and units of elementary-charge based quantities
Notes on tolerances: Some constants include an uncertainty in the comment; relations like μ0·ε0·c² = 1 are tested with a small tolerance to account for those stated uncertainties. Exact definitions (e.g., c, h, N_A) are still subject to floating-point representation; we therefore use a tiny absolute/relative tolerance. 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 TypeMethodDescription(package private) voidVerifies PI, TAU, E, PHI areDimensionlesswithUnitless.BASEand correct values.(package private) voidVerifies luminous efficacy dimensionality after fixing the unit string in Constants to include m^2 in the denominator.(package private) voidVerifies the physical identity μ0 · ε0 · c² ≈ 1 (dimensionless).(package private) voidVerifies dimensionality and representative numeric values for fundamental constants.
-
Constructor Details
-
ConstantsTest
public ConstantsTest()
-
-
Method Details
-
dimensionlessMathConstants
@Test void dimensionlessMathConstants()Verifies PI, TAU, E, PHI areDimensionlesswithUnitless.BASEand correct values. -
siConstantsDimensionalityAndValues
@Test void siConstantsDimensionalityAndValues()Verifies dimensionality and representative numeric values for fundamental constants. -
mu0TimesEpsilon0TimesCSquaredIsOne
@Test void mu0TimesEpsilon0TimesCSquaredIsOne()Verifies the physical identity μ0 · ε0 · c² ≈ 1 (dimensionless). Uses a modest tolerance due to stated uncertainties in μ0 and ε0. -
luminousEfficacyDimensionality
@Test void luminousEfficacyDimensionality()Verifies luminous efficacy dimensionality after fixing the unit string in Constants to include m^2 in the denominator.Enable this test once you change
"cdsrs3/kg" → "cds3sr/kgm2"
-