commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From celes...@apache.org
Subject svn commit: r1346471 - in /commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear: ArrayRealVectorTest.java RealVectorAbstractTest.java RealVectorTest.java
Date Tue, 05 Jun 2012 17:08:21 GMT
Author: celestin
Date: Tue Jun  5 17:08:20 2012
New Revision: 1346471

URL: http://svn.apache.org/viewvc?rev=1346471&view=rev
Log:
MATH-795: factored out testCosine().

Modified:
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/ArrayRealVectorTest.java
    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/ArrayRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/ArrayRealVectorTest.java?rev=1346471&r1=1346470&r2=1346471&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/ArrayRealVectorTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math3/linear/ArrayRealVectorTest.java
Tue Jun  5 17:08:20 2012
@@ -506,27 +506,6 @@ public class ArrayRealVectorTest extends
         Assert.assertEquals(0, new ArrayRealVector(new double[0], false).getDimension());
     }
 
-    @Test
-    public void testCosine() {
-        final ArrayRealVector v = new ArrayRealVector(new double[] {1, 0, 0});
-
-        double[] wData = new double[] {1, 1, 0};
-        RealVector w = new ArrayRealVector(wData);
-        Assert.assertEquals(FastMath.sqrt(2) / 2, v.cosine(w), normTolerance);
-
-        wData = new double[] {1, 0, 0};
-        w = new ArrayRealVector(wData);
-        Assert.assertEquals(1, v.cosine(w), normTolerance);
-
-        wData = new double[] {0, 1, 0};
-        w = new ArrayRealVector(wData);
-        Assert.assertEquals(0, v.cosine(w), 0);
-
-        wData = new double[] {-1, 0, 0};
-        w = new ArrayRealVector(wData);
-        Assert.assertEquals(-1, v.cosine(w), normTolerance);
-    }
-
     @Test(expected=MathArithmeticException.class)
     public void testCosinePrecondition1() {
         final ArrayRealVector v = new ArrayRealVector(new double[] {0, 0, 0});

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=1346471&r1=1346470&r2=1346471&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
Tue Jun  5 17:08:20 2012
@@ -789,6 +789,27 @@ public abstract class RealVectorAbstract
         Assert.assertTrue(Double.isNaN(v4.getMaxValue()));
     }
 
+    @Test
+    public void testCosine() {
+        final RealVector v = create(new double[] {1, 0, 0});
+
+        double[] wData = new double[] {1, 1, 0};
+        RealVector w = create(wData);
+        Assert.assertEquals(FastMath.sqrt(2) / 2, v.cosine(w), normTolerance);
+
+        wData = new double[] {1, 0, 0};
+        w = create(wData);
+        Assert.assertEquals(1, v.cosine(w), normTolerance);
+
+        wData = new double[] {0, 1, 0};
+        w = create(wData);
+        Assert.assertEquals(0, v.cosine(w), 0);
+
+        wData = new double[] {-1, 0, 0};
+        w = create(wData);
+        Assert.assertEquals(-1, v.cosine(w), normTolerance);
+    }
+
     /*
      * TESTS OF THE VISITOR PATTERN
      */

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=1346471&r1=1346470&r2=1346471&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
Tue Jun  5 17:08:20 2012
@@ -108,16 +108,6 @@ public class RealVectorTest extends Real
         }
 
         @Override
-        public double dotProduct(RealVector v) {
-            throw unsupported();
-        }
-
-        @Override
-        public double getNorm() {
-            throw unsupported();
-        }
-
-        @Override
         public double getL1Norm() {
             throw unsupported();
         }



Mime
View raw message