Пример #1
0
  @Test
  public void sumOfSmallSequence() {
    Statistician s = new Statistician();
    s.nextNumber(1.1);

    assertEquals(1.1, s.getSum(), 0.0001);
  }
Пример #2
0
  @Test
  public void lengthOfSequence() {
    Statistician s = new Statistician();
    s.nextNumber(1.1);

    assertEquals(1, s.getLengthOfSequence());
  }
Пример #3
0
 @Test
 public void meanOfLargerSequence() {
   Statistician s = new Statistician();
   s.nextNumber(2.0);
   s.nextNumber(2.0);
   s.nextNumber(2.0);
   assertEquals(2.0, s.getMean(), 0.0001);
 }
Пример #4
0
  @Test
  public void sumOfLargerSequence() {
    Statistician s = new Statistician();
    s.nextNumber(1.1);
    s.nextNumber(5.1);
    s.nextNumber(5.0);

    assertEquals(11.2, s.getSum(), 0.0001);
  }
Пример #5
0
  @Test
  public void lastNumberOfLargerSequence() {
    Statistician s = new Statistician();
    s.nextNumber(1.1);
    s.nextNumber(5.1);
    s.nextNumber(5.0);

    assertEquals(5.0, s.getLastNumberOfSequence(), 0.0001);
  }
Пример #6
0
  @Test
  public void lengthOfSequenceMoreThanOne() {
    Statistician s = new Statistician();
    s.nextNumber(1.1);
    s.nextNumber(5.1);
    s.nextNumber(5.0);

    assertEquals(3, s.getLengthOfSequence());
  }
Пример #7
0
 @Test
 public void maxOfLargerSequence() {
   Statistician s = new Statistician();
   s.nextNumber(1.1);
   s.nextNumber(1.0);
   s.nextNumber(12.0);
   s.nextNumber(211.0);
   assertEquals(211.0, s.getMax(), 0.0001);
 }
Пример #8
0
 @Test
 public void lastNumberOfAnEmptySequence() {
   Statistician s = new Statistician();
   assertEquals(Double.NaN, s.getLastNumberOfSequence(), 0.0001);
 }
Пример #9
0
 @Test
 public void meanOfAnEmptySequence() {
   Statistician s = new Statistician();
   assertEquals(Double.NaN, s.getMean(), 0.0001);
 }