Package org.djunits.unit.scale
Class ScaleTest
java.lang.Object
org.djunits.unit.scale.ScaleTest
ScaleTest tests the different types of conversion scales for units.
Copyright (c) 2013-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
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTest constructors against illegal arguments.voidequals/hashCode: symmetry, transitivity, and inequality with close-but-different parameters.voidGradeScale: more trigonometric sanity tests and round-trips.voidExtra round-trip checks for IdentityScale and LinearScale.voidisBaseScale() checks across scale classes.voidConstructor validation for LinearScale(numerator, denominator).voidCorrectness for LinearScale(numerator, denominator) using the km/h ↔ m/s example.voidRendering should not mutate internal state (smoke check for all scales).voidTest the correct implementation of scales.voidExtremes and special doubles — adapt depending on the intended contract.
-
Constructor Details
-
ScaleTest
public ScaleTest()
-
-
Method Details
-
testScale
@Test public void testScale()Test the correct implementation of scales. -
testIdentityAndLinearRoundTrip
@Test public void testIdentityAndLinearRoundTrip()Extra round-trip checks for IdentityScale and LinearScale. -
testGradeScaleAdditional
@Test public void testGradeScaleAdditional()GradeScale: more trigonometric sanity tests and round-trips. -
testEqualsHashCodeContracts
@Test public void testEqualsHashCodeContracts()equals/hashCode: symmetry, transitivity, and inequality with close-but-different parameters. -
testRenderingNoMutation
@Test public void testRenderingNoMutation()Rendering should not mutate internal state (smoke check for all scales). -
testSpecialDoubleBehavior
@Test public void testSpecialDoubleBehavior()Extremes and special doubles — adapt depending on the intended contract. If NaN/Infinite should be rejected, replace with assertThrows. -
testConstructorValidation
@Test public void testConstructorValidation()Test constructors against illegal arguments. -
testLinearScaleNumDenConstructorValidation
@Test public void testLinearScaleNumDenConstructorValidation()Constructor validation for LinearScale(numerator, denominator). -
testLinearScaleNumDenCorrectness
@Test public void testLinearScaleNumDenCorrectness()Correctness for LinearScale(numerator, denominator) using the km/h ↔ m/s example. A value in km/h multiplied by (1000/3600) yields m/s. -
testIsBaseScale
@Test public void testIsBaseScale()isBaseScale() checks across scale classes.
-