Esempio n. 1
0
        public void VarSIsGivenStringNumbersAsInputs()
        {
            var function = new VarS();
            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(1, result1.ResultNumeric, .00001);
            Assert.AreEqual(1.21, result2.ResultNumeric, .00001);
        }
Esempio n. 2
0
        public void VarSIsGivenAMixedStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new VarS();
            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(414266111.4, result1.ResultNumeric, .1);
            Assert.AreEqual(331429287.4, result2.ResultNumeric, .1);
        }
Esempio n. 3
0
        public void VarSIsGivenAStringInputWithAEmptyCellInTheMiddle()
        {
            var function = new VarS();
            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(727.6944444, result1.ResultNumeric, .00001);
            Assert.AreEqual(925.3888889, result2.ResultNumeric, .00001);
        }
Esempio n. 4
0
        public void VarSIsGivenAMixOfInputTypes()
        {
            var function = new VarS();
            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(331469980, result1.ResultNumeric, .1);
            Assert.AreEqual(414333941.1, result2.ResultNumeric, .1);
        }
Esempio n. 5
0
        public void VarSIsGivenBooleanInputs()
        {
            var function       = new VarS();
            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.333333333, result1.ResultNumeric, .00001);
            Assert.AreEqual(0, result2.ResultNumeric, .00001);
            Assert.AreEqual(0.333333333, result3.ResultNumeric, .00001);
        }
Esempio n. 6
0
        public void VarSIsGivenADateSeperatedByABackslash()
        {
            var function = new VarS();
            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(7600.333333, result2.ResultNumeric, .00001);
            Assert.AreEqual(133590.3333, result3.ResultNumeric, .0001);
        }
Esempio n. 7
0
        public void VarSIsGivenASingleStringInput()
        {
            var function = new VarS();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("string"), this.ParsingContext);

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

            Assert.AreEqual(0, result1.ResultNumeric, .00001);;
        }
Esempio n. 9
0
        public void VarSIsGivenDateTimeInputsSeperatedByADashAsInputs()
        {
            var function = new VarS();
            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(15052.33333, result1.ResultNumeric, .00001);
        }
Esempio n. 10
0
        public void VarSIsGivenMonthDayYear12HourTimeAsInputs()
        {
            var function = new VarS();
            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(1820353.255, result1.ResultNumeric, .001);
        }
Esempio n. 11
0
        public void VarSIsGiven12HourTimesAsInputs()
        {
            var function = new VarS();
            var result1  = function.Execute(FunctionsHelper.CreateArgs("12:00 am", "02:00 am", "01:00 pm"), this.ParsingContext);

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

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