@Test
public void testDecayedQuantiles()
throws Exception
{
TestingTicker ticker = new TestingTicker();
QuantileDigest digest = new QuantileDigest(1, ExponentialDecay.computeAlpha(0.5, 60), ticker, true);
addAll(digest, asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9));
// should have no compressions with so few values and the allowed error
assertEquals(digest.getCompressions(), 0);
assertEquals(digest.getConfidenceFactor(), 0.0);
ticker.increment(60, TimeUnit.SECONDS);
addAll(digest, asList(10, 11, 12, 13, 14, 15, 16, 17, 18, 19));
// Considering that the first 10 values now have a weight of 0.5 per the alpha factor, they only contributed a count
// of 5 to rank computations. Therefore, the 50th percentile is equivalent to a weighted rank of (5 + 10) / 2 = 7.5,
// which corresponds to value 12