MATH-795: factored out testAddToEntry().
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1346245 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6d5b6eb0d1
commit
ce5671bfb0
|
@ -740,19 +740,6 @@ public class ArrayRealVectorTest extends RealVectorAbstractTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAddToEntry() {
|
||||
final double[] v = new double[] { 1, 2, 3 };
|
||||
final ArrayRealVector x = new ArrayRealVector(v);
|
||||
final double inc = 7;
|
||||
for (int i = 0; i < x.getDimension(); i++) {
|
||||
x.addToEntry(i, inc);
|
||||
}
|
||||
for (int i = 0; i < x.getDimension(); i++) {
|
||||
Assert.assertEquals(v[i] + inc, x.getEntry(i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RealVector create(final double[] data) {
|
||||
return new ArrayRealVector(data, true);
|
||||
|
|
|
@ -752,6 +752,20 @@ public abstract class RealVectorAbstractTest {
|
|||
Assert.assertEquals(v,TestUtils.serializeAndRecover(v));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddToEntry() {
|
||||
final double[] v = new double[] { 1, 2, 3 };
|
||||
final RealVector x = create(v);
|
||||
final double inc = 7;
|
||||
for (int i = 0; i < x.getDimension(); i++) {
|
||||
x.addToEntry(i, inc);
|
||||
}
|
||||
for (int i = 0; i < x.getDimension(); i++) {
|
||||
Assert.assertEquals(v[i] + inc, x.getEntry(i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTS OF THE VISITOR PATTERN
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue