MATH-795: factored out testCosinePrecondition1(), testCosinePrecondition2() and
testCosinePrecondition3(). git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1346475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0f9932a5c5
commit
09d7f9a7b8
|
@ -506,25 +506,6 @@ public class ArrayRealVectorTest extends RealVectorAbstractTest {
|
|||
Assert.assertEquals(0, new ArrayRealVector(new double[0], false).getDimension());
|
||||
}
|
||||
|
||||
@Test(expected=MathArithmeticException.class)
|
||||
public void testCosinePrecondition1() {
|
||||
final ArrayRealVector v = new ArrayRealVector(new double[] {0, 0, 0});
|
||||
final ArrayRealVector w = new ArrayRealVector(new double[] {1, 0, 0});
|
||||
v.cosine(w);
|
||||
}
|
||||
@Test(expected=MathArithmeticException.class)
|
||||
public void testCosinePrecondition2() {
|
||||
final ArrayRealVector v = new ArrayRealVector(new double[] {0, 0, 0});
|
||||
final ArrayRealVector w = new ArrayRealVector(new double[] {1, 0, 0});
|
||||
w.cosine(v);
|
||||
}
|
||||
@Test(expected=DimensionMismatchException.class)
|
||||
public void testCosinePrecondition3() {
|
||||
final ArrayRealVector v = new ArrayRealVector(new double[] {1, 2, 3});
|
||||
final ArrayRealVector w = new ArrayRealVector(new double[] {1, 2, 3, 4});
|
||||
v.cosine(w);
|
||||
}
|
||||
|
||||
@Test(expected=DimensionMismatchException.class)
|
||||
public void testCombinePreconditionSameType() {
|
||||
final double a = 1d;
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.apache.commons.math3.analysis.function.Sqrt;
|
|||
import org.apache.commons.math3.analysis.function.Tan;
|
||||
import org.apache.commons.math3.analysis.function.Tanh;
|
||||
import org.apache.commons.math3.analysis.function.Ulp;
|
||||
import org.apache.commons.math3.exception.DimensionMismatchException;
|
||||
import org.apache.commons.math3.exception.MathArithmeticException;
|
||||
import org.apache.commons.math3.exception.MathIllegalArgumentException;
|
||||
import org.apache.commons.math3.exception.NumberIsTooSmallException;
|
||||
|
@ -810,6 +811,27 @@ public abstract class RealVectorAbstractTest {
|
|||
Assert.assertEquals(-1, v.cosine(w), normTolerance);
|
||||
}
|
||||
|
||||
@Test(expected=MathArithmeticException.class)
|
||||
public void testCosinePrecondition1() {
|
||||
final RealVector v = create(new double[] {0, 0, 0});
|
||||
final RealVector w = create(new double[] {1, 0, 0});
|
||||
v.cosine(w);
|
||||
}
|
||||
|
||||
@Test(expected=MathArithmeticException.class)
|
||||
public void testCosinePrecondition2() {
|
||||
final RealVector v = create(new double[] {0, 0, 0});
|
||||
final RealVector w = create(new double[] {1, 0, 0});
|
||||
w.cosine(v);
|
||||
}
|
||||
|
||||
@Test(expected=DimensionMismatchException.class)
|
||||
public void testCosinePrecondition3() {
|
||||
final RealVector v = create(new double[] {1, 2, 3});
|
||||
final RealVector w = create(new double[] {1, 2, 3, 4});
|
||||
v.cosine(w);
|
||||
}
|
||||
|
||||
/*
|
||||
* TESTS OF THE VISITOR PATTERN
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue