- Direct Known Subclasses:
AffineTransformTest
,ParameterizedTransformTest
MathTransform
implementation tests. Subclasses shall assign a value
to the transform
field before to invoke any method in this class. The specified
math transform shall support the following mandatory operations:
MathTransform.getSourceDimensions()
MathTransform.getTargetDimensions()
MathTransform.transform(DirectPosition, DirectPosition)
is<Operation>Supported
fields to false
.
After TransformTestCase
has been setup, subclasses can invoke any of the verify
methods in their JUnit test methods. Callers must supply the input coordinate points to be used
for testing purpose, since the range of valid values is usually transform-dependent.
Some general rules:
- Coordinate values, or information used for computing coordinate values, are always
specified as arguments to the
verify
methods. Everything else are fields in theTransformTestCase
object. - The methods in this class do not validate the transform. It is caller responsibility to validate the transform if wanted.
- Unless otherwise indicated, every
verify
methods are independent. For example, invokingverifyConsistency(float[])
does not imply a call toverifyInverse(float[])
orverifyDerivative(double[])
. The later methods must be invoked explicitly if wanted.
- Since:
- 2.2
-
Field Summary
Modifier and TypeFieldDescriptionprotected double[]
The deltas to use for approximating math transform derivatives by the finite differences method.protected boolean
true
ifMathTransform.derivative(DirectPosition)
is supported.protected boolean
true
ifMathTransform.transform(double[],int,double[],int,int)
is supported.protected boolean
true
ifMathTransform.transform(double[],int,float[],int,int)
is supported.protected boolean
true
ifMathTransform.transform(float[],int,double[],int,int)
is supported.protected boolean
true
ifMathTransform.transform(float[],int,float[],int,int)
is supported.protected boolean
true
ifMathTransform.inverse()
is supported.protected boolean
true
if the destination array can be the same as the source array, and the source and target region of the array can overlap.protected double
Maximum difference to be accepted when comparing a transformed coordinate value with the expected value.protected ToleranceModifier
Optional modification to the tolerance threshold before to compare a coordinate tuple.protected MathTransform
The transform being tested.Fields inherited from class org.opengis.test.TestCase
configurationTip, units, validators
-
Constructor Summary
ModifierConstructorDescriptionprotected
Creates a test case initialized to default values. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Deprecated.No replacement.protected final void
assertCoordinateEquals
(double[] expected, double[] actual, int index, CalculationType mode, String message) Asserts that a single coordinate is equal to the expected one within a positive delta.protected final void
assertCoordinateEquals
(double[] expected, float[] actual, int index, CalculationType mode, String message) Asserts that a single coordinate is equal to the expected one within a positive delta.protected final void
assertCoordinateEquals
(float[] expected, double[] actual, int index, CalculationType mode, String message) Asserts that a single coordinate is equal to the expected one within a positive delta.protected final void
assertCoordinateEquals
(float[] expected, float[] actual, int index, CalculationType mode, String message) Asserts that a single coordinate is equal to the expected one within a positive delta.protected final void
assertCoordinateEquals
(String message, double[] expected, double[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinateEquals
(String message, double[] expected, float[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinateEquals
(String message, float[] expected, double[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinateEquals
(String message, float[] expected, float[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinatesEqual
(int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) Asserts that coordinate values are equal to the expected ones within a positive delta.protected final void
assertCoordinatesEqual
(int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) Asserts that coordinate values are equal to the expected ones within a positive delta.protected final void
assertCoordinatesEqual
(int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) Asserts that coordinate values are equal to the expected ones within a positive delta.protected final void
assertCoordinatesEqual
(int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) Asserts that coordinate values are equal to the expected ones within a positive delta.protected final void
assertCoordinatesEqual
(String message, int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinatesEqual
(String message, int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinatesEqual
(String message, int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected final void
assertCoordinatesEqual
(String message, int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.protected void
assertMatrixEquals
(Matrix expected, Matrix actual, Matrix tolmat, String message) Asserts that a matrix of derivatives is equal to the expected ones within a positive delta.Returns information about the configuration of the test which has been run.protected void
normalize
(DirectPosition expected, DirectPosition actual, CalculationType mode) Invoked by allassertCoordinateEqual(…)
methods before two positions are compared.protected double
tolerance
(double coordinate) Deprecated, for removal: This API element is subject to removal in a future version.Replaced bytoleranceModifier
.protected float[]
verifyConsistency
(float... sourceFloats) Transforms coordinates using various versions ofMathTransform.transform(…)
and verifies that they produce the same numerical values.protected void
verifyDerivative
(double... coordinates) Computes the derivative at the given point and compares the result with the finite differences approximation.protected float[]
verifyInDomain
(double[] minOrdinates, double[] maxOrdinates, int[] numOrdinates, Random randomGenerator) Verifies all supported transform operations in the given domain.protected void
verifyInverse
(double... coordinates) Transforms the given coordinates, applies the inverse transform and compares with the original values.protected void
verifyInverse
(float... coordinates) Transforms the given coordinates, applies the inverse transform and compares with the original values.protected void
verifyTransform
(double[] coordinates, double[] expected) Transforms the given coordinates and verifies that the result is equal (within a positive delta) to the expected ones.Methods inherited from class org.opengis.test.TestCase
getEnabledFlags
-
Field Details
-
transform
The transform being tested. Subclasses should assign a value to this field, together with thetolerance
field, before any test is run.All
ParameterizedTransformTest
test methods will set this field to a non-null value. Implementers can use this value for their own assertions after any test method has been run.- See Also:
-
isDoubleToDoubleSupported
true
ifMathTransform.transform(double[],int,double[],int,int)
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isFloatToFloatSupported
true
ifMathTransform.transform(float[],int,float[],int,int)
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isDoubleToFloatSupported
true
ifMathTransform.transform(double[],int,float[],int,int)
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isFloatToDoubleSupported
true
ifMathTransform.transform(float[],int,double[],int,int)
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isOverlappingArraySupported
true
if the destination array can be the same as the source array, and the source and target region of the array can overlap. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isInverseTransformSupported
true
ifMathTransform.inverse()
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- See Also:
-
isDerivativeSupported
true
ifMathTransform.derivative(DirectPosition)
is supported. The default value istrue
. Vendor can set this value tofalse
in order to test a transform which is not fully implemented.- Since:
- 3.1
- See Also:
-
derivativeDeltas
The deltas to use for approximating math transform derivatives by the finite differences method. Each value in this array is the delta to use for the corresponding dimension, in units of the source coordinates of the transform being tested. The array length is theoretically the number of source dimensions, but different lengths are accepted for developers convenience. If the array is smaller than the number of dimensions, then the last delta value will be reused for all remaining dimensions.Testers shall provide a non-null value if the
isDerivativeSupported
flag is set totrue
. Smaller delta would theoretically increase the finite difference precision. However in practice too small deltas decrease the precision, because of floating point errors when subtracting big numbers that are close in magnitude. In the particular case of map projections, experience suggests that a distance of 100 metres converted to decimal degrees is a good compromise. The conversion from metres to degrees can be done using the standard nautical mile length (1852.0 metres by minute of angle) as below:derivativeDeltas = new double[] {100.0 / (60 * 1852)}; // Approximately 100 metres.
- Since:
- 3.1
- See Also:
-
tolerance
Maximum difference to be accepted when comparing a transformed coordinate value with the expected value. By default this threshold is constant for all dimensions of all coordinates to be compared. If a subclass needs to adjust the tolerance threshold according the dimension or the coordinates values, then it should assign a value to thetoleranceModifier
field in addition to this one.Example: the comparisons of geographic coordinates require increasing tolerance in longitude values as the latitude get closer to a pole. For such comparisons, this
tolerance
field shall be set to a threshold value in metres and thetoleranceModifier
field shall be assigned theToleranceModifier.GEOGRAPHIC
value. See theGEOGRAPHIC
modifier javadoc for more information.The default value is 0, which means that strict equality will be required. Subclasses should set a more suitable tolerance threshold when transform is assigned a value.
- See Also:
-
toleranceModifier
Optional modification to the tolerance threshold before to compare a coordinate tuple.ToleranceModifier
instance assigned to this field (if any) are transform-dependent. The modifications applied by a particularToleranceModifier
instance to the tolerance thresholds can be position-dependent.Common values assigned to this field are
ToleranceModifier.PROJECTION
andToleranceModifier.GEOGRAPHIC
.- Since:
- 3.1
-
-
Constructor Details
-
TransformTestCase
protected TransformTestCase()
-
-
Method Details
-
configuration
Returns information about the configuration of the test which has been run. This method returns a map containing:- All the following keys defined in the
Configuration.Key
enumeration, associated to the valueBoolean.TRUE
orBoolean.FALSE
:
- Overrides:
configuration
in classTestCase
- Returns:
- the configuration of the test being run, or an empty map if none. This method returns a modifiable map in order to allow subclasses to modify it.
- Since:
- 3.1
- All the following keys defined in the
-
tolerance
Deprecated, for removal: This API element is subject to removal in a future version.Replaced bytoleranceModifier
.Returns the tolerance threshold for comparing the given coordinate value. The default implementation returns thetolerance
value directly, thus implementing an absolute tolerance threshold. If a subclass needs a relative tolerance threshold instead, it can override this method as below:return tolerance * Math.abs(coordinate);
- Parameters:
coordinate
- the coordinate value being compared.- Returns:
- the absolute tolerance threshold to use for comparing the given coordinate.
-
assertAllTestsEnabled
Deprecated.No replacement.Ensures that allis<
Operation>Supported
fields are set totrue
. This method can be invoked before testing a math transform which is expected to be fully implemented. -
verifyTransform
Transforms the given coordinates and verifies that the result is equal (within a positive delta) to the expected ones. If the difference between an expected and actual coordinate value is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.If
isInverseTransformSupported
istrue
, then this method will also transform the expected coordinate points using the inverse transform and compare with the source coordinates.- Parameters:
coordinates
- the coordinate points to transform.expected
- the expect result of the transformation, ornull
ifcoordinates
is expected to be null.- Throws:
TransformException
- if the transformation failed.- See Also:
-
verifyInverse
Transforms the given coordinates, applies the inverse transform and compares with the original values. If a difference between the expected and actual coordinate values is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.At the difference of
verifyTransform(double[],double[])
, this method does not require an array of expected values. The expected values are calculated from the transform itself.- Parameters:
coordinates
- the source coordinates to transform.- Throws:
TransformException
- if at least one coordinate cannot be transformed.
-
verifyInverse
Transforms the given coordinates, applies the inverse transform and compares with the original values. If a difference between the expected and actual coordinate values is greater than the tolerance threshold (after optional tolerance modification), then the assertion fails.The default implementation delegates to
verifyInverse(double[])
.- Parameters:
coordinates
- the source coordinates to transform.- Throws:
TransformException
- if at least one coordinate cannot be transformed.
-
verifyConsistency
Transforms coordinates using various versions ofMathTransform.transform(…)
and verifies that they produce the same numerical values. The values calculated byMathTransform.transform(DirectPosition,DirectPosition)
are used as the reference. Other transform methods (operating on arrays) will be compared against that reference, unless their checks were disabled (see class javadoc for details).This method expects an array of
float
values instead ofdouble
for making sure that theMathTransform.transform(float[], …)
andMathTransform.transform(double[], …)
methods produces the same numerical values. Thedouble
values may show extra digits when formatted in base 10, but this is not significant if their IEEE 754 representation (which use base 2) are equivalent.This method does not verify the inverse transform or the derivatives. If desired, those later methods can be verified with the
verifyInverse(float[])
andverifyDerivative(double[])
methods respectively.- Parameters:
sourceFloats
- the source coordinates to transform as an array offloat
values.- Returns:
- the transformed coordinates, returned for convenience.
- Throws:
TransformException
- if at least one coordinate cannot be transformed.- See Also:
-
verifyDerivative
Computes the derivative at the given point and compares the result with the finite differences approximation.All the three common forms of finite differences (forward difference, backward difference and central difference) are computed. If the finite difference method was a "perfect" approximation, all those three forms would produce identical results. In practice the results will differ, especially in areas where the derivative function varies fast. The difference between the results will be used as an estimation of the approximation accuracy.
The distance between the two points used by the central difference approximation shall be specified in the
derivativeDeltas
array, in units of the source CRS. If the length of thederivativeDeltas
array is smaller than the number of source dimensions, then the last delta value is used for all additional dimensions. This allows specifying a single delta value (in an array of length 1) for all dimensions.This method created the following objects:
expected
- the expected derivative result estimated by the central difference method.tolmat
- a tolerance matrix containing, for each matrix element, the largest difference found between the three approximation methods. The values in this matrix will not be lower than the modified tolerance threshold.
assertMatrixEquals(Matrix, Matrix, Matrix, String)
method. Implementers can override the latter method, for example in order to overwrite the tolerance values.- Parameters:
coordinates
- the point where to compute the derivative, in units of the source CRS.- Throws:
TransformException
- if the derivative cannot be computed, or a point cannot be transformed.- Since:
- 3.1
- See Also:
-
verifyInDomain
protected float[] verifyInDomain(double[] minOrdinates, double[] maxOrdinates, int[] numOrdinates, Random randomGenerator) throws TransformException Verifies all supported transform operations in the given domain. First, this method creates a grid of regularly spaced points along all source dimensions in the given envelope. Next, if the given random number generator is non-null, then this method adds small random displacements to every points and shuffle the coordinates in random order. Finally this method delegates the resulting array of coordinates to the following methods: The generated coordinates array is returned in case callers want to perform more tests in addition to the above-cited verifications.- Parameters:
minOrdinates
- the minimal coordinate values of the domain where to test the transform.maxOrdinates
- the maximal coordinate values of the domain where to test the transform.numOrdinates
- the number of points along each dimension.randomGenerator
- an optional random number generator, ornull
for testing using a regular grid.- Returns:
- the generated random coordinates inside the given domain of validity.
- Throws:
TransformException
- if a transform or a derivative cannot be computed.- Since:
- 3.1
-
assertCoordinateEquals
protected final void assertCoordinateEquals(float[] expected, float[] actual, int index, CalculationType mode, String message) throws TransformFailure Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinateEquals
protected final void assertCoordinateEquals(float[] expected, double[] actual, int index, CalculationType mode, String message) throws TransformFailure Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinateEquals
protected final void assertCoordinateEquals(double[] expected, float[] actual, int index, CalculationType mode, String message) throws TransformFailure Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinateEquals
protected final void assertCoordinateEquals(double[] expected, double[] actual, int index, CalculationType mode, String message) throws TransformFailure Asserts that a single coordinate is equal to the expected one within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinatesEqual
protected final void assertCoordinatesEqual(int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) throws TransformFailure Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinatesEqual
protected final void assertCoordinatesEqual(int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) throws TransformFailure Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinatesEqual
protected final void assertCoordinatesEqual(int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) throws TransformFailure Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinatesEqual
protected final void assertCoordinatesEqual(int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, CalculationType mode, String message) throws TransformFailure Asserts that coordinate values are equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual values, and the index of the coordinate where the failure was found.- Parameters:
dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.message
- the message to report in case of failure, ornull
if none.- Throws:
TransformFailure
- if at least one coordinate value is not equal to the expected value.- Since:
- 3.1
-
assertCoordinateEquals
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinateEquals(String message, float[] expected, float[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinateEquals
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinateEquals(String message, float[] expected, double[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinateEquals
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinateEquals(String message, double[] expected, float[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- the index of the coordinate point being compared, for message formatting.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinateEquals
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinateEquals(String message, double[] expected, double[] actual, int index, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.expected
- the array of expected coordinate values.actual
- the array of coordinate values to check against the expected ones.index
- he index of the coordinate point being compared, for message formatting.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinatesEqual
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinatesEqual
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinatesEqual(String message, int dimension, float[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinatesEqual
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, float[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertCoordinatesEqual
@Deprecated(since="3.1", forRemoval=true) protected final void assertCoordinatesEqual(String message, int dimension, double[] expectedPts, int expectedOffset, double[] actualPts, int actualOffset, int numPoints, boolean strict) Deprecated, for removal: This API element is subject to removal in a future version.Theboolean
argument has been replaced by aCalculationType
argument.- Parameters:
message
- the message to print in case of failure.dimension
- the dimension of each coordinate points in the arrays.expectedPts
- the array of expected coordinate values.expectedOffset
- index of the first valid coordinate in theexpectedPts
array.actualPts
- the array of coordinate values to check against the expected ones.actualOffset
- index of the first valid coordinate in theactualPts
array.numPoints
- number of coordinate points to compare.strict
-true
for ignoring the tolerance threshold. In such case, coordinate values are checked for strict equality.
-
assertMatrixEquals
protected void assertMatrixEquals(Matrix expected, Matrix actual, Matrix tolmat, String message) throws DerivativeFailure Asserts that a matrix of derivatives is equal to the expected ones within a positive delta. If the comparison fails, the given message is completed with the expected and actual matrixes values.For each matrix element, the tolerance value is given by the corresponding element in the
tolmat
matrix. This tolerance matrix is initialized by theverifyDerivative(double[])
method to the differences found between the 3 forms of finite difference (forward, backward, central). Developers can override this method and overwrite thetolmat
elements if they wish different tolerance values.- Parameters:
expected
- the expected matrix of derivative values, estimated by finite differences.actual
- the actual matrix computed by the transform to be tested.tolmat
- the tolerance value for each matrix elements, ornull
for a strict comparison.message
- the message to report in case of failure, ornull
if none.- Throws:
DerivativeFailure
- if at least one matrix element is not equal to the expected value.- Since:
- 3.1
- See Also:
-
normalize
Invoked by allassertCoordinateEqual(…)
methods before two positions are compared. This method allows subclasses to replace some equivalent coordinate values by a unique value. For example, implementations may ensure that longitude values are contained in the ±180° range, applying 360° shifts if needed.The default implementation does nothing. Subclasses can modify the
actual
coordinate values directly using theDirectPosition.setCoordinate(int, double)
method.- Parameters:
expected
- the expected coordinate value provided by the test case.actual
- the coordinate value computed by the transform being tested.mode
- indicates if the coordinates being compared are the result of a direct or inverse transform, or if strict equality is requested.- Since:
- 3.1
-