public void testAverageAndStdDev() { IRunningAverageAndStdDev avg = new FullRunningAverageAndStdDev(); IRunningAverageAndStdDev inverted = new InvertedRunningAverageAndStdDev(avg); Assert.AreEqual(0, inverted.GetCount()); avg.AddDatum(1.0); Assert.AreEqual(1, inverted.GetCount()); Assert.AreEqual(-1.0, inverted.GetAverage(), EPSILON); avg.AddDatum(2.0); Assert.AreEqual(2, inverted.GetCount()); Assert.AreEqual(-1.5, inverted.GetAverage(), EPSILON); Assert.AreEqual(Math.Sqrt(2.0)/2.0, inverted.GetStandardDeviation(), EPSILON); }
public void testAverageAndStdDev() { IRunningAverageAndStdDev avg = new FullRunningAverageAndStdDev(); IRunningAverageAndStdDev inverted = new InvertedRunningAverageAndStdDev(avg); Assert.AreEqual(0, inverted.GetCount()); avg.AddDatum(1.0); Assert.AreEqual(1, inverted.GetCount()); Assert.AreEqual(-1.0, inverted.GetAverage(), EPSILON); avg.AddDatum(2.0); Assert.AreEqual(2, inverted.GetCount()); Assert.AreEqual(-1.5, inverted.GetAverage(), EPSILON); Assert.AreEqual(Math.Sqrt(2.0) / 2.0, inverted.GetStandardDeviation(), EPSILON); }
public void testAndStdDevUnsupported3() { IRunningAverage inverted = new InvertedRunningAverageAndStdDev(new FullRunningAverageAndStdDev()); inverted.RemoveDatum(1.0); }
public void testAndStdDevUnsupported2() { IRunningAverage inverted = new InvertedRunningAverageAndStdDev(new FullRunningAverageAndStdDev()); inverted.ChangeDatum(1.0); }