Ejemplo n.º 1
0
        public bool ExpressionEvaluator(Parameter parameter)
        {
            CodingSeb.ExpressionEvaluator.ExpressionEvaluator expressionEvaluator = new CodingSeb.ExpressionEvaluator.ExpressionEvaluator();

            List <int> results = new List <int>(parameter.Statements.Length);

            foreach (string statement in parameter.Statements)
            {
                int result = expressionEvaluator.Evaluate <int>(statement);

                results.Add(result);
            }

            return(Assert(results, parameter.Sum));
        }
Ejemplo n.º 2
0
        public bool ExpressionEvaluator(Parameter parameter)
        {
            CodingSeb.ExpressionEvaluator.ExpressionEvaluator expressionEvaluator = new CodingSeb.ExpressionEvaluator.ExpressionEvaluator();
            expressionEvaluator.Variables["n"] = parameter.Numbers;

            List <int> results = new List <int>(parameter.Numbers.Length);

            foreach (int number in parameter.Numbers)
            {
                int result = expressionEvaluator.Evaluate <int>(parameter.Statements[number]);

                results.Add(result);
            }

            return(Assert(results, parameter.Sum));
        }