示例#1
0
        public void TestEcartTypeBorneInvalide()
        {
            double sommeDistance  = double.NaN;
            int    nbrPairDonnees = 2;

            double ecartType = VarianceCalculator.GetEcartType(sommeDistance, nbrPairDonnees);

            Assert.Equal(double.NaN, ecartType);
        }
示例#2
0
        public void TestCalculateVarianceOfProbabilityDistribution(double[] probabilityDistribution, double?expectedVariance)
        {
            var varianceCalculator = new VarianceCalculator();
            var actualVariance     = varianceCalculator.CalculateVarianceOfProbabilityDistribution(probabilityDistribution);

            if (expectedVariance != null || actualVariance != null)
            {
                Assert.LessOrEqual(Math.Abs(actualVariance.Value - expectedVariance.Value), Epsilon);
            }
        }
示例#3
0
        public void TestEcartTypeBorneSuperieure()
        {
            const double ecartTypeTest = 4.47;

            double sommeDistance  = 20;
            int    nbrPairDonnees = 1;

            double ecartType = VarianceCalculator.GetEcartType(sommeDistance, nbrPairDonnees);

            Assert.Equal(Math.Round(ecartType, 2), ecartTypeTest);
        }
示例#4
0
        public void TestEcartTypeBorneInferieure()
        {
            const double ecartTypeTest = 10;

            double sommeDistance  = 200;
            int    nbrPairDonnees = 2;

            double ecartType = VarianceCalculator.GetEcartType(sommeDistance, nbrPairDonnees);

            Assert.Equal(ecartType, ecartTypeTest);
        }
示例#5
0
        public void TestVarianceCalculatorBorneSuperieure()
        {
            const double varianceTest = 8.16;

            List <double> listNumber = new List <double>();

            listNumber.Add(10);
            listNumber.Add(20);
            listNumber.Add(30);

            double variance = VarianceCalculator.calculVariance(listNumber);

            Assert.Equal(variance, varianceTest);
        }
示例#6
0
        public void TestVarianceCalculatorBorneInferieure()
        {
            const double varianceTest = 173.47;

            List <double> listNumber = new List <double>();

            listNumber.Add(450.332342);
            listNumber.Add(25.4554);
            listNumber.Add(232.7777);

            double variance = VarianceCalculator.calculVariance(listNumber);

            Assert.Equal(variance, varianceTest);
        }
示例#7
0
        public void TestDistanceBorneInvalide()
        {
            List <double> listNumber = new List <double>();

            listNumber.Add(10);
            listNumber.Add(double.NaN);
            listNumber.Add(0);

            double moyenne = 50;

            double distance = VarianceCalculator.GetSommeDistance(listNumber, moyenne);

            Assert.Equal(double.NaN, distance);
        }
示例#8
0
        public void TestDistanceBorneSuperieure()
        {
            const double distanceTest = 190.07;

            List <double> listNumber = new List <double>();

            listNumber.Add(10.98);
            listNumber.Add(20.221);
            listNumber.Add(30.44);

            double moyenne = 20.98;

            double distance = VarianceCalculator.GetSommeDistance(listNumber, moyenne);

            Assert.Equal(distance, distanceTest);
        }
示例#9
0
        public void TestDistanceBorneInferieure()
        {
            const double distanceTest = 200;

            List <double> listNumber = new List <double>();

            listNumber.Add(10);
            listNumber.Add(20);
            listNumber.Add(30);

            double moyenne = 20;

            double distance = VarianceCalculator.GetSommeDistance(listNumber, moyenne);

            Assert.Equal(distance, distanceTest);
        }
示例#10
0
        public void TestVarianceCalculatorBorneInvalide()
        {
            double variance = VarianceCalculator.calculVariance(null);

            Assert.Equal(double.NaN, variance);
        }
示例#11
0
 public DiceWeighter()
 {
     this._random = new Random();
     this._distributionGenerator = new CumulativeSumOfIndependentTrialsDistributionGenerator();
     this._varianceCalculator    = new VarianceCalculator();
 }