Example #1
0
        public void StdevpaIsGivenTwoRangesOfIntsAsInputs()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value = 1;
                worksheet.Cells["B2"].Value = 2;
                worksheet.Cells["B3"].Value = 34;
                worksheet.Cells["B4"].Value = 56;
                worksheet.Cells["B5"].Value = 32;
                worksheet.Cells["B6"].Value = 76;

                worksheet.Cells["B7"].Value  = 2;
                worksheet.Cells["B8"].Value  = 3;
                worksheet.Cells["B9"].Value  = 5;
                worksheet.Cells["B10"].Value = 7;
                worksheet.Cells["B11"].Value = 45;


                worksheet.Cells["A9"].Formula = "=Stdevpa(B1:B6, B7:B11)";
                worksheet.Calculate();
                Assert.AreEqual(25.08333219, (double)worksheet.Cells["A9"].Value, .00001);
            }
        }
Example #2
0
        public void StdevpaIsGivenMaxAmountOfInputs254()
        {
            var function = new Stdevpa();
            var input1   = 1;

            var result1 = function.Execute(FunctionsHelper.CreateArgs(
                                               100, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1,
                                               input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1, input1
                                               ), this.ParsingContext);


            Assert.AreEqual(6.199572434, result1.ResultNumeric, .00001);
        }
Example #3
0
        public void StdevpaIsGivenNumberInputFromCellRefrence()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value    = 66;
                worksheet.Cells["B2"].Value    = 52;
                worksheet.Cells["B3"].Value    = 77;
                worksheet.Cells["B4"].Value    = 71;
                worksheet.Cells["B5"].Value    = 30;
                worksheet.Cells["B6"].Value    = 90;
                worksheet.Cells["B7"].Value    = 26;
                worksheet.Cells["B8"].Value    = 56;
                worksheet.Cells["B9"].Value    = 7;
                worksheet.Cells["A10"].Formula = "=Stdevpa(B:B)";
                worksheet.Cells["A11"].Formula = "=Stdevpa(B1,B3,B5,B6,B9)";
                worksheet.Cells["A12"].Formula = "=Stdevpa(B1,B3,B5,B6)";
                worksheet.Calculate();

                Assert.AreEqual(25.43303966, (double)worksheet.Cells["A10"].Value, .00001);
                Assert.AreEqual(30.835045, (double)worksheet.Cells["A11"].Value, .00001);
                Assert.AreEqual(22.32011425, (double)worksheet.Cells["A12"].Value, .00001);
            }
        }
Example #4
0
        public void StdevpaIsGivenMonthDayYear12HourTimeAsInputs()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("Jan 17, 2011 2:00 am", "June 5, 2017 11:00 pm", "June 15, 2017 11:00 pm"), this.ParsingContext);

            Assert.AreEqual(1101.621004, result1.ResultNumeric, .00001);
        }
Example #5
0
        public void StdevpaIsGiven12HourTimesAsInputs()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("12:00 am", "02:00 am", "01:00 pm"), this.ParsingContext);

            Assert.AreEqual(0.238144836, result1.ResultNumeric, .00001);
        }
Example #6
0
        public void StdevpaIsGivenDateTimeInputsSeperatedByADashAsInputs()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("1-17-2017 2:00", "6-17-2017 2:00", "9-17-2017 2:00"), this.ParsingContext);

            Assert.AreEqual(100.1742926, result1.ResultNumeric, .00001);
        }
Example #7
0
        public void StdevpaIsGivenASingleFalseBooleanInput()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(false), this.ParsingContext);

            Assert.AreEqual(0, result1.ResultNumeric, .00001);;
        }
Example #8
0
        public void StdevpaIsGivenASingleStringInput()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("string"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type);
        }
Example #9
0
        public void StdevpaIsGivenNumbersAsInputstakeTwo()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(-1, -1, -1), this.ParsingContext);

            Assert.AreEqual(0d, result1.ResultNumeric, .00001);
        }
