public void DynamicHistogramVectorCtor() { const int binCount = 8; var bins = new long[binCount]; var histogram = new DynamicHistogram(bins); Assert.AreEqual(0, histogram.SampleCount); Assert.AreEqual(binCount, histogram.BinCount); histogram.AddSample(1968); histogram.AddSample(2012); CollectionAssert.AreEqual(bins, histogram); }
public void DynamicHistogramAddSample() { const int binCount = 8; var histogram = new DynamicHistogram(binCount); const long lowSample = 1968; histogram.AddSample(lowSample); const long highSample = 2012; histogram.AddSample(highSample); // Histogram lower bound is closed, therefore less OR equal Assert.LessOrEqual(histogram.LowerBound, lowSample); // Histogram upper bound is open, therefore strictly greater Assert.Greater(histogram.UpperBound, highSample); Assert.AreEqual(2, histogram.SampleCount); Assert.AreEqual(histogram.LowerBound + histogram.Width * histogram.BinCount, histogram.UpperBound); }