@Test public void test20090720() { DescriptiveStatistics descriptiveStatistics = new DescriptiveStatistics(100); for (int i = 0; i < 161; i++) { descriptiveStatistics.addValue(1.2); } descriptiveStatistics.clear(); descriptiveStatistics.addValue(1.2); Assert.assertEquals(1, descriptiveStatistics.getN()); }
public void checkremoval( DescriptiveStatistics dstat, int wsize, double mean1, double mean2, double mean3) { dstat.setWindowSize(wsize); dstat.clear(); for (int i = 1; i <= 6; ++i) { dstat.addValue(i); } Assert.assertTrue(Precision.equalsIncludingNaN(mean1, dstat.getMean())); dstat.replaceMostRecentValue(0); Assert.assertTrue(Precision.equalsIncludingNaN(mean2, dstat.getMean())); dstat.removeMostRecentValue(); Assert.assertTrue(Precision.equalsIncludingNaN(mean3, dstat.getMean())); }