Example #10
0
        public void StdevpaIsGivenTwoRangesOfIntsAsInputsWithATimeInTheMiddleOfTheFirstRangeTestTwo()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value = 1;
                worksheet.Cells["B2"].Value = 2;
                worksheet.Cells["B3"].Value = 34;
                worksheet.Cells["B4"].Value = "12:00";
                worksheet.Cells["B5"].Value = "6/17/2011 2:00";
                worksheet.Cells["B6"].Value = 76;

                worksheet.Cells["B7"].Value  = 2;
                worksheet.Cells["B8"].Value  = 3;
                worksheet.Cells["B9"].Value  = 5;
                worksheet.Cells["B10"].Value = 7;
                worksheet.Cells["B11"].Value = 45;


                worksheet.Cells["A9"].Formula = "=Stdevpa(B1:B6, B7:B11)";
                worksheet.Calculate();
                Assert.AreEqual(23.86497832, (double)worksheet.Cells["A9"].Value, .00001);
            }
        }
Example #11
0
        public void StdevpaIsGivenAMixedStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(10, 2, "6/17/2011 2:00", "02:00 am"), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs(10, 2, "6/17/2011 2:00", null, "02:00 am"), this.ParsingContext);

            Assert.AreEqual(17626.6725, result1.ResultNumeric, .00001);
            Assert.AreEqual(16283.22541, result2.ResultNumeric, .00001);
        }
Example #12
0
        public void StdevpaIsGivenAStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(66, 52, 77, 71, 30, 90, 26, 56, 7), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs(66, 52, 77, 71, null, 30, 90, 26, 56, 7), this.ParsingContext);

            Assert.AreEqual(25.43303966, result1.ResultNumeric, .00001);
            Assert.AreEqual(28.85914067, result2.ResultNumeric, .00001);
        }
Example #13
0
        public void StdevpaIsGivenStringNumbersAsInputs()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("5", "6", "7"), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs("5.5", "6.6", "7.7"), this.ParsingContext);

            Assert.AreEqual(0.816496581, result1.ResultNumeric, .00001);
            Assert.AreEqual(0.898146239, result2.ResultNumeric, .00001);
        }
Example #14
0
        public void StdevpaIsGivenAMixOfInputTypes()
        {
            var function = new Stdevpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(1, true, null, "6/17/2011 2:00", "02:00 am"), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs(1, true, "6/17/2011 2:00", "02:00 am"), this.ParsingContext);

            Assert.AreEqual(16284.22501, result1.ResultNumeric, .00001);
            Assert.AreEqual(17628.11549, result2.ResultNumeric, .00001);
        }
Example #15
0
        public void StdevpaIsGivenBooleanInputs()
        {
            var function       = new Stdevpa();
            var boolInputTrue  = true;
            var boolInputFalse = false;
            var result1        = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputTrue, boolInputFalse), this.ParsingContext);
            var result2        = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputTrue, boolInputTrue), this.ParsingContext);
            var result3        = function.Execute(FunctionsHelper.CreateArgs(boolInputTrue, boolInputFalse, boolInputFalse), this.ParsingContext);

            Assert.AreEqual(0.471404521, result1.ResultNumeric, .00001);
            Assert.AreEqual(0d, result2.ResultNumeric, .00001);
            Assert.AreEqual(0.471404521, result3.ResultNumeric, .00001);
        }
Example #16
0
        public void StdevpaIsGivenStringsAsInputsByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "string";
                worksheet.Cells["B2"].Value   = "another string";
                worksheet.Cells["B3"].Value   = "a third string";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #17
0
        public void StdevpaIsGivenDateTimeInputsSeperatedByADashAsInputsByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "1-17-2017 2:00";
                worksheet.Cells["B2"].Value   = "6-17-2017 2:00";
                worksheet.Cells["B3"].Value   = "9-17-2017 2:00";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #18
