示例#1
0
 @Test
 public void testRealOnlyCubic() {
   Double[] result = REAL_ONLY_CUBIC.getRoots(ONE_REAL_ROOT);
   assertEquals(result.length, 1);
   assertEquals(result[0], 1, 0);
   result = REAL_ONLY_CUBIC.getRoots(ONE_DISTINCT_ROOT);
   assertEquals(result.length, 3);
   for (final Double d : result) {
     assertEquals(d, 1, EPS);
   }
   result = REAL_ONLY_CUBIC.getRoots(THREE_ROOTS);
   assertEquals(result.length, 3);
   assertEquals(result[0], 1, EPS);
   assertEquals(result[1], 3, EPS);
   assertEquals(result[2], 2, EPS);
 }
示例#2
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNonCubic2() {
   REAL_ONLY_CUBIC.getRoots(new RealPolynomialFunction1D(new double[] {1, 1, 1, 1, 1}));
 }
示例#3
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void testNullFunction2() {
   REAL_ONLY_CUBIC.getRoots(null);
 }