public override UnitTestReport Test() { var report = new UnitTestReport(); foreach (var exp in Samples) { var calc = new AscCalc(exp); try { calc.Compute(); } catch (Exception e) { report.Add(exp, e.Message); } } return(report); }
public void Process(string expr) { Exception exc = null; var calcTask = new Thread(() => { try { if (!Security.ExprSecure(Expression)) { throw new SecurityException(); } AscCalc calc = new AscCalc(Expression, latex: true); CalcResult cr; cr = calc.Compute(); PlainCalcResponse = cr.Result; CalcResponse = cr.LatexResult; InterpretedAs = string.Join("<br>", cr.InterpretedAs); } catch (Exception e) { exc = e; } }); calcTask.Start(); if (!calcTask.Join(millisecondsTimeout: Const.LIMIT_CALC_EXECUTE_MS)) { throw new TimeOutException(); } if (exc != null) { throw exc; } // TO DO // @"\[x = {-b \pm \sqrt{b^2-4ac} \over 2a}.\] change this in Procees(Expression) method for latex expression"; }