Example #1
0
        private bool Check(string expression, double answer)
        {
            var  temp   = Calculator.CountAnExpression(expression, new StackArray());
            bool result = temp.Item2;

            result &= Math.Abs(temp.Item1 - answer) < 1e-5;
            return(result);
        }
Example #2
0
 public bool IncorrectExpressionsTest(string expression)
 {
     return(Calculator.CountAnExpression(expression, new StackArray()).Item2&& Calculator.CountAnExpression(expression, new StackList()).Item2);
 }
Example #3
0
        public bool MultipleExpressionsTest(string expression, double result)
        {
            bool testResult = Math.Abs(Calculator.CountAnExpression(expression, new StackArray()).Item1 - result) < 1e-4;

            return(testResult && Math.Abs(Calculator.CountAnExpression(expression, new StackList()).Item1 - result) < 1e-4);
        }