예제 #1
0
        public void ManyOperandsCheck()
        {
            //1 No corrextion
            double expected = 0.0625;
            int    digitsInput = 4, digitsOutput = 1;

            double[] distortionto1Probability       = { 0.0, 0.0, 0.0, 0.0 };
            double[] distortionto0Probability       = { 0.0, 0.0, 0.0, 0.0 };
            double[] distortiontoInverseProbability = { 0.5, 0.5, 0.5, 0.5 };
            ProbabilitiesCalcNoCorrection prCalc    = new ProbabilitiesCalcNoCorrection(distortionto0Probability,
                                                                                        distortionto1Probability, distortiontoInverseProbability, digitsInput, digitsOutput);
            double actual = prCalc.GetCorrectResultProbability();

            Assert.AreEqual(expected, actual, 0.00001, "Fail for many operands");
        }
예제 #2
0
        public void VariousProbabilitiesCheck()
        {
            //1 No corrextion
            double expected = 0.015;
            int    digitsInput = 4, digitsOutput = 1;

            double[] distortionto1Probability       = { 0.25, 0.0, 0.1, 0.0 };
            double[] distortionto0Probability       = { 0.25, 0.0, 0.3, 0.1 };
            double[] distortiontoInverseProbability = { 0.25, 0.5, 0.3, 0.5 };
            ProbabilitiesCalcNoCorrection prCalc    = new ProbabilitiesCalcNoCorrection(distortionto0Probability,
                                                                                        distortionto1Probability, distortiontoInverseProbability, digitsInput, digitsOutput);
            double actual = prCalc.GetCorrectResultProbability();

            Assert.AreEqual(expected, actual, 0.00001, "Fail in class logic");
        }
예제 #3
0
        public void ElementaryLogicCheck()
        {
            //1 No corrextion
            double expected = 0.5;
            int    digitsInput = 1, digitsOutput = 1;

            double[] distortionto1Probability       = { 0.0 };
            double[] distortionto0Probability       = { 0.0 };
            double[] distortiontoInverseProbability = { 0.5 };
            ProbabilitiesCalcNoCorrection prCalc    = new ProbabilitiesCalcNoCorrection(distortionto0Probability,
                                                                                        distortionto1Probability, distortiontoInverseProbability, digitsInput, digitsOutput);
            double actual = prCalc.GetCorrectResultProbability();

            Assert.AreEqual(expected, actual, 0.00001, "Elementary test Fail");
        }