Ejemplo n.º 1
0
        public void CalculateTest()
        {
            ExpCalculator calculator = new ExpCalculator();

            Assert.AreEqual(148.413159102577, calculator.Calculate(5));
            Assert.AreEqual(1, calculator.Calculate(0));
        }
Ejemplo n.º 2
0
        public void CalculateTest(double firstValue, double expected)
        {
            var calculator   = new ExpCalculator();
            var actualResult = calculator.Calculate(firstValue);

            Assert.AreEqual(expected, actualResult, 0.01);
        }
Ejemplo n.º 3
0
        public void CalculateTest(double firstArgument, double expectedAnswer)
        {
            var calculator   = new ExpCalculator();
            var actualResult = calculator.Calculate(firstArgument);

            Assert.AreEqual(expectedAnswer, actualResult, 0.001);
        }
Ejemplo n.º 4
0
        void CalcTests(double testnum)
        {
            ExpCalculator expc = new ExpCalculator();
            double        expResult = Math.Exp(testnum), actResult = expc.Calculate(testnum);

            Assert.AreEqual(expResult, actResult);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 内存比较
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public bool IsMatch(object obj)
        {
            foreach (var item in _expression)
            {
                if (item is Operand)
                {
                    ((Operand)item).Bind(obj);
                }
            }

            return(ExpCalculator.Calculate(_expression));
        }