private void TestContinuousDistributionShape(
            IContinuousGenerator distribution,
            double min,
            double max,
            double[] expectedShape,
            double expectedUnderflow,
            double expectedOverflow,
            int avgSamplesPerBucket,
            double absoluteAccuracy,
            string message)
        {
            DistributionShape shape = DistributionShape.CreateMinMax(expectedShape.Length, min, max);
            int sampleCount         = expectedShape.Length * avgSamplesPerBucket;

            for (int i = 0; i < sampleCount; i++)
            {
                shape.Push(distribution.NextDouble());
            }

            double scale = 1.0 / (avgSamplesPerBucket * expectedShape.Length);

            Assert.That(shape.Underflow * scale, Is.EqualTo(expectedUnderflow).Within(absoluteAccuracy), message + " Underflow");
            Assert.That(shape.Overflow * scale, Is.EqualTo(expectedOverflow).Within(absoluteAccuracy), message + " Overflow");
            for (int i = 0; i < expectedShape.Length; i++)
            {
                Assert.That(shape[i] * scale, Is.EqualTo(expectedShape[i]).Within(absoluteAccuracy), message + " Bucket " + i);
            }
        }
        public void TestDistributionShapeTestHelper()
        {
            DistributionShape shape = DistributionShape.CreateMinMax(2, -1.0, +1.0);

            shape.Push(-1.5); // underflow
            shape.Push(-1.0); // 0
            shape.Push(-0.5); // 0
            shape.Push(0.0);  // 1
            shape.Push(0.5);  // 1
            shape.Push(1.0);  // overflow
            shape.Push(1.5);  // overflow

            Assert.That(shape.Underflow, Is.EqualTo(1), "underflow");
            Assert.That(shape.Overflow, Is.EqualTo(2), "overflow");
            Assert.That(shape[0], Is.EqualTo(2), "0");
            Assert.That(shape[1], Is.EqualTo(2), "1");
        }