コード例 #1
0
 /** Test of converges method, of class EqualsLastValue, for the value null. */
 @Test(expected = NullPointerException.class)
 public void testConverges_Null() {
   System.out.println("converges(null)");
   Double[] series = null;
   EqualsLastValue<Double> instance = this._double;
   instance.converges(series);
   fail("No exception thrown.");
 }
コード例 #2
0
 /** Test of setNumberOfEqualities method, of class EqualsLastValue, for the value 0. */
 @Test(expected = IllegalArgumentException.class)
 public void testSetNumberOfEqualities_Zero() {
   System.out.println("setNumberOfEqualities(0)");
   int numberOfEqualities = 0;
   EqualsLastValue instance = this._double;
   instance.setNumberOfEqualities(numberOfEqualities);
   fail("No exception thrown.");
 }
コード例 #3
0
 /** Test of getNumberOfEqualities method, of class EqualsLastValue. */
 @Test
 public void testGetNumberOfEqualities() {
   System.out.println("getNumberOfEqualities");
   EqualsLastValue instance = this._double;
   int expResult = 1;
   int result = instance.getNumberOfEqualities();
   assertEquals(expResult, result);
 }
コード例 #4
0
 /** Test of setEquals method, of class EqualsLastValue, for the value null. */
 @Test(expected = NullPointerException.class)
 public void testSetEquals_Null() {
   System.out.println("setEquals(null)");
   Equals<Double> equality = null;
   EqualsLastValue instance = this._double;
   instance.setEquals(equality);
   fail("No exception thrown.");
 }
コード例 #5
0
 /** Test of converges method, of class EqualsLastValue, for an empty array. Length is 0 (zero). */
 @Test
 public void testConverges_ArrayOfLengthZero() {
   System.out.println("converges(array[0])");
   Double[] series = new Double[0];
   EqualsLastValue<Double> instance = this._double;
   boolean expResult = false;
   boolean result = instance.converges(series);
   assertEquals(expResult, result);
 }
コード例 #6
0
 /** Test of getEquals method, of class EqualsLastValue. */
 @Test
 public void testGetEquals() {
   System.out.println("getEquals");
   EqualsLastValue instance = this._double;
   double precision = Math.pow(10.0, -10.0);
   Equals<Double> result = instance.getEquals();
   if (result instanceof DoubleAbsolute) {
     DoubleAbsolute da = (DoubleAbsolute) result;
     double resultPrecision = da.getPrecision();
     assertEquals("Wrong value of precision from equality.", precision, resultPrecision, 0.0);
   } else fail("Wrong kind of equality returned.");
 }
コード例 #7
0
 /** Test of setEquals method, of class EqualsLastValue. */
 @Test
 public void testSetEquals() {
   System.out.println("setEquals");
   double precision = Math.pow(10.0, -8.0);
   Equals<Double> equality = new DoubleRelative(precision);
   EqualsLastValue instance = this._double;
   instance.setEquals(equality);
   Equals<Double> result = instance.getEquals();
   if (result instanceof DoubleRelative) {
     DoubleRelative dr = (DoubleRelative) result;
     double resultPrecision = dr.getPrecision();
     assertEquals("Wrong value of precision from equality.", precision, resultPrecision, 0.0);
   } else fail("Wrong kind of equality returned.");
 }
コード例 #8
0
  /** Test of converges method, of class EqualsLastValue. */
  @Test
  public void testConverges() {
    System.out.println("converges");
    Double[] series = this._converges;
    EqualsLastValue<Double> instance = this._double;
    boolean expResult = true;
    boolean result = instance.converges(series);
    assertEquals("Convergent series does not converge.", expResult, result);

    series = this._same;
    result = instance.converges(series);
    assertEquals("Series of same values does not converge.", expResult, result);

    series = this._unimportantNull;
    result = instance.converges(series);
    assertEquals("Series of with unimportant null values does not converge.", expResult, result);

    series = this._diverges;
    expResult = false;
    result = instance.converges(series);
    assertEquals("Divergent series converges.", expResult, result);

    series = this._importantNull;
    result = instance.converges(series);
    assertEquals("Series of with important null value converges.", expResult, result);
  }