0
        public void StdevpaIsGivenMonthDayYear12HourTimeAsInputsByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "Jan 17, 2011 2:00 am";
                worksheet.Cells["B2"].Value   = "June 5, 2017 11:00 pm";
                worksheet.Cells["B3"].Value   = "June 15, 2017 11:00 pm";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #19
0
        public void StdevpaIsGiven12HourTimesAsInputsByCellRefrence()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "12:00 am";
                worksheet.Cells["B2"].Value   = "02:00 am";
                worksheet.Cells["B3"].Value   = "01:00 pm";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1,B2,B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #20
0
        public void StdevpaIsGivenMilitaryTimesAsInputsByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "00:00";
                worksheet.Cells["B2"].Value   = "02:00";
                worksheet.Cells["B3"].Value   = "13:00";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #21
0
        public void StdevpaIsGivenADateSeperatedByABackslash()
        {
            var function = new Stdevpa();
            var input1   = "1/17/2011 2:00";
            var input2   = "6/17/2011 2:00";
            var input3   = "1/17/2012 2:00";
            var input4   = "1/17/2013 2:00";
            var result1  = function.Execute(FunctionsHelper.CreateArgs(input1, input1, input1), this.ParsingContext);
            var result2  = function.Execute(FunctionsHelper.CreateArgs(input1, input2, input1), this.ParsingContext);
            var result3  = function.Execute(FunctionsHelper.CreateArgs(input1, input3, input4), this.ParsingContext);

            Assert.AreEqual(0d, result1.ResultNumeric, .00001);
            Assert.AreEqual(71.18208264, result2.ResultNumeric, .00001);
            Assert.AreEqual(298.4295934, result3.ResultNumeric, .00001);
        }
Example #22
0
        public void StdevpaTestingDirectInputVsRangeInputWithAGapInTheMiddle()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = 1;
                worksheet.Cells["B3"].Value   = 1;
                worksheet.Cells["B8"].Formula = "=Stdevpa(B1,B3)";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, worksheet.Cells["B8"].Value);
                Assert.AreEqual(0d, worksheet.Cells["B9"].Value);
            }
        }
Example #23
0
        public void StdevpaTestingDirectINputVsRangeInputTest2()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = 1;
                worksheet.Cells["B2"].Value   = 0;
                worksheet.Cells["B8"].Formula = "=Stdevpa(B1,B2)";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B2)";
                worksheet.Calculate();
                Assert.AreEqual(0.5, (double)worksheet.Cells["B8"].Value, .00001);
                Assert.AreEqual(0.5, (double)worksheet.Cells["B9"].Value, .00001);
            }
        }
Example #24
0
        public void StdevpaIsGivenAMixOfTwoTypesAndTwoRangesThatShouldHaveAnOutputTestTwo()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = 10;
                worksheet.Cells["B2"].Value   = 2;
                worksheet.Cells["B3"].Value   = "6/17/2011 2:00";
                worksheet.Cells["B4"].Value   = "02:00 am";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B4)";
                worksheet.Calculate();
                Assert.AreEqual(4.123105626, (double)worksheet.Cells["B9"].Value, .0001);
            }
        }
Example #25
0
        public void StdevpaIsGivenAMixOfInputTypesByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = 15;
                worksheet.Cells["B2"].Value   = 1;
                worksheet.Cells["B3"].Value   = "6/17/2011 2:00";
                worksheet.Cells["B4"].Value   = "02:00 am";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B4)";

                worksheet.Calculate();

                Assert.AreEqual(6.363961031, (double)worksheet.Cells["B9"].Value, .00001);
            }
        }
Example #26
0
        public void StdevpaIsGivenBooleanInputsFromCellRefrence()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = true;
                worksheet.Cells["B2"].Value   = false;
                worksheet.Cells["B3"].Formula = "=Stdevpa(B1,B1,B2)";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1,B1,B1)";
                worksheet.Cells["B5"].Formula = "=Stdevpa(B1,B2,B2)";
                worksheet.Calculate();
                Assert.AreEqual(0.471404521, (double)worksheet.Cells["B3"].Value, .00001);
                Assert.AreEqual(0d, (double)worksheet.Cells["B4"].Value, .00001);
                Assert.AreEqual(0.471404521, (double)worksheet.Cells["B5"].Value, .00001);
            }
        }
Example #27
0
        public void StdevpaIsGivenAMixOfInputTypesWithANullInTheCenterByCellRefrenceAndTwoRangeInputs()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value = 15;
                worksheet.Cells["B2"].Value = 1;
                //empty B3 cell
                worksheet.Cells["B4"].Value   = "6/17/2011 2:00";
                worksheet.Cells["B5"].Value   = "02:00 am";
                worksheet.Cells["B8"].Formula = "=Stdevpa(B1,B2)";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B5,B1:B5)";
                worksheet.Calculate();
                Assert.AreEqual(7, (double)worksheet.Cells["B8"].Value, .00001);
                Assert.AreEqual(6.363961031, (double)worksheet.Cells["B9"].Value, .00001);
            }
        }
Example #28
0
        public void StdevpaIsGivenADateSeperatedByABackslashInputFromCellRefrence()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value   = "1/17/2011 2:00";
                worksheet.Cells["B2"].Value   = "6/17/2011 2:00";
                worksheet.Cells["B3"].Value   = "1/17/2012 2:00";
                worksheet.Cells["B4"].Value   = "1/17/2013 2:00";
                worksheet.Cells["B5"].Formula = "=Stdevpa(B1,B1,B1)";
                worksheet.Cells["B6"].Formula = "=Stdevpa(B1,B2,B1)";
                worksheet.Cells["B7"].Formula = "=Stdevpa(B1,B3,B4)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (double)worksheet.Cells["B5"].Value, .00001);
                Assert.AreEqual(0d, (double)worksheet.Cells["B6"].Value, .00001);
                Assert.AreEqual(0d, (double)worksheet.Cells["B7"].Value, .00001);
            }
        }
Example #29
0
        public void StdevpaIsGivenStringNumbersAsInputsByCellRange()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["A1"].Value   = "5";
                worksheet.Cells["A2"].Value   = "6";
                worksheet.Cells["A3"].Value   = "7";
                worksheet.Cells["B1"].Value   = "5.5";
                worksheet.Cells["B2"].Value   = "6.6";
                worksheet.Cells["B3"].Value   = "7.7";
                worksheet.Cells["A4"].Formula = "=Stdevpa(A1:A3)";
                worksheet.Cells["B4"].Formula = "=Stdevpa(B1:B3)";
                worksheet.Calculate();
                Assert.AreEqual(0d, (worksheet.Cells["A4"].Value));
                Assert.AreEqual(0d, (worksheet.Cells["B4"].Value));
            }
        }
Example #30
0
        public void StdevpaIsTheSameTestsAsGivenAMixOfInputTypesByCellRefrenceExceptTheyAreAllOnes()
        {
            var function = new Stdevpa();

            using (var package = new ExcelPackage())
            {
                var worksheet = package.Workbook.Worksheets.Add("Sheet1");
                worksheet.Cells["B1"].Value = 1;
                worksheet.Cells["B2"].Value = 1;
                //empty B3 cell
                worksheet.Cells["B4"].Value   = 1;
                worksheet.Cells["B5"].Value   = 1;
                worksheet.Cells["B6"].Formula = "=Stdevpa(B1,B2,B4,B5)";
                worksheet.Cells["B8"].Formula = "=Stdevpa(B1,B2)";
                worksheet.Cells["B9"].Formula = "=Stdevpa(B1:B5)";
                worksheet.Calculate();
                Assert.AreEqual(0d, worksheet.Cells["B6"].Value);
                Assert.AreEqual(0d, worksheet.Cells["B8"].Value);
                Assert.AreEqual(0d, worksheet.Cells["B9"].Value);
            }
        }