public void testWeighted()
        {
            WeightedRunningAverage runningAverage = new WeightedRunningAverage();

            Assert.AreEqual(0, runningAverage.GetCount());
            Assert.True(Double.IsNaN(runningAverage.GetAverage()));
            runningAverage.AddDatum(1.0, 2.0);
            Assert.AreEqual(1.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(1.0);
            Assert.AreEqual(1.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(8.0, 0.5);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(-4.0);
            Assert.AreEqual(2.0/3.0, runningAverage.GetAverage(), EPSILON);

            runningAverage.RemoveDatum(-4.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.RemoveDatum(2.0, 2.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);

            runningAverage.ChangeDatum(0.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.ChangeDatum(4.0, 0.5);
            Assert.AreEqual(5.0/1.5, runningAverage.GetAverage(), EPSILON);
        }
        public void testWeighted()
        {
            WeightedRunningAverage runningAverage = new WeightedRunningAverage();

            Assert.AreEqual(0, runningAverage.GetCount());
            Assert.True(Double.IsNaN(runningAverage.GetAverage()));
            runningAverage.AddDatum(1.0, 2.0);
            Assert.AreEqual(1.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(1.0);
            Assert.AreEqual(1.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(8.0, 0.5);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.AddDatum(-4.0);
            Assert.AreEqual(2.0 / 3.0, runningAverage.GetAverage(), EPSILON);

            runningAverage.RemoveDatum(-4.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.RemoveDatum(2.0, 2.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);

            runningAverage.ChangeDatum(0.0);
            Assert.AreEqual(2.0, runningAverage.GetAverage(), EPSILON);
            runningAverage.ChangeDatum(4.0, 0.5);
            Assert.AreEqual(5.0 / 1.5, runningAverage.GetAverage(), EPSILON);
        }