Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D9979343 for ; Fri, 8 Jun 2012 19:57:08 +0000 (UTC) Received: (qmail 50898 invoked by uid 500); 8 Jun 2012 19:57:07 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 50806 invoked by uid 500); 8 Jun 2012 19:57:07 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 50758 invoked by uid 99); 8 Jun 2012 19:57:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 19:57:07 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 19:57:04 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 356FF238899C for ; Fri, 8 Jun 2012 19:56:43 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1348211 - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear: RealVectorAbstractTest.java RealVectorTest.java Date: Fri, 08 Jun 2012 19:56:43 -0000 To: commits@commons.apache.org From: celestin@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120608195643.356FF238899C@eris.apache.org> Author: celestin Date: Fri Jun 8 19:56:42 2012 New Revision: 1348211 URL: http://svn.apache.org/viewvc?rev=1348211&view=rev Log: MATH-795: in RealVectorAbstractTest, added unit tests for RealVector.setSubVector(int, RealVector). 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=1348211&r1=1348210&r2=1348211&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 19:56:42 2012 @@ -337,6 +337,51 @@ public abstract class RealVectorAbstract } @Test + public void testSetSubVectorSameType() { + final double x = getPreferredEntryValue(); + final double[] expected = {x, x, x, 1d, x, 2d, x, x, 3d, x, x, x, 4d, x, x, x}; + final double[] sub = {5d, x, 6d, 7d, 8d}; + final RealVector actual = create(expected); + final int index = 2; + actual.setSubVector(index, create(sub)); + + for (int i = 0; i < sub.length; i++){ + expected[index + i] = sub[i]; + } + TestUtils.assertEquals("", expected, actual, 0d); + } + + @Test + public void testSetSubVectorMixedType() { + final double x = getPreferredEntryValue(); + final double[] expected = {x, x, x, 1d, x, 2d, x, x, 3d, x, x, x, 4d, x, x, x}; + final double[] sub = {5d, x, 6d, 7d, 8d}; + final RealVector actual = create(expected); + final int index = 2; + actual.setSubVector(index, createAlien(sub)); + + for (int i = 0; i < sub.length; i++){ + expected[index + i] = sub[i]; + } + TestUtils.assertEquals("", expected, actual, 0d); + } + + @Test(expected = OutOfRangeException.class) + public void testSetSubVectorInvalidIndex1() { + create(new double[10]).setSubVector(-1, create(new double[2])); + } + + @Test(expected = OutOfRangeException.class) + public void testSetSubVectorInvalidIndex2() { + create(new double[10]).setSubVector(10, create(new double[2])); + } + + @Test(expected = OutOfRangeException.class) + public void testSetSubVectorInvalidIndex3() { + create(new double[10]).setSubVector(9, create(new double[2])); + } + + @Test public void testDataInOut() { final RealVector v1 = create(vec1); final RealVector v2 = create(vec2); 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=1348211&r1=1348210&r2=1348211&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 19:56:42 2012 @@ -248,6 +248,41 @@ public class RealVectorTest extends Real } @Test + @Ignore("Abstract class RealVector does not implement setSubvector(int, RealVector)") + @Override + public void testSetSubVectorSameType() { + // Do nothing + } + + @Test + @Ignore("Abstract class RealVector does not implement setSubvector(int, RealVector)") + @Override + public void testSetSubVectorMixedType() { + // Do nothing + } + + @Test + @Ignore("Abstract class RealVector does not implement setSubvector(int, RealVector)") + @Override + public void testSetSubVectorInvalidIndex1() { + // Do nothing + } + + @Test + @Ignore("Abstract class RealVector does not implement setSubvector(int, RealVector)") + @Override + public void testSetSubVectorInvalidIndex2() { + // Do nothing + } + + @Test + @Ignore("Abstract class RealVector does not implement setSubvector(int, RealVector)") + @Override + public void testSetSubVectorInvalidIndex3() { + // Do nothing + } + + @Test @Ignore @Override public void testBasicFunctions() {