In TestUtils, improved handling of error messages for
- assertEquals(String, double[], RealVector, double), - assertEquals(String, RealVector, RealVector, double). git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1347393 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ca70b29dd7
commit
3a7911512f
|
@ -253,10 +253,11 @@ public class TestUtils {
|
|||
*/
|
||||
public static void assertEquals(final String message,
|
||||
final double[] expected, final RealVector actual, final double delta) {
|
||||
Assert.assertEquals(message + ", dimension", expected.length,
|
||||
final String msgAndSep = message.equals("") ? "" : message + ", ";
|
||||
Assert.assertEquals(msgAndSep + "dimension", expected.length,
|
||||
actual.getDimension());
|
||||
for (int i = 0; i < expected.length; i++) {
|
||||
Assert.assertEquals(message + ", entry #" + i, expected[i],
|
||||
Assert.assertEquals(msgAndSep + "entry #" + i, expected[i],
|
||||
actual.getEntry(i), delta);
|
||||
}
|
||||
}
|
||||
|
@ -274,11 +275,12 @@ public class TestUtils {
|
|||
*/
|
||||
public static void assertEquals(final String message,
|
||||
final RealVector expected, final RealVector actual, final double delta) {
|
||||
Assert.assertEquals(message + ", dimension", expected.getDimension(),
|
||||
final String msgAndSep = message.equals("") ? "" : message + ", ";
|
||||
Assert.assertEquals(msgAndSep + "dimension", expected.getDimension(),
|
||||
actual.getDimension());
|
||||
final int dim = expected.getDimension();
|
||||
for (int i = 0; i < dim; i++) {
|
||||
Assert.assertEquals(message + ", entry #" + i,
|
||||
Assert.assertEquals(msgAndSep + "entry #" + i,
|
||||
expected.getEntry(i), actual.getEntry(i), delta);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue