Esempio n. 1
0
        public void VarpaIsGivenStringNumbersAsInputs()
        {
            var function = new Varpa();
            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.666666667, result1.ResultNumeric, .00001);
            Assert.AreEqual(0.806666667, result2.ResultNumeric, .00001);
        }
Esempio n. 2
0
        public void VarpaIsGivenAMixedStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new Varpa();
            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(310699583.6, result1.ResultNumeric, .1);
            Assert.AreEqual(265143429.9, result2.ResultNumeric, .1);
        }
Esempio n. 3
0
        public void VarpaIsGivenAStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new Varpa();
            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(646.8395062, result1.ResultNumeric, .00001);
            Assert.AreEqual(832.85, result2.ResultNumeric, .00001);
        }
Esempio n. 4
0
        public void VarpaIsGivenAMixOfInputTypes()
        {
            var function = new Varpa();
            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(265175984, result1.ResultNumeric, .1);
            Assert.AreEqual(310750455.8, result2.ResultNumeric, .1);
        }
Esempio n. 5
0
        public void VarpaIsGivenBooleanInputs()
        {
            var function       = new Varpa();
            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.222222222, result1.ResultNumeric, .00001);
            Assert.AreEqual(0, result2.ResultNumeric, .00001);
            Assert.AreEqual(0.222222222, result3.ResultNumeric, .00001);
        }
Esempio n. 6
0
        public void VarpaIsGivenADateSeperatedByABackslash()
        {
            var function = new Varpa();
            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(0, result1.ResultNumeric, .00001);
            Assert.AreEqual(5066.888889, result2.ResultNumeric, .00001);
            Assert.AreEqual(89060.22222, result3.ResultNumeric, .00001);
        }
Esempio n. 7
0
        public void VarpaIsGivenASingleStringInput()
        {
            var function = new Varpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("string"), this.ParsingContext);

            Assert.AreEqual(eErrorType.Value, ((ExcelErrorValue)result1.Result).Type);
        }
Esempio n. 8
0
        public void VarpaIsGivenASingleFalseBooleanInput()
        {
            var function = new Varpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(false), this.ParsingContext);

            Assert.AreEqual(0, result1.ResultNumeric, .00001);;
        }
Esempio n. 9
0
        public void VarpaIsGivenDateTimeInputsSeperatedByADashAsInputs()
        {
            var function = new Varpa();
            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(10034.88889, result1.ResultNumeric, .00001);
        }
Esempio n. 10
0
        public void VarpaIsGivenMonthDayYear12HourTimeAsInputs()
        {
            var function = new Varpa();
            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(1213568.837, result1.ResultNumeric, .001);
        }
Esempio n. 11
0
        public void VarpaIsGiven12HourTimesAsInputs()
        {
            var function = new Varpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("12:00 am", "02:00 am", "01:00 pm"), this.ParsingContext);

            Assert.AreEqual(0.056712963, result1.ResultNumeric, .00001);
        }
Esempio n. 12
0
        public void VarpaIsGivenNumbersAsInputstakeTwo()
        {
            var function = new Varpa();
            var result1  = function.Execute(FunctionsHelper.CreateArgs(-1, -1, -1), this.ParsingContext);

            Assert.AreEqual(0, result1.ResultNumeric, .00001);
        }
Esempio n. 13
0
        public void VarpaIsGivenMaxAmountOfInputs254()
        {
            var function = new Varpa();
            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(38.43469837, result1.ResultNumeric, .00001);
        }