Author: celestin Date: Fri Jun 8 03:24:01 2012 New Revision: 1347877 URL: http://svn.apache.org/viewvc?rev=1347877&view=rev Log: MATH-795: extracted testGetSubVector() from RealVectorAbstractTest.testDataInOut().
Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java?rev=1347877&r1=1347876&r2=1347877&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorAbstractTest.java Fri Jun 8 03:24:01 2012 @@ -300,15 +300,24 @@ public abstract class RealVectorAbstract } @Test + public void testGetSubvector() { + final double x = getPreferredEntryValue(); + final double[] data = {x, x, x, 1d, x, 2d, x, x, 3d, x, x, x, 4d, x, x, x}; + final int index = 1; + final int n = data.length - 5; + final RealVector actual = create(data).getSubVector(index, n); + final double[] expected = new double[n]; + System.arraycopy(data, index, expected, 0, n); + TestUtils.assertEquals("", expected, actual, 0d); + } + + @Test public void testDataInOut() { final RealVector v1 = create(vec1); final RealVector v2 = create(vec2); final RealVector v4 = create(vec4); final RealVector v2_t = createAlien(vec2); - final RealVector vout5 = v4.getSubVector(3, 3); - Assert.assertEquals("testData len", 3, vout5.getDimension()); - Assert.assertEquals("testData is 4.0 ", 5.0, vout5.getEntry(1), 0); try { v4.getSubVector(3, 7); Assert.fail("OutOfRangeException expected"); Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java?rev=1347877&r1=1347876&r2=1347877&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/RealVectorTest.java Fri Jun 8 03:24:01 2012 @@ -213,6 +213,13 @@ public class RealVectorTest extends Real } @Test + @Ignore("Abstract class RealVector does not implement getSubvector(int, int)") + @Override + public void testGetSubvector() { + // Do nothing + } + + @Test @Ignore @Override public void testBasicFunctions() {