|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
ObjectTestCase
TransformTestCase
public abstract class TransformTestCase
Base class for 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:
verify methods. Everything else are fields in
the TransformTestCase object.verify methods are independent. For example invoking
verifyConsistency(float[]) does not imply a call to verifyInverse(float[])
or verifyDerivative(double[]). The later methods must be invoked explicitely if wanted.
| Field Summary | |
|---|---|
protected double[] |
derivativeDeltas
The deltas to use for approximating math transform derivatives by the finite differences method. |
protected boolean |
isDerivativeSupported
true if MathTransform.derivative(DirectPosition) is supported. |
protected boolean |
isDoubleToDoubleSupported
true if MathTransform.transform(double[],int,double[],int,int)
is supported. |
protected boolean |
isDoubleToFloatSupported
true if MathTransform.transform(double[],int,float[],int,int)
is supported. |
protected boolean |
isFloatToDoubleSupported
true if MathTransform.transform(float[],int,double[],int,int)
is supported. |
protected boolean |
isFloatToFloatSupported
true if MathTransform.transform(float[],int,float[],int,int)
is supported. |
protected boolean |
isInverseTransformSupported
true if MathTransform.inverse() is supported. |
protected boolean |
isOverlappingArraySupported
true if the destination array can be the same than the source array,
and the source and target region of the array can overlap. |
protected double |
tolerance
Maximum difference to be accepted when comparing a transformed ordinate value with the expected value. |
protected ToleranceModifier |
toleranceModifier
Optional modification to the tolerance threshold before to compare a coordinate points. |
protected MathTransform |
transform
The transform being tested. |
| Fields inherited from class TestCase |
|---|
configurationTip, listener, NO_FACTORY, validators |
| Constructor Summary | |
|---|---|
protected |
TransformTestCase()
Creates a new test without factory. |
protected |
TransformTestCase(Factory... factories)
Creates a test case initialized to default values. |
| Method Summary | |
|---|---|
protected void |
assertAllTestsEnabled()
Deprecated. No replacement. |
protected void |
assertCoordinateEquals(String message,
double[] expected,
double[] actual,
int index,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinateEquals(String message,
double[] expected,
double[] actual,
int index,
CalculationType mode)
Asserts that a single coordinate is equal to the expected one within a positive delta. |
protected void |
assertCoordinateEquals(String message,
double[] expected,
float[] actual,
int index,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinateEquals(String message,
double[] expected,
float[] actual,
int index,
CalculationType mode)
Asserts that a single coordinate is equal to the expected one within a positive delta. |
protected void |
assertCoordinateEquals(String message,
float[] expected,
double[] actual,
int index,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinateEquals(String message,
float[] expected,
double[] actual,
int index,
CalculationType mode)
Asserts that a single coordinate is equal to the expected one within a positive delta. |
protected void |
assertCoordinateEquals(String message,
float[] expected,
float[] actual,
int index,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinateEquals(String message,
float[] expected,
float[] actual,
int index,
CalculationType mode)
Asserts that a single coordinate is equal to the expected one within a positive delta. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
Asserts that coordinate values are equal to the expected ones within a positive delta. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
Asserts that coordinate values are equal to the expected ones within a positive delta. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
Asserts that coordinate values are equal to the expected ones within a positive delta. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
Deprecated. The boolean argument has been replaced by a CalculationType argument. |
protected void |
assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
Asserts that coordinate values are equal to the expected ones within a positive delta. |
protected void |
assertMatrixEquals(String message,
Matrix expected,
Matrix actual,
Matrix tolmat)
Asserts that a matrix of derivatives is equals to the expected ones within a positive delta. |
Configuration |
configuration()
Returns information about the configuration of the test which has been run. |
protected void |
normalize(DirectPosition expected,
DirectPosition actual,
CalculationType mode)
Invoked by all assertCoordinateEqual(…) methods before two positions are compared. |
protected double |
tolerance(double ordinate)
Deprecated. Replaced by toleranceModifier. |
protected float[] |
verifyConsistency(float... sourceFloats)
Transforms coordinates using various versions of MathTransform.transform(…)
and verifies that they produce the same numerical values. |
protected void |
verifyDerivative(double... coordinate)
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 equals (within a positive delta) to the expected ones. |
| Methods inherited from class TestCase |
|---|
addTestListener, factories, factories, getEnabledFlags, removeTestListener |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected MathTransform transform
tolerance field, before any test is run.
All ParameterizedTransformTest test methods will set this field to a non-null value.
Implementors can use this value for their own assertions after any test method has been run.
toleranceprotected boolean isDoubleToDoubleSupported
true if MathTransform.transform(double[],int,double[],int,int)
is supported. The default value is true. Vendor can set this value to
false in order to test a transform which is not fully implemented.
isFloatToFloatSupported,
isDoubleToFloatSupported,
isFloatToDoubleSupported,
verifyConsistency(float[])protected boolean isFloatToFloatSupported
true if MathTransform.transform(float[],int,float[],int,int)
is supported. The default value is true. Vendor can set this value to
false in order to test a transform which is not fully implemented.
isDoubleToDoubleSupported,
isDoubleToFloatSupported,
isFloatToDoubleSupported,
verifyConsistency(float[])protected boolean isDoubleToFloatSupported
true if MathTransform.transform(double[],int,float[],int,int)
is supported. The default value is true. Vendor can set this value to
false in order to test a transform which is not fully implemented.
isDoubleToDoubleSupported,
isFloatToFloatSupported,
isFloatToDoubleSupported,
verifyConsistency(float[])protected boolean isFloatToDoubleSupported
true if MathTransform.transform(float[],int,double[],int,int)
is supported. The default value is true. Vendor can set this value to
false in order to test a transform which is not fully implemented.
isDoubleToDoubleSupported,
isFloatToFloatSupported,
isDoubleToFloatSupported,
verifyConsistency(float[])protected boolean isOverlappingArraySupported
true if the destination array can be the same than the source array,
and the source and target region of the array can overlap. The default value
is true. Vendor can set this value to false in order to test
a transform which is not fully implemented.
verifyConsistency(float[])protected boolean isInverseTransformSupported
true if MathTransform.inverse() is supported. The default value
is true. Vendor can set this value to false in order to test a
transform which is not fully implemented.
verifyTransform(double[], double[])protected boolean isDerivativeSupported
true if MathTransform.derivative(DirectPosition) is supported. The
default value is true. Vendor can set this value to false in order
to test a transform which is not fully implemented.
derivativeDeltas,
verifyDerivative(double[])protected double[] derivativeDeltas
Testers shall provide a non-null value if the isDerivativeSupported flag is set to
true. 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)}; // Approximatively 100 metres.
isDerivativeSupported,
verifyDerivative(double[])protected double tolerance
toleranceModifier 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 the
toleranceModifier field shall be assigned the ToleranceModifier.GEOGRAPHIC
value. See the GEOGRAPHIC 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.
transform,
toleranceModifierprotected ToleranceModifier toleranceModifier
ToleranceModifier instance assigned to this field (if any)
are transform-dependent. The modifications applied by a particular
ToleranceModifier instance to the tolerance thresholds is position-dependent.
Common values assigned to this field are ToleranceModifier.PROJECTION and
ToleranceModifier.GEOGRAPHIC.
| Constructor Detail |
|---|
protected TransformTestCase()
MathTransform directly, without using any factory.
protected TransformTestCase(Factory... factories)
is<Operation>Supported are set
to true unless at least one ImplementationDetails
object disabled some tests.
factories - The factories to be used by the test. Those factories will be given to
ImplementationDetails.configuration(Factory[]) in order
to decide which tests should be enabled.| Method Detail |
|---|
public Configuration configuration()
Configuration.Key enumeration,
associated to the value Boolean.TRUE or Boolean.FALSE:
"isToleranceRelaxed" key associated to the value Boolean.TRUE
if the ToleranceModifiers.getImplementationSpecific(MathTransform) method
found at least one ToleranceModifier on the classpath, or
Boolean.FALSE otherwise.
configuration in class TestCaseImplementationDetails.configuration(Factory[])@Deprecated protected double tolerance(double ordinate)
toleranceModifier.
tolerance 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(ordinate);
ordinate - The ordinate value being compared.
@Deprecated protected void assertAllTestsEnabled()
is<Operation>Supported fields
are set to true. This method can be invoked before testing a math transform which
is expected to be fully implemented.
protected void verifyTransform(double[] coordinates,
double[] expected)
throws TransformException
If isInverseTransformSupported is true, then this method will also
transform the expected coordinate points using the inverse transform and compare with the source coordinates.
coordinates - The coordinate points to transform.expected - The expect result of the transformation, or
null if coordinates is expected to be null.
TransformException - if the transformation failed.isInverseTransformSupported
protected void verifyInverse(double... coordinates)
throws TransformException
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.
coordinates - The source coordinates to transform.
TransformException - if at least one coordinate can't be transformed.
protected void verifyInverse(float... coordinates)
throws TransformException
The default implementation delegates to verifyInverse(double[]).
coordinates - The source coordinates to transform.
TransformException - if at least one coordinate can't be transformed.
protected float[] verifyConsistency(float... sourceFloats)
throws TransformException
MathTransform.transform(…)
and verifies that they produce the same numerical values. The values calculated by
MathTransform.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 than double
for making sure that the MathTransform.transform(float[], …) and
MathTransform.transform(double[], …) methods produces the same numerical values.
The double 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[]) and
verifyDerivative(double[]) methods respectively.
sourceFloats - The source coordinates to transform as an array of float values.
TransformException - if at least one coordinate can't be transformed.isDoubleToDoubleSupported,
isFloatToFloatSupported,
isDoubleToFloatSupported,
isFloatToDoubleSupported,
isOverlappingArraySupported
protected void verifyDerivative(double... coordinate)
throws TransformException
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 the derivativeDeltas 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(String, Matrix, Matrix,
Matrix) method. Implementors can override the later method, for example in order to overwrite
the tolerance values.
coordinate - The point where to compute the derivative, in units of the source CRS.
TransformException - If the derivative can not be computed, or a point can not be
transformed.MathTransform.derivative(DirectPosition),
assertMatrixEquals(String, Matrix, Matrix, Matrix)
protected float[] verifyInDomain(double[] minOrdinates,
double[] maxOrdinates,
int[] numOrdinates,
Random randomGenerator)
throws TransformException
minOrdinates - The minimal ordinate values of the domain where to test the transform.maxOrdinates - The maximal ordinate values of the domain where to test the transform.numOrdinates - The number of points along each dimension.randomGenerator - An optional random number generator, or null for testing
using a regular grid.
TransformException - If a transform or a derivative can not be computed.
protected final void assertCoordinateEquals(String message,
float[] expected,
float[] actual,
int index,
CalculationType mode)
throws TransformFailure
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinateEquals(String message,
float[] expected,
double[] actual,
int index,
CalculationType mode)
throws TransformFailure
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinateEquals(String message,
double[] expected,
float[] actual,
int index,
CalculationType mode)
throws TransformFailure
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinateEquals(String message,
double[] expected,
double[] actual,
int index,
CalculationType mode)
throws TransformFailure
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
throws TransformFailure
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
throws TransformFailure
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
throws TransformFailure
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
protected final void assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
CalculationType mode)
throws TransformFailure
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts 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.
TransformFailure - If at least one ordinate value is not equal to the expected value.
@Deprecated
protected final void assertCoordinateEquals(String message,
float[] expected,
float[] actual,
int index,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinateEquals(String message,
float[] expected,
double[] actual,
int index,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinateEquals(String message,
double[] expected,
float[] actual,
int index,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinateEquals(String message,
double[] expected,
double[] actual,
int index,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
message - The message to print in case of failure.expected - The array of expected ordinate values.actual - The array of ordinate 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, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts array.numPoints - Number of coordinate points to compare.strict - true for ignoring the tolerance
threshold. In such case, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinatesEqual(String message,
int dimension,
float[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts array.numPoints - Number of coordinate points to compare.strict - true for ignoring the tolerance
threshold. In such case, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
float[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts array.numPoints - Number of coordinate points to compare.strict - true for ignoring the tolerance
threshold. In such case, ordinate values are checked for strict equality.
@Deprecated
protected final void assertCoordinatesEqual(String message,
int dimension,
double[] expectedPts,
int expectedOffset,
double[] actualPts,
int actualOffset,
int numPoints,
boolean strict)
boolean argument has been replaced by a CalculationType argument.
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 ordinate in the expectedPts array.actualPts - The array of coordinate values to check against the expected ones.actualOffset - Index of the first valid ordinate in the actualPts array.numPoints - Number of coordinate points to compare.strict - true for ignoring the tolerance
threshold. In such case, ordinate values are checked for strict equality.
protected void assertMatrixEquals(String message,
Matrix expected,
Matrix actual,
Matrix tolmat)
throws DerivativeFailure
For each matrix element, the tolerance value is given by the corresponding element in the
tolmat matrix. This tolerance matrix is initialized by the
verifyDerivative(double[]) method to the differences found between the 3 forms of
finite difference (forward, backward, central).
Developers can override this method and overwrite the tolmat elements if they
wish different tolerance values.
message - The message to print in case of failure.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, or null for a strict comparison.
DerivativeFailure - If at least one matrix element is not equal to the expected value.verifyDerivative(double[])
protected void normalize(DirectPosition expected,
DirectPosition actual,
CalculationType mode)
assertCoordinateEqual(…) methods before two positions are compared.
This method allows subclasses to replace some equivalent ordinate 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 ordinate
values directly using the DirectPosition.setOrdinate(int, double) method.
expected - The expected ordinate value provided by the test case.actual - The ordinate 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||