Exemple #1
0
        public void TestAggregateFunction()
        {
            AggregationMethod agg = new AggregatorStddev();

            Assert.IsNull(agg.Value);

            agg.Enter(10);
            Assert.IsNull(agg.Value);

            agg.Enter(8);
            double result = agg.Value.AsDouble();

            Assert.AreEqual("1.4142", result.ToString().Substring(0, 6));

            agg.Enter(5);
            result = agg.Value.AsDouble();
            Assert.AreEqual("2.5166", result.ToString().Substring(0, 6));

            agg.Enter(9);
            result = agg.Value.AsDouble();
            Assert.AreEqual("2.1602", result.ToString().Substring(0, 6));

            agg.Leave(10);
            result = agg.Value.AsDouble();
            Assert.AreEqual("2.0816", result.ToString().Substring(0, 6));
        }
Exemple #2
0
        public void TestAllOne()
        {
            AggregationMethod agg = new AggregatorStddev();

            agg.Enter(1);
            agg.Enter(1);
            agg.Enter(1);
            agg.Enter(1);
            agg.Enter(1);
            Assert.AreEqual(0.0d, agg.Value);
